mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 901343 - Tests that use createSystemXHR are failing on b2g mochitest. r=sicking
This commit is contained in:
parent
176c547fd6
commit
e6a1d72158
@ -89,9 +89,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
e.target.hits['fn_other_event_name']++;
|
||||
}
|
||||
|
||||
var domBranch;
|
||||
var oldPrefVal;
|
||||
|
||||
var gEventSourceObj1 = null, gEventSourceObj1_e, gEventSourceObj1_f;
|
||||
var gEventSourceObj2 = null;
|
||||
var gEventSourceObj3_a = null, gEventSourceObj3_b = null,
|
||||
@ -250,6 +247,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
}
|
||||
|
||||
function doTest3_b(test_id) {
|
||||
// currently no support yet for local files for b2g/Android mochitest, see bug 838726
|
||||
if (navigator.appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G") {
|
||||
setTestHasFinished(test_id);
|
||||
return;
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", "/dynamic/getMyDirectory.sjs", false);
|
||||
xhr.send();
|
||||
@ -462,7 +465,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
function doTest5_c(test_id)
|
||||
{
|
||||
// credentials using the auth cache and cookies
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.withCredentials = true;
|
||||
// also, test mixed mode UI
|
||||
xhr.open("GET", "https://example.com/tests/content/base/test/file_restrictedEventSource.sjs?test=user1_xhr", true, "user 1", "password 1");
|
||||
@ -491,7 +494,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
|
||||
function doTest5_d(test_id)
|
||||
{
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.withCredentials = true;
|
||||
xhr.open("GET", "https://example.com/tests/content/base/test/file_restrictedEventSource.sjs?test=user2_xhr", true, "user 2", "password 2");
|
||||
xhr.send();
|
||||
@ -519,7 +522,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
function doTest5_e(test_id)
|
||||
{
|
||||
// credentials using the auth cache and cookies
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.withCredentials = true;
|
||||
xhr.open("GET", "http://example.org/tests/content/base/test/file_restrictedEventSource.sjs?test=user1_xhr", true, "user 1", "password 1");
|
||||
xhr.send();
|
||||
@ -547,7 +550,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
|
||||
function doTest5_f(test_id)
|
||||
{
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.withCredentials = true;
|
||||
xhr.open("GET", "http://example.org/tests/content/base/test/file_restrictedEventSource.sjs?test=user2_xhr", true, "user 2", "password 2");
|
||||
xhr.send();
|
||||
@ -614,7 +617,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
gEventSourceObj7.msg_received[1] == "delayed1" &&
|
||||
gEventSourceObj7.msg_received[2] == "delayed2", "Test 7 failed");
|
||||
|
||||
SpecialPowers.setBoolPref("dom.server-events.enabled", oldPrefVal);
|
||||
document.getElementById('waitSpan').innerHTML = '';
|
||||
setTestHasFinished(test_id);
|
||||
}, parseInt(8000*stress_factor));
|
||||
@ -623,13 +625,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
function doTest()
|
||||
{
|
||||
// Allow all cookies, then run the actual test
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]}, doTestCallback);
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0], ["dom.server-events.enabled", true]]}, function() { SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], doTestCallback);});
|
||||
}
|
||||
|
||||
function doTestCallback()
|
||||
{
|
||||
oldPrefVal = SpecialPowers.getBoolPref("dom.server-events.enabled");
|
||||
SpecialPowers.setBoolPref("dom.server-events.enabled", true);
|
||||
|
||||
// we get a good stress_factor by testing 10 setTimeouts and some float
|
||||
// arithmetic taking my machine as stress_factor==1 (time=589)
|
||||
|
@ -21,12 +21,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=426308
|
||||
|
||||
const SJS_URL = "http://example.org:80/tests/content/base/test/bug426308-redirect.sjs";
|
||||
|
||||
var req = SpecialPowers.createSystemXHR();
|
||||
req.open("GET", SJS_URL + "?" + window.location.href, false);
|
||||
req.send(null);
|
||||
function startTest() {
|
||||
var req = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
req.open("GET", SJS_URL + "?" + window.location.href, false);
|
||||
req.send(null);
|
||||
|
||||
is(req.status, 200, "Redirect did not happen");
|
||||
is(req.status, 200, "Redirect did not happen");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], startTest);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -51,7 +51,7 @@ function createDoc() {
|
||||
function xhrDoc(idx) {
|
||||
return function() {
|
||||
// Defy same-origin restrictions!
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.open("GET", docSources[idx], false);
|
||||
xhr.send();
|
||||
return xhr.responseXML;
|
||||
@ -87,6 +87,10 @@ function doTest(idx) {
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], startTest);
|
||||
});
|
||||
|
||||
function startTest() {
|
||||
// sanity check
|
||||
isnot("", null, "Shouldn't be equal!");
|
||||
|
||||
@ -104,7 +108,7 @@ addLoadEvent(function() {
|
||||
xhr.abort();
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=804395
|
||||
<script type="application/javascript">
|
||||
|
||||
function test200() {
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.bar', true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4) {
|
||||
@ -31,7 +31,7 @@ function test200() {
|
||||
}
|
||||
|
||||
function test404() {
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.do_not_exist', true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4) {
|
||||
@ -43,7 +43,7 @@ function test404() {
|
||||
}
|
||||
|
||||
function test0() {
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
var xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.bar', true);
|
||||
ok(xhr.status == 0, "Not Sent request must have status 0");
|
||||
runTests();
|
||||
@ -61,9 +61,11 @@ function runTests() {
|
||||
}
|
||||
|
||||
/** Test for Bug 804395 **/
|
||||
runTests();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], runTests);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -49,37 +49,47 @@ var headers = [
|
||||
];
|
||||
var i, request;
|
||||
|
||||
// Try setting headers in unprivileged context
|
||||
request = new XMLHttpRequest();
|
||||
request.open("GET", window.location.href);
|
||||
for (i = 0; i < headers.length; i++)
|
||||
request.setRequestHeader(headers[i], "test" + i);
|
||||
function startTest() {
|
||||
// Try setting headers in unprivileged context
|
||||
request = new XMLHttpRequest();
|
||||
request.open("GET", window.location.href);
|
||||
for (i = 0; i < headers.length; i++)
|
||||
request.setRequestHeader(headers[i], "test" + i);
|
||||
|
||||
// Read out headers
|
||||
var channel = SpecialPowers.wrap(request).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
|
||||
for (i = 0; i < headers.length; i++) {
|
||||
// Retrieving Content-Length will throw an exception
|
||||
var value = null;
|
||||
try {
|
||||
value = channel.getRequestHeader(headers[i]);
|
||||
// Read out headers
|
||||
var channel = SpecialPowers.wrap(request).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
|
||||
for (i = 0; i < headers.length; i++) {
|
||||
// Retrieving Content-Length will throw an exception
|
||||
var value = null;
|
||||
try {
|
||||
value = channel.getRequestHeader(headers[i]);
|
||||
}
|
||||
catch(e) {}
|
||||
|
||||
isnot(value, "test" + i, "Setting " + headers[i] + " header in unprivileged context");
|
||||
}
|
||||
catch(e) {}
|
||||
|
||||
isnot(value, "test" + i, "Setting " + headers[i] + " header in unprivileged context");
|
||||
// Try setting headers in privileged context
|
||||
request = new XMLHttpRequest({mozAnon: false, mozSystem: true});
|
||||
request.open("GET", window.location.href);
|
||||
for (i = 0; i < headers.length; i++)
|
||||
request.setRequestHeader(headers[i], "test" + i);
|
||||
|
||||
// Read out headers
|
||||
var channel = SpecialPowers.wrap(request).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
|
||||
for (i = 0; i < headers.length; i++) {
|
||||
var value = channel.getRequestHeader(headers[i]);
|
||||
is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
// Try setting headers in privileged context
|
||||
request = SpecialPowers.createSystemXHR();
|
||||
request.open("GET", window.location.href);
|
||||
for (i = 0; i < headers.length; i++)
|
||||
request.setRequestHeader(headers[i], "test" + i);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Read out headers
|
||||
var channel = request.channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel);
|
||||
for (i = 0; i < headers.length; i++) {
|
||||
var value = channel.getRequestHeader(headers[i]);
|
||||
is(value, "test" + i, "Setting " + headers[i] + " header in privileged context");
|
||||
}
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], startTest);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -36,7 +36,6 @@
|
||||
"content/base/test/test_websocket_hello.html": "",
|
||||
"content/base/test/test_x-frame-options.html": "",
|
||||
"content/base/test/test_xhr_abort_after_load.html": "",
|
||||
"content/base/test/test_xhr_forbidden_headers.html": "",
|
||||
"content/base/test/test_xhr_progressevents.html": "",
|
||||
"content/base/test/websocket_hybi/test_receive-arraybuffer.html": "",
|
||||
"content/base/test/websocket_hybi/test_receive-blob.html": "",
|
||||
|
@ -37,7 +37,6 @@
|
||||
"content/base/test/test_websocket_hello.html": "",
|
||||
"content/base/test/test_x-frame-options.html": "",
|
||||
"content/base/test/test_xhr_abort_after_load.html": "",
|
||||
"content/base/test/test_xhr_forbidden_headers.html": "",
|
||||
"content/base/test/test_xhr_progressevents.html": "",
|
||||
"content/base/test/websocket_hybi/test_receive-arraybuffer.html": "",
|
||||
"content/base/test/websocket_hybi/test_receive-blob.html": "",
|
||||
|
@ -92,8 +92,7 @@
|
||||
"content/base/test/test_bug431701.html":"xmlhttprequest causes crash, bug 902271",
|
||||
"content/base/test/test_bug422537.html":"xmlhttprequest causes crash, bug 902271",
|
||||
|
||||
"content/base/test/test_bug338583.html":"43 total - bug 901343, specialpowers.wrap issue createsystemxhr",
|
||||
"content/base/test/test_bug804395.html":"bug 901343, specialpowers.wrap issue createsystemxhr",
|
||||
"content/base/test/test_bug338583.html":"https not working, bug 907770",
|
||||
|
||||
"content/base/test/test_bug475156.html":"36 total - bug 902611",
|
||||
"content/base/test/test_bug422403-1.html":"bug 901343, specialpowers.wrap issue [nsIChannel.open]",
|
||||
@ -249,7 +248,6 @@
|
||||
"content/base/test/test_bug422403-2.xhtml":"",
|
||||
"content/base/test/test_bug424359-1.html":"",
|
||||
"content/base/test/test_bug424359-2.html":"",
|
||||
"content/base/test/test_bug426308.html":"",
|
||||
"content/base/test/test_mixed_content_blocker_bug803225.html":"",
|
||||
"content/html/document/test/test_non-ascii-cookie.html":"",
|
||||
|
||||
@ -321,7 +319,7 @@
|
||||
"dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html":"",
|
||||
|
||||
"dom/network/tests/test_networkstats_basics.html":"Will be fixed in bug 858005",
|
||||
"dom/permission/tests/test_permission_basics.html":"Bug 907770",
|
||||
"dom/permission/tests/test_permission_basics.html":"https not working, bug 907770",
|
||||
|
||||
"dom/tests/mochitest/bugs/test_bug335976.xhtml":"",
|
||||
"dom/tests/mochitest/bugs/test_bug369306.html":"test timed out, can't focus back from popup window to opener?",
|
||||
|
@ -79,11 +79,6 @@ function starttest(){
|
||||
is(SpecialPowers.DOMWindowUtils.getClassName(window), "Proxy");
|
||||
is(SpecialPowers.DOMWindowUtils.docCharsetIsForced, false);
|
||||
|
||||
//Run the createSystemXHR method
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
ok(xhr, "createSystemXHR should not return null");
|
||||
is(xhr.readyState, XMLHttpRequest.UNSENT, "createSystemXHR should create an unsent XMLHttpRequest object");
|
||||
|
||||
// QueryInterface and getPrivilegedProps tests
|
||||
is(SpecialPowers.can_QI(SpecialPowers), false);
|
||||
ok(SpecialPowers.can_QI(window));
|
||||
@ -99,7 +94,7 @@ function starttest(){
|
||||
|
||||
// Try some basic stuff with XHR.
|
||||
var xhr2 = SpecialPowers.Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(SpecialPowers.Ci.nsIXMLHttpRequest);
|
||||
is(xhr.readyState, XMLHttpRequest.UNSENT, "Should be able to get props off privileged objects");
|
||||
is(xhr2.readyState, XMLHttpRequest.UNSENT, "Should be able to get props off privileged objects");
|
||||
var testURI = SpecialPowers.Cc['@mozilla.org/network/standard-url;1']
|
||||
.createInstance(SpecialPowers.Ci.nsIURI);
|
||||
testURI.spec = "http://www.foobar.org/";
|
||||
|
@ -1178,10 +1178,6 @@ SpecialPowersAPI.prototype = {
|
||||
this._getMUDV(window).stopEmulatingMedium();
|
||||
},
|
||||
|
||||
createSystemXHR: function() {
|
||||
return this.wrap(Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest));
|
||||
},
|
||||
|
||||
snapshotWindowWithOptions: function (win, rect, bgcolor, options) {
|
||||
var el = this.window.get().document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
if (rect === undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user