diff --git a/content/base/test/test_XHR.html b/content/base/test/test_XHR.html index 423887af912..730fae85a9e 100644 --- a/content/base/test/test_XHR.html +++ b/content/base/test/test_XHR.html @@ -5,15 +5,20 @@ - +

-
 
diff --git a/content/base/test/test_XHRSendData.html b/content/base/test/test_XHRSendData.html index a0ee12ae71a..53a749b43ee 100644 --- a/content/base/test/test_XHRSendData.html +++ b/content/base/test/test_XHRSendData.html @@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=464848 - + Mozilla Bug 464848

@@ -19,6 +19,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=464848

 
 
diff --git a/content/base/test/test_bug466080.html b/content/base/test/test_bug466080.html index 4a2c21bdb36..17a76819bb7 100644 --- a/content/base/test/test_bug466080.html +++ b/content/base/test/test_bug466080.html @@ -86,14 +86,14 @@ function onWindowLoad() { ok(document.iframeWasLoaded, "Loading resource via src-attribute"); - for each (test in alltests) { + function runTest(test) { var xhr = new XMLHttpRequest(); - + var method = "GET"; if (test.method != null) { method = test.method; } - xhr.open(method, test.url, false); - + xhr.open(method, test.url); + xhr.withCredentials = test.withCredentials; netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -104,11 +104,20 @@ function onWindowLoad() { xhr.send(); } catch(e) { } - var success = eval(xhr.status + test.status_check); - ok(success, test.error); + + xhr.onloadend = function() { + var success = eval(xhr.status + test.status_check); + ok(success, test.error); + + if (alltests.length == 0) { + SimpleTest.finish(); + } else { + runTest(alltests.shift()); + } + }; } - - SimpleTest.finish(); + + runTest(alltests.shift()); } SimpleTest.waitForExplicitFinish(); diff --git a/content/base/test/unit/test_xhr_standalone.js b/content/base/test/unit/test_xhr_standalone.js new file mode 100644 index 00000000000..e1e55f3f584 --- /dev/null +++ b/content/base/test/unit/test_xhr_standalone.js @@ -0,0 +1,21 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Test setting .responseType and .withCredentials is allowed +// in non-window non-Worker context + +function run_test() +{ + var xhr = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1']. + createInstance(Components.interfaces.nsIXMLHttpRequest); + xhr.open('GET', 'data:,', false); + var exceptionThrown = false; + try { + xhr.responseType = ''; + xhr.withCredentials = false; + } catch (e) { + exceptionThrown = true; + } + do_check_eq(false, exceptionThrown); +} diff --git a/content/base/test/unit/xpcshell.ini b/content/base/test/unit/xpcshell.ini index 95d8d5dee10..261530fdff4 100644 --- a/content/base/test/unit/xpcshell.ini +++ b/content/base/test/unit/xpcshell.ini @@ -7,4 +7,5 @@ tail = [test_csputils.js] [test_error_codes.js] [test_thirdpartyutil.js] +[test_xhr_standalone.js] [test_xmlserializer.js]