diff --git a/XMLHttpRequest/MANIFEST b/XMLHttpRequest/MANIFEST index 975f3f544c3171..9d02d98a11a2a5 100644 --- a/XMLHttpRequest/MANIFEST +++ b/XMLHttpRequest/MANIFEST @@ -133,3 +133,6 @@ xmlhttprequest-timeout-worker-simple.html xmlhttprequest-timeout-worker-synconworker.html xmlhttprequest-timeout-worker-twice.html xmlhttprequest-unsent.htm +manual send-authentication-existing-session-interactive.htm +manual send-authentication-prompt-interactive.htm +manual send-authentication-prompt-interactive-2.htm diff --git a/XMLHttpRequest/abort-after-send.htm b/XMLHttpRequest/abort-after-send.htm index a1de1096011a15..10062a4a9c16e6 100644 --- a/XMLHttpRequest/abort-after-send.htm +++ b/XMLHttpRequest/abort-after-send.htm @@ -4,7 +4,14 @@ XMLHttpRequest: abort() after send() - + + + + + + + +
@@ -14,7 +21,7 @@ var client = new XMLHttpRequest(), control_flag = false, result = [], - expected = [1, 4] // open() -> 1, abort() -> 4 + expected = [1, 4, 'progress', 'abort', 'loadend'] // open() -> 1, abort() -> 4 client.onreadystatechange = function() { test.step(function() { result.push(client.readyState) @@ -25,16 +32,23 @@ assert_equals(client.status, 0) assert_equals(client.statusText, "") assert_equals(client.getAllResponseHeaders(), "") + assert_equals(client.getResponseHeader('Content-Type'), null) } }) } client.open("GET", "resources/well-formed.xml", true) client.send(null) + client.addEventListener('progress', logEvt) + client.addEventListener('abort', logEvt) + client.addEventListener('loadend', logEvt) client.abort() assert_true(control_flag) assert_equals(client.readyState, 0) assert_array_equals(result, expected) test.done() + function logEvt (e) { + result.push(e.type) + } }) diff --git a/XMLHttpRequest/abort-during-done.htm b/XMLHttpRequest/abort-during-done.htm index ab25980f15cca7..eb5557104c94de 100644 --- a/XMLHttpRequest/abort-during-done.htm +++ b/XMLHttpRequest/abort-during-done.htm @@ -4,7 +4,7 @@ XMLHttpRequest: abort() during DONE - +
diff --git a/XMLHttpRequest/abort-during-open.htm b/XMLHttpRequest/abort-during-open.htm index f0e096bc5d6080..0080badaafe083 100644 --- a/XMLHttpRequest/abort-during-open.htm +++ b/XMLHttpRequest/abort-during-open.htm @@ -4,7 +4,8 @@ XMLHttpRequest: abort() during OPEN - + +
@@ -18,8 +19,9 @@ assert_unreached() }) } - client.abort(); + client.abort() assert_equals(client.readyState, 0) + assert_throws("InvalidStateError", function() { client.send("test") }, "calling send() after abort()") }) test.done() diff --git a/XMLHttpRequest/abort-during-unsent.htm b/XMLHttpRequest/abort-during-unsent.htm index c98f2f78c94eff..a0d83126422ffa 100644 --- a/XMLHttpRequest/abort-during-unsent.htm +++ b/XMLHttpRequest/abort-during-unsent.htm @@ -4,7 +4,7 @@ XMLHttpRequest: abort() during UNSENT - +
diff --git a/XMLHttpRequest/abort-during-upload.htm b/XMLHttpRequest/abort-during-upload.htm new file mode 100644 index 00000000000000..ba296448897a83 --- /dev/null +++ b/XMLHttpRequest/abort-during-upload.htm @@ -0,0 +1,42 @@ + + + + XMLHttpRequest: abort() while sending data + + + + + + +
+ + + diff --git a/XMLHttpRequest/abort-event-abort.htm b/XMLHttpRequest/abort-event-abort.htm index ac23ebd45573e2..e840ecb512b596 100644 --- a/XMLHttpRequest/abort-event-abort.htm +++ b/XMLHttpRequest/abort-event-abort.htm @@ -3,18 +3,18 @@ - XMLHttpRequest: The abort() method: Fire a progress event named abort + XMLHttpRequest: The abort() method: do not fire abort event in OPENED state when send() flag is unset. send() throws after abort().
diff --git a/XMLHttpRequest/abort-event-listeners.htm b/XMLHttpRequest/abort-event-listeners.htm index 248124ddec48a7..885834f583fddb 100644 --- a/XMLHttpRequest/abort-event-listeners.htm +++ b/XMLHttpRequest/abort-event-listeners.htm @@ -4,7 +4,7 @@ XMLHttpRequest: abort() should not reset event listeners - +
diff --git a/XMLHttpRequest/data-uri-basic.htm b/XMLHttpRequest/data-uri-basic.htm index d457cb47e5c60b..037fb9f3e106d9 100644 --- a/XMLHttpRequest/data-uri-basic.htm +++ b/XMLHttpRequest/data-uri-basic.htm @@ -3,7 +3,8 @@ XMLHttpRequest: basic data uri - + +
@@ -24,12 +25,24 @@ do_test("GET responseText", 'GET', "data:text/plain,Hello, World!", function (client) { assert_equals(client.responseText, "Hello, World!") }); + do_test("GET responseText base64", 'GET', "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D", function (client) { + assert_equals(client.responseText, "Hello, World!") + }); do_test("GET status", 'GET', "data:text/plain,Hello, World!", function (client) { assert_equals(client.status, 200); }); + do_test("GET statusText", 'GET', "data:text/plain,Hello, World!", function (client) { + assert_equals(client.statusText, "OK"); + }); do_test("GET Content-Type", 'GET', "data:text/plain,Hello, World!", function (client) { assert_equals(client.getResponseHeader('Content-Type'), 'text/plain'); }); + do_test("GET Content-Type with param", 'GET', "data:text/html;charset=utf-8,

Hello, World!", function (client) { + assert_equals(client.getResponseHeader('Content-Type'), 'text/html;charset=utf-8'); + }); + do_test("GET getAllResponseHeaders", 'GET', "data:text/plain,Hello, World!", function (client) { + assert_equals(client.getAllResponseHeaders(), 'content-type: text/plain'); + }); do_test("POST responseText", 'POST', "data:text/plain,Hello, World!", function (client) { assert_equals(client.responseText, null); }); diff --git a/XMLHttpRequest/data-uri.htm b/XMLHttpRequest/data-uri.htm index 6dc1f95bf1ac09..db4cbe8aa12d73 100644 --- a/XMLHttpRequest/data-uri.htm +++ b/XMLHttpRequest/data-uri.htm @@ -3,14 +3,14 @@ XMLHttpRequest: data uri - - + +

- - - + + +
diff --git a/XMLHttpRequest/event-load.htm b/XMLHttpRequest/event-load.htm index 9cce60efd1beff..ab8952b29d6f0b 100644 --- a/XMLHttpRequest/event-load.htm +++ b/XMLHttpRequest/event-load.htm @@ -1,18 +1,21 @@ -XMLHttpRequest: load event +XMLHttpRequest: The send() method: Fire an event named load (synchronous flag is unset) - - - + + + +
- - - + + +
@@ -14,15 +14,17 @@ var test = async_test(); test.step(function() { var client = new XMLHttpRequest(); - client.onloadstart = test.step_func(function() { + client.onloadstart = test.step_func(function(e) { + assert_true(e instanceof ProgressEvent); + assert_equals(e.type, "loadstart"); assert_equals(client.readyState, 1); test.done(); }); - client.open("GET", "resources/well-formed.xml"); - client.send(null); setTimeout(test.step_func(function () { assert_unreached("onloadstart not called after 500 ms"); }), 500); + client.open("GET", "resources/well-formed.xml"); + client.send(null); }); diff --git a/XMLHttpRequest/event-progress.htm b/XMLHttpRequest/event-progress.htm index 9938423ea1c6ce..0c254f9d9a9603 100644 --- a/XMLHttpRequest/event-progress.htm +++ b/XMLHttpRequest/event-progress.htm @@ -1,22 +1,22 @@ -XMLHttpRequest: progress event +XMLHttpRequest: The send() method: Fire a progress event named progress (synchronous flag is unset) - - - - - + + + + +
- - - - - + + + + +
diff --git a/XMLHttpRequest/event-upload-progress.htm b/XMLHttpRequest/event-upload-progress.htm index 25468d170dbe2f..175dc7f46c3cec 100644 --- a/XMLHttpRequest/event-upload-progress.htm +++ b/XMLHttpRequest/event-upload-progress.htm @@ -4,9 +4,10 @@ XMLHttpRequest: upload progress event - - - + + + +
- - - - - + + + + +
- - - - - - + + + +
diff --git a/XMLHttpRequest/getresponseheader-case-insensitive.htm b/XMLHttpRequest/getresponseheader-case-insensitive.htm index 83f70c7044df00..0b16a4ae622705 100644 --- a/XMLHttpRequest/getresponseheader-case-insensitive.htm +++ b/XMLHttpRequest/getresponseheader-case-insensitive.htm @@ -4,7 +4,7 @@ XMLHttpRequest: getResponseHeader() case-insensitive matching - +
diff --git a/XMLHttpRequest/getresponseheader-chunked-trailer.htm b/XMLHttpRequest/getresponseheader-chunked-trailer.htm new file mode 100644 index 00000000000000..de219e1350a537 --- /dev/null +++ b/XMLHttpRequest/getresponseheader-chunked-trailer.htm @@ -0,0 +1,32 @@ + + + + XMLHttpRequest: getResponseHeader() and HTTP trailer + + + + + +
+ + + diff --git a/XMLHttpRequest/getresponseheader-cookies-and-more.htm b/XMLHttpRequest/getresponseheader-cookies-and-more.htm index 7b970af96a7047..e17ad0eaa83105 100644 --- a/XMLHttpRequest/getresponseheader-cookies-and-more.htm +++ b/XMLHttpRequest/getresponseheader-cookies-and-more.htm @@ -4,6 +4,7 @@ XMLHttpRequest: getResponseHeader() custom/non-existent headers and cookies +
diff --git a/XMLHttpRequest/getresponseheader-error-state.htm b/XMLHttpRequest/getresponseheader-error-state.htm new file mode 100644 index 00000000000000..1a318639f922c1 --- /dev/null +++ b/XMLHttpRequest/getresponseheader-error-state.htm @@ -0,0 +1,36 @@ + + + + XMLHttpRequest: getResponseHeader() in error state (failing cross-origin test) + + + + + +
+ + + diff --git a/XMLHttpRequest/info.htm b/XMLHttpRequest/info.htm deleted file mode 100644 index 7c4f4553fce648..00000000000000 --- a/XMLHttpRequest/info.htm +++ /dev/null @@ -1,5 +0,0 @@ - -XMLHttpRequest Test Suite -

XMLHttpRequest Test Suite

-

There is a good chance a test suite for XMLHttpRequest will be placed around here. Along with implementation reports.

- diff --git a/XMLHttpRequest/open-after-abort.htm b/XMLHttpRequest/open-after-abort.htm index 89cab18fce4119..747f32d116e2d3 100644 --- a/XMLHttpRequest/open-after-abort.htm +++ b/XMLHttpRequest/open-after-abort.htm @@ -4,8 +4,7 @@ XMLHttpRequest: open() after abort() - - +
@@ -14,7 +13,7 @@ test.step(function() { var client = new XMLHttpRequest(), result = [], - expected = [1, 1, 4, 1] // open() -> 1, send() -> 1, + expected = [1, 4, 1] // open() -> 1, // abort() -> 4, open() -> 1 client.onreadystatechange = function() { test.step(function() { @@ -22,10 +21,12 @@ }) } client.open("GET", "resources/well-formed.xml") + assert_equals(client.readyState, 1) client.send(null) client.abort() assert_equals(client.readyState, 0) client.open("GET", "resources/well-formed.xml") + assert_equals(client.readyState, 1) assert_array_equals(result, expected) }) test.done() diff --git a/XMLHttpRequest/open-after-setrequestheader.htm b/XMLHttpRequest/open-after-setrequestheader.htm new file mode 100644 index 00000000000000..63ce112e528222 --- /dev/null +++ b/XMLHttpRequest/open-after-setrequestheader.htm @@ -0,0 +1,33 @@ + + + + XMLHttpRequest: open() after setRequestHeader() + + + + + + +
+ + + diff --git a/XMLHttpRequest/open-method-bogus.htm b/XMLHttpRequest/open-method-bogus.htm index e42f4d25bd7b75..d2aa49cb8fcb6e 100644 --- a/XMLHttpRequest/open-method-bogus.htm +++ b/XMLHttpRequest/open-method-bogus.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - bogus methods +
@@ -11,7 +12,7 @@ function method(method) { test(function() { var client = new XMLHttpRequest() - assert_throws("SYNTAX_ERR", function() { client.open(method, "...") }) + assert_throws("SyntaxError", function() { client.open(method, "...") }) }, document.title + " (" + method + ")") } method("") diff --git a/XMLHttpRequest/open-method-case-insensitive.htm b/XMLHttpRequest/open-method-case-insensitive.htm index b56f5c96f7e27e..350541f5e2ba0c 100644 --- a/XMLHttpRequest/open-method-case-insensitive.htm +++ b/XMLHttpRequest/open-method-case-insensitive.htm @@ -4,6 +4,8 @@ XMLHttpRequest: open() - case-insensitive methods test + +
diff --git a/XMLHttpRequest/open-method-case-sensitive.htm b/XMLHttpRequest/open-method-case-sensitive.htm index bb7eb22b57ada3..4eb124bea8365d 100644 --- a/XMLHttpRequest/open-method-case-sensitive.htm +++ b/XMLHttpRequest/open-method-case-sensitive.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - case-sensitive methods test +
diff --git a/XMLHttpRequest/open-method-insecure.htm b/XMLHttpRequest/open-method-insecure.htm index 76ddda5cf0ec2c..3938a7a6ac8394 100644 --- a/XMLHttpRequest/open-method-insecure.htm +++ b/XMLHttpRequest/open-method-insecure.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - "insecure" methods +
@@ -11,7 +12,7 @@ function method(method) { test(function() { var client = new XMLHttpRequest() - assert_throws("SECURITY_ERR", function() { client.open(method, "...") }) + assert_throws("SecurityError", function() { client.open(method, "...") }) }, document.title + " (" + method + ")") } method("track") diff --git a/XMLHttpRequest/open-method-responsetype-set-sync.htm b/XMLHttpRequest/open-method-responsetype-set-sync.htm new file mode 100644 index 00000000000000..e84bd1d3a55a88 --- /dev/null +++ b/XMLHttpRequest/open-method-responsetype-set-sync.htm @@ -0,0 +1,27 @@ + + + + XMLHttpRequest: open() sync request not allowed if responseType is set + + + + + + +
+ + + diff --git a/XMLHttpRequest/open-open-send.htm b/XMLHttpRequest/open-open-send.htm index 2a53510ec50698..88b08339730f2e 100644 --- a/XMLHttpRequest/open-open-send.htm +++ b/XMLHttpRequest/open-open-send.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - open() - send() +
@@ -12,17 +13,18 @@ test.step(function() { var client = new XMLHttpRequest(), result = [], - expected = [1,1,1,2,3,4] + expected = [1,2,3,4] client.onreadystatechange = function() { test.step(function() { result.push(client.readyState) if(4 == client.readyState) { assert_array_equals(result, expected) + assert_equals(client.responseText, 'top\n') test.done() } }) } - client.open("GET", "folder.txt") + client.open("GET", "resources/folder.txt") client.open("GET", "folder.txt") client.send(null) }) diff --git a/XMLHttpRequest/open-open-sync-send.htm b/XMLHttpRequest/open-open-sync-send.htm index f2875907744420..635c48136754d7 100644 --- a/XMLHttpRequest/open-open-sync-send.htm +++ b/XMLHttpRequest/open-open-sync-send.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - open() (sync) - send() +
@@ -12,7 +13,7 @@ test.step(function() { var client = new XMLHttpRequest(), result = [], - expected = [1,1,4] + expected = [1,4] client.onreadystatechange = function() { test.step(function() { result.push(client.readyState) @@ -21,6 +22,7 @@ client.open("GET", "folder.txt") client.open("GET", "folder.txt", false) client.send(null) + assert_equals(client.responseText, 'top\n') assert_array_equals(result, expected) test.done() }) diff --git a/XMLHttpRequest/open-referer.htm b/XMLHttpRequest/open-referer.htm new file mode 100644 index 00000000000000..615d84ad31795f --- /dev/null +++ b/XMLHttpRequest/open-referer.htm @@ -0,0 +1,20 @@ + + + + XMLHttpRequest: open() - value of Referer header + + + + + +
+ + + diff --git a/XMLHttpRequest/open-send-open.htm b/XMLHttpRequest/open-send-open.htm index 04e39754367451..e3c351c700c1bb 100644 --- a/XMLHttpRequest/open-send-open.htm +++ b/XMLHttpRequest/open-send-open.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - send() - open() +
@@ -12,15 +13,18 @@ test.step(function() { var client = new XMLHttpRequest(), result = [], - expected = [1,1,1,1] + expected = [1, 'a', 'b', 'c'] client.onreadystatechange = function() { test.step(function() { result.push(client.readyState) }) } client.open("GET", "folder.txt") + result.push('a') client.send() + result.push('b') client.open("GET", "folder.txt") + result.push('c') assert_array_equals(result, expected) test.done() }) diff --git a/XMLHttpRequest/open-sync-open-send.htm b/XMLHttpRequest/open-sync-open-send.htm index 5a48789f7d957f..f4226ead546227 100644 --- a/XMLHttpRequest/open-sync-open-send.htm +++ b/XMLHttpRequest/open-sync-open-send.htm @@ -4,6 +4,13 @@ XMLHttpRequest: open() (sync) - send() - open() + + + + + + +
@@ -12,7 +19,7 @@ test.step(function() { var client = new XMLHttpRequest(), result = [], - expected = [1,4,1] + expected = [1] client.onreadystatechange = function() { test.step(function() { result.push(client.readyState) diff --git a/XMLHttpRequest/open-url-about-blank-window.htm b/XMLHttpRequest/open-url-about-blank-window.htm index 038df614658721..0c2012776c8960 100644 --- a/XMLHttpRequest/open-url-about-blank-window.htm +++ b/XMLHttpRequest/open-url-about-blank-window.htm @@ -4,6 +4,9 @@ XMLHttpRequest: open() resolving URLs (about:blank iframe) + + +
@@ -11,8 +14,8 @@ diff --git a/XMLHttpRequest/open-url-base-inserted-after-open.htm b/XMLHttpRequest/open-url-base-inserted-after-open.htm index 5c101381d68cc1..c17cb0c81b566e 100644 --- a/XMLHttpRequest/open-url-base-inserted-after-open.htm +++ b/XMLHttpRequest/open-url-base-inserted-after-open.htm @@ -4,6 +4,8 @@ XMLHttpRequest: open() resolving URLs - insert <base> after open() + +
@@ -11,7 +13,7 @@ test(function() { var client = new XMLHttpRequest(), base = document.createElement("base") - base.href = "http://localhost/xhr/resources/" + base.href = location.href.replace(/\/[^/]*$/, '') + "/resources/" client.open("GET", "folder.txt", false) document.getElementsByTagName("head")[0].appendChild(base) client.send(null) diff --git a/XMLHttpRequest/open-url-base-inserted.htm b/XMLHttpRequest/open-url-base-inserted.htm index fb61f7d15dae9d..873348946073b2 100644 --- a/XMLHttpRequest/open-url-base-inserted.htm +++ b/XMLHttpRequest/open-url-base-inserted.htm @@ -4,6 +4,8 @@ XMLHttpRequest: open() resolving URLs - insert <base> + +
@@ -11,7 +13,7 @@ test(function() { var client = new XMLHttpRequest(), base = document.createElement("base") - base.href = "http://localhost/xhr/resources/" + base.href = location.href.replace(/\/[^/]*$/, '') + "/resources/" document.getElementsByTagName("head")[0].appendChild(base) client.open("GET", "folder.txt", false) client.send(null) diff --git a/XMLHttpRequest/open-url-base.htm b/XMLHttpRequest/open-url-base.htm index 35c2cef142037c..06a048944df64e 100644 --- a/XMLHttpRequest/open-url-base.htm +++ b/XMLHttpRequest/open-url-base.htm @@ -4,7 +4,9 @@ XMLHttpRequest: open() resolving URLs - <base> - + + +
diff --git a/XMLHttpRequest/open-url-bogus.htm b/XMLHttpRequest/open-url-bogus.htm index a24518dceb998a..b8198886c3ee9f 100644 --- a/XMLHttpRequest/open-url-bogus.htm +++ b/XMLHttpRequest/open-url-bogus.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - bogus URLs +
@@ -11,7 +12,7 @@ function url(url) { test(function() { var client = new XMLHttpRequest() - assert_throws("SYNTAX_ERR", function() { client.open("GET", url) }) + assert_throws("SyntaxError", function() { client.open("GET", url) }) }, document.title + " (" + url + ")") } url("http:") diff --git a/XMLHttpRequest/open-url-encoding.htm b/XMLHttpRequest/open-url-encoding.htm index 4cc269320e1e28..cd028844e4424c 100644 --- a/XMLHttpRequest/open-url-encoding.htm +++ b/XMLHttpRequest/open-url-encoding.htm @@ -5,6 +5,7 @@ XMLHttpRequest: open() - URL encoding +
diff --git a/XMLHttpRequest/open-url-fragment.htm b/XMLHttpRequest/open-url-fragment.htm index c9a74328032cf3..d5495bebd4ddc3 100644 --- a/XMLHttpRequest/open-url-fragment.htm +++ b/XMLHttpRequest/open-url-fragment.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() resolving URLs - fragment identifier +
@@ -14,6 +15,24 @@ client.send(null) assert_equals(client.responseText, "top\n") }) + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "resources/requri.php#foobar", false) + client.send(null) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php$/) + }, 'make sure fragment is removed from URL before request') + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "resources/requri.php?help=#foobar", false) + client.send(null) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php\?help=$/) + }, 'make sure fragment is removed from URL before request (with query string)') + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "resources/requri.php?" +encodeURIComponent("#foobar"), false) + client.send(null) + assert_regexp_match(client.responseText, /XMLHttpRequest\/resources\/requri\.php\?%23foobar$/) + }, 'make sure escaped # is not removed') diff --git a/XMLHttpRequest/open-url-javascript-window-2.htm b/XMLHttpRequest/open-url-javascript-window-2.htm index 4a151ab692104f..3c0bd5309196ab 100644 --- a/XMLHttpRequest/open-url-javascript-window-2.htm +++ b/XMLHttpRequest/open-url-javascript-window-2.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - resolving URLs (javascript: <iframe>; 2) +
@@ -11,7 +12,7 @@ var test = async_test() test.step(function() { var iframe = document.body.appendChild(document.createElement("iframe")) - iframe.src = "javascript:parent.test.step(function() { var x = new XMLHttpRequest(); x.open('GET', 'folder.txt', false); x.send(null); parent.assert_equals(x.responseText, 'top\n'); parent.test.done() })" + iframe.src = "javascript:parent.test.step(function() { var x = new XMLHttpRequest(); x.open('GET', 'folder.txt', false); x.send(null); parent.assert_equals(x.responseText, 'top\\n'); parent.test.done() })" }) diff --git a/XMLHttpRequest/open-url-javascript-window.htm b/XMLHttpRequest/open-url-javascript-window.htm index db9803a46c1039..e49c337f8abfd9 100644 --- a/XMLHttpRequest/open-url-javascript-window.htm +++ b/XMLHttpRequest/open-url-javascript-window.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() - resolving URLs (javascript: <iframe>; 1) +
diff --git a/XMLHttpRequest/open-url-multi-window-2.htm b/XMLHttpRequest/open-url-multi-window-2.htm index f10a8caf728d4c..eee5ef4477fce3 100644 --- a/XMLHttpRequest/open-url-multi-window-2.htm +++ b/XMLHttpRequest/open-url-multi-window-2.htm @@ -4,26 +4,19 @@ XMLHttpRequest: open() resolving URLs (multi-Window; 2; evil) +
diff --git a/XMLHttpRequest/open-url-multi-window-3.htm b/XMLHttpRequest/open-url-multi-window-3.htm index ad3b642b401505..b3652dfa508c8d 100644 --- a/XMLHttpRequest/open-url-multi-window-3.htm +++ b/XMLHttpRequest/open-url-multi-window-3.htm @@ -8,21 +8,14 @@
diff --git a/XMLHttpRequest/open-url-multi-window-4.htm b/XMLHttpRequest/open-url-multi-window-4.htm index c1798b7a04a371..89a47527752e9e 100644 --- a/XMLHttpRequest/open-url-multi-window-4.htm +++ b/XMLHttpRequest/open-url-multi-window-4.htm @@ -8,18 +8,30 @@
+
@@ -18,7 +19,7 @@ count++ self[0].location.reload() } else if(1 == count) { - assert_throws("INVALID_STATE_ERR", function() { client.open("GET", "...") }) + assert_throws("InvalidStateError", function() { client.open("GET", "...") }) test.done() } }) diff --git a/XMLHttpRequest/open-url-multi-window.htm b/XMLHttpRequest/open-url-multi-window.htm index d1a7b7b13e51a8..994aa1c6f8f607 100644 --- a/XMLHttpRequest/open-url-multi-window.htm +++ b/XMLHttpRequest/open-url-multi-window.htm @@ -4,6 +4,7 @@ XMLHttpRequest: open() resolving URLs (multi-Window; 1) +
@@ -19,8 +20,8 @@ test.done() }) } - client.open("GET", "folder.txt"); - client.send(""); + client.open("GET", "folder.txt") + client.send("") }) } diff --git a/XMLHttpRequest/open-url-worker-origin.htm b/XMLHttpRequest/open-url-worker-origin.htm new file mode 100644 index 00000000000000..33448f8ff3c4d3 --- /dev/null +++ b/XMLHttpRequest/open-url-worker-origin.htm @@ -0,0 +1,44 @@ + + + + + XMLHttpRequest: worker scripts, origin and referrer + + + + + + +
+ + + + diff --git a/XMLHttpRequest/open-url-worker-simple.htm b/XMLHttpRequest/open-url-worker-simple.htm new file mode 100644 index 00000000000000..6bda8f10468679 --- /dev/null +++ b/XMLHttpRequest/open-url-worker-simple.htm @@ -0,0 +1,26 @@ + + + + + XMLHttpRequest: relative URLs in worker scripts resolved by script URL + + + + + + +
+ + + + diff --git a/XMLHttpRequest/open-user-password-non-same-origin.htm b/XMLHttpRequest/open-user-password-non-same-origin.htm index 7f648df360868a..7f2df8ce2a7c83 100644 --- a/XMLHttpRequest/open-user-password-non-same-origin.htm +++ b/XMLHttpRequest/open-user-password-non-same-origin.htm @@ -1,9 +1,10 @@ - XMLHttpRequest: open() - user/pass argument and non same-origin URL + XMLHttpRequest: open() - user/pass argument and non same-origin URL doesn't throw +
@@ -11,14 +12,14 @@ var m = "GET", u = "http://test2.w3.org/", a = false - function request(opencall) { test(function() { var client = new XMLHttpRequest() - assert_throws("INVALID_ACCESS_ERR", opencall(client)) + client.open(m, u, a, "x") + assert_equals(client.readyState, 1, "open() was successful - 1") + var client2 = new XMLHttpRequest() + client2.open(m, u, a, "x", "x") + assert_equals(client2.readyState, 1, "open() was successful - 2") }) - } - request(function(x) { return function() { x.open(m, u, a, "x") } }) - request(function(x) { return function() { x.open(m, u, a, "x", "x") } }) diff --git a/XMLHttpRequest/overridemimetype-done-state.htm b/XMLHttpRequest/overridemimetype-done-state.htm index ab5e6fc92da597..6467399391d7e7 100644 --- a/XMLHttpRequest/overridemimetype-done-state.htm +++ b/XMLHttpRequest/overridemimetype-done-state.htm @@ -14,7 +14,7 @@ var client = new XMLHttpRequest(); client.onreadystatechange = test.step_func( function() { if (client.readyState !== 4) return; - assert_throws("INVALID_STATE_ERR", function() { client.overrideMimeType('application/xml;charset=Shift-JIS'); }); + assert_throws("InvalidStateError", function() { client.overrideMimeType('application/xml;charset=Shift-JIS'); }); assert_equals(client.responseXML, null); test.done(); }); diff --git a/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm b/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm index 0b4e9d07f3d872..2aa1fd2d09f758 100644 --- a/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm +++ b/XMLHttpRequest/overridemimetype-headers-received-state-force-shiftjis.htm @@ -12,8 +12,10 @@ diff --git a/XMLHttpRequest/overridemimetype-loading-state.htm b/XMLHttpRequest/overridemimetype-loading-state.htm index 9fe53341c94111..a1aa586ffc4f2f 100644 --- a/XMLHttpRequest/overridemimetype-loading-state.htm +++ b/XMLHttpRequest/overridemimetype-loading-state.htm @@ -15,7 +15,7 @@ var client = new XMLHttpRequest(); client.onreadystatechange = function() { if (client.readyState === 3){ - assert_throws("INVALID_STATE_ERR", function() { client.overrideMimeType('application/xml;charset=Shift-JIS'); }); + assert_throws("InvalidStateError", function() { client.overrideMimeType('application/xml;charset=Shift-JIS'); }); }else if(client.readyState===4){ assert_equals(client.responseXML, null); test.done(); diff --git a/XMLHttpRequest/resources/auth1/auth.php b/XMLHttpRequest/resources/auth1/auth.php new file mode 100644 index 00000000000000..7b493a9ec22896 --- /dev/null +++ b/XMLHttpRequest/resources/auth1/auth.php @@ -0,0 +1,32 @@ + diff --git a/XMLHttpRequest/resources/auth1/corsenabled.php b/XMLHttpRequest/resources/auth1/corsenabled.php new file mode 100644 index 00000000000000..4c909cd5145b4e --- /dev/null +++ b/XMLHttpRequest/resources/auth1/corsenabled.php @@ -0,0 +1,39 @@ + diff --git a/XMLHttpRequest/resources/auth2/auth.php b/XMLHttpRequest/resources/auth2/auth.php new file mode 100644 index 00000000000000..67a37d7a48c5f2 --- /dev/null +++ b/XMLHttpRequest/resources/auth2/auth.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth2/corsenabled.php b/XMLHttpRequest/resources/auth2/corsenabled.php new file mode 100644 index 00000000000000..eea4683f34def4 --- /dev/null +++ b/XMLHttpRequest/resources/auth2/corsenabled.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth3/auth.php b/XMLHttpRequest/resources/auth3/auth.php new file mode 100644 index 00000000000000..67a37d7a48c5f2 --- /dev/null +++ b/XMLHttpRequest/resources/auth3/auth.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth3/corsenabled.php b/XMLHttpRequest/resources/auth3/corsenabled.php new file mode 100644 index 00000000000000..eea4683f34def4 --- /dev/null +++ b/XMLHttpRequest/resources/auth3/corsenabled.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth4/auth.php b/XMLHttpRequest/resources/auth4/auth.php new file mode 100644 index 00000000000000..67a37d7a48c5f2 --- /dev/null +++ b/XMLHttpRequest/resources/auth4/auth.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth5/auth.php b/XMLHttpRequest/resources/auth5/auth.php new file mode 100644 index 00000000000000..768a9aff6fd603 --- /dev/null +++ b/XMLHttpRequest/resources/auth5/auth.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/auth6/auth.php b/XMLHttpRequest/resources/auth6/auth.php new file mode 100644 index 00000000000000..768a9aff6fd603 --- /dev/null +++ b/XMLHttpRequest/resources/auth6/auth.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/authentication.php b/XMLHttpRequest/resources/authentication.php index 64b99b514415e4..7322361d9fe1e8 100644 --- a/XMLHttpRequest/resources/authentication.php +++ b/XMLHttpRequest/resources/authentication.php @@ -1,17 +1,17 @@ diff --git a/XMLHttpRequest/resources/chunked.php b/XMLHttpRequest/resources/chunked.php new file mode 100644 index 00000000000000..e63a59a82b59d6 --- /dev/null +++ b/XMLHttpRequest/resources/chunked.php @@ -0,0 +1,27 @@ + $value) { + echo sprintf("%x\r\n", strlen($value)); + echo $value; + echo "\r\n"; + //sleep(0.5); + } + echo "0\r\n"; + echo "X-Test-Me: Trailer header value\r\n\r\n" +?> \ No newline at end of file diff --git a/XMLHttpRequest/resources/corsenabled.php b/XMLHttpRequest/resources/corsenabled.php new file mode 100644 index 00000000000000..d14815dcfa11f0 --- /dev/null +++ b/XMLHttpRequest/resources/corsenabled.php @@ -0,0 +1,15 @@ + diff --git a/XMLHttpRequest/resources/delay.php b/XMLHttpRequest/resources/delay.php index 61dd4f7c8d2ac0..1be9337859cdad 100755 --- a/XMLHttpRequest/resources/delay.php +++ b/XMLHttpRequest/resources/delay.php @@ -1,7 +1,7 @@ diff --git a/XMLHttpRequest/resources/inspect-headers.php b/XMLHttpRequest/resources/inspect-headers.php index e324fca1c42230..3196512a3a3ac4 100644 --- a/XMLHttpRequest/resources/inspect-headers.php +++ b/XMLHttpRequest/resources/inspect-headers.php @@ -1,10 +1,21 @@ $value) { if($filter_value != "") { if($value == $filter_value) $result .= strtolower($name) . ","; + }else if (strtolower($name) == $filter_name) { + $result .= strtolower($name) . ": ".$value."\n"; } } header("content-type:text/plain"); diff --git a/XMLHttpRequest/resources/nocors/folder.txt b/XMLHttpRequest/resources/nocors/folder.txt new file mode 100644 index 00000000000000..5257b481d173dc --- /dev/null +++ b/XMLHttpRequest/resources/nocors/folder.txt @@ -0,0 +1 @@ +not CORS-enabled \ No newline at end of file diff --git a/XMLHttpRequest/resources/requri.php b/XMLHttpRequest/resources/requri.php new file mode 100644 index 00000000000000..7bc19cd3a1ab85 --- /dev/null +++ b/XMLHttpRequest/resources/requri.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/XMLHttpRequest/resources/status.php b/XMLHttpRequest/resources/status.php index 055bc888015d1b..07eeb7009e385f 100644 --- a/XMLHttpRequest/resources/status.php +++ b/XMLHttpRequest/resources/status.php @@ -10,12 +10,14 @@ function stripslashes_recursive($var) { } // This should reasonably work for most response codes. - $code = ctype_digit($_GET["code"]) ? $_GET["code"] : "200"; - $text = $_GET["text"] ? $_GET["text"] : "OMG"; + $code = isset($_GET['code']) && ctype_digit($_GET["code"]) ? $_GET["code"] : "200"; + $text = isset($_GET['text']) && $_GET["text"] ? $_GET["text"] : "OMG"; $content = $_GET["content"] ? $_GET["content"] : ""; $type = $_GET["type"] ? $_GET["type"] : ""; header("HTTP/1.1 " . $code . " " . $text); header("Content-Type:" . $type); + header("X-Request-Method: " . (isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "NO")); + echo $content; exit; ?> diff --git a/XMLHttpRequest/resources/workerxhr-origin-referrer.js b/XMLHttpRequest/resources/workerxhr-origin-referrer.js new file mode 100644 index 00000000000000..f20c20d58d5371 --- /dev/null +++ b/XMLHttpRequest/resources/workerxhr-origin-referrer.js @@ -0,0 +1,34 @@ +// This simply posts a message to the owner page with the contents of the Referer header +var xhr=new XMLHttpRequest() +xhr.onreadystatechange = function(){ + if(xhr.readyState == 4){ + var obj = {test:'Referer header', result:xhr.responseText} + self.postMessage(obj) + } +} +xhr.open('GET', 'inspect-headers.php?filter_name=referer', true) +xhr.send() + +// This simply posts a message to the owner page with the contents of the Origin header +var xhr2=new XMLHttpRequest() +xhr2.onreadystatechange = function(){ + if(xhr2.readyState == 4){ + var obj = {test:'Origin header', result:xhr2.responseText} + self.postMessage(obj) + } +} +xhr2.open('GET', location.protocol + '//www2.'+location.hostname+(location.pathname.replace(/[^/]*$/, ''))+'inspect-headers.php?filter_name=origin&cors', true) +xhr2.send() + +// If "origin" / base URL is the origin of this JS file, we can load files +// from the server it originates from.. and requri.php will be able to tell us +// what the requested URL was +var xhr3=new XMLHttpRequest() +xhr3.onreadystatechange = function(){ + if(xhr3.readyState == 4){ + var obj = {test:'Request URL test', result:xhr3.responseText} + self.postMessage(obj) + } +} +xhr3.open('GET', 'requri.php?full', true) +xhr3.send() diff --git a/XMLHttpRequest/resources/workerxhr-simple.js b/XMLHttpRequest/resources/workerxhr-simple.js new file mode 100644 index 00000000000000..f6bcec0befa6e9 --- /dev/null +++ b/XMLHttpRequest/resources/workerxhr-simple.js @@ -0,0 +1,10 @@ + +var xhr=new XMLHttpRequest() +xhr.onreadystatechange = function(){ + if(xhr.readyState == 4){ + var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED' + self.postMessage(status) + } +} +xhr.open('GET', 'folder.txt', true) +xhr.send() diff --git a/XMLHttpRequest/response-data-arraybuffer.htm b/XMLHttpRequest/response-data-arraybuffer.htm index 15f6baad614d1f..b883a5893d5bb0 100644 --- a/XMLHttpRequest/response-data-arraybuffer.htm +++ b/XMLHttpRequest/response-data-arraybuffer.htm @@ -1,8 +1,8 @@  - - + + XMLHttpRequest: The response attribute: ArrayBuffer data diff --git a/XMLHttpRequest/response-json.htm b/XMLHttpRequest/response-json.htm new file mode 100644 index 00000000000000..012278242c1972 --- /dev/null +++ b/XMLHttpRequest/response-json.htm @@ -0,0 +1,57 @@ + + + + XMLHttpRequest: responseType json + + + + + + + + + +
+ + + diff --git a/XMLHttpRequest/responsetext-decoding.htm b/XMLHttpRequest/responsetext-decoding.htm index d29308643e52dc..240e0b1f56cf22 100644 --- a/XMLHttpRequest/responsetext-decoding.htm +++ b/XMLHttpRequest/responsetext-decoding.htm @@ -4,21 +4,25 @@ XMLHttpRequest: responseText decoding + +
diff --git a/XMLHttpRequest/responsexml-basic.htm b/XMLHttpRequest/responsexml-basic.htm index a2956ad2669552..187bbd4b7b972f 100644 --- a/XMLHttpRequest/responsexml-basic.htm +++ b/XMLHttpRequest/responsexml-basic.htm @@ -4,24 +4,30 @@ XMLHttpRequest: responseXML basic test + +
diff --git a/XMLHttpRequest/responsexml-document-properties.htm b/XMLHttpRequest/responsexml-document-properties.htm new file mode 100644 index 00000000000000..58013f5756d001 --- /dev/null +++ b/XMLHttpRequest/responsexml-document-properties.htm @@ -0,0 +1,63 @@ + + + + XMLHttpRequest: responseXML document properties + + + + + + +
+ + + diff --git a/XMLHttpRequest/responsexml-media-type.htm b/XMLHttpRequest/responsexml-media-type.htm index 7083bb2955b2be..25b1c42eb4437b 100644 --- a/XMLHttpRequest/responsexml-media-type.htm +++ b/XMLHttpRequest/responsexml-media-type.htm @@ -4,6 +4,8 @@ XMLHttpRequest: responseXML MIME type tests + +
@@ -11,15 +13,16 @@ function request(type, succeed) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/status.php?content=<\/x>&type=" + type, false) + client.open("GET", "resources/status.php?content=<\/x>&type=" + encodeURIComponent(type), false) client.send(null) if(!succeed) assert_equals(client.responseXML, null) else assert_equals(client.responseXML.documentElement.localName, "x") - }, document.title + " (" + type + ")") + }, document.title + " ('" + type + "', should "+(succeed?'':'not')+" parse)") } request("", true) + request("text/html", false) request("bogus", true) request("bogus+xml", true) request("text/plain;+xml", false) diff --git a/XMLHttpRequest/responsexml-non-document-types.htm b/XMLHttpRequest/responsexml-non-document-types.htm new file mode 100644 index 00000000000000..f0c0a839473747 --- /dev/null +++ b/XMLHttpRequest/responsexml-non-document-types.htm @@ -0,0 +1,31 @@ + + + + XMLHttpRequest: responseXML/responseText on other responseType + + + + + + + +
+ + + diff --git a/XMLHttpRequest/responsexml-non-well-formed.htm b/XMLHttpRequest/responsexml-non-well-formed.htm index cb1998ae2a031d..018666dd949a30 100644 --- a/XMLHttpRequest/responsexml-non-well-formed.htm +++ b/XMLHttpRequest/responsexml-non-well-formed.htm @@ -4,6 +4,8 @@ XMLHttpRequest: responseXML non well-formed tests + +
@@ -11,14 +13,18 @@ function request(content) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/status.php&type=text/xml&content=" + content, false) + client.open("GET", "resources/status.php?type=text/xml&content=" + encodeURIComponent(content), false) client.send(null) assert_equals(client.responseXML, null) }) } request("<\/x") - request("&<\/x>") + request("&
") + request("") // misnested tags + request("") // two root elements is not allowed + request(" ") // CDATA should end with ]]> + request(" ") // CDATA should start with diff --git a/XMLHttpRequest/send-accept-language.htm b/XMLHttpRequest/send-accept-language.htm index 6926835abcae58..c9af6f641b3542 100644 --- a/XMLHttpRequest/send-accept-language.htm +++ b/XMLHttpRequest/send-accept-language.htm @@ -4,10 +4,17 @@ XMLHttpRequest: send() - Accept-Language +
+
diff --git a/XMLHttpRequest/send-after-setting-document-domain.htm b/XMLHttpRequest/send-after-setting-document-domain.htm new file mode 100644 index 00000000000000..37e33b92d42b24 --- /dev/null +++ b/XMLHttpRequest/send-after-setting-document-domain.htm @@ -0,0 +1,38 @@ + + + + XMLHttpRequest: send() with document.domain set + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm b/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm new file mode 100644 index 00000000000000..3ab6326585032b --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm @@ -0,0 +1,27 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure) + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-basic-cors.htm b/XMLHttpRequest/send-authentication-basic-cors.htm new file mode 100644 index 00000000000000..165e60357df55d --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic-cors.htm @@ -0,0 +1,35 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure) + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm b/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm new file mode 100644 index 00000000000000..a4f8fffb9773ba --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm @@ -0,0 +1,31 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm b/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm new file mode 100644 index 00000000000000..414573e84cdfc3 --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm @@ -0,0 +1,50 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader() when there is an existing session + + + + + + + +
+ +

Note: this test will only work as expected once per browsing session. Restart browser to re-test.

+ + diff --git a/XMLHttpRequest/send-authentication-basic-setrequestheader.htm b/XMLHttpRequest/send-authentication-basic-setrequestheader.htm new file mode 100644 index 00000000000000..9b707025ae08f1 --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic-setrequestheader.htm @@ -0,0 +1,35 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader() + + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-basic.htm b/XMLHttpRequest/send-authentication-basic.htm new file mode 100644 index 00000000000000..3fae1f0a528544 --- /dev/null +++ b/XMLHttpRequest/send-authentication-basic.htm @@ -0,0 +1,26 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() + + + + + + +
+ +

Note: this test will only work as expected once per browsing session. Restart browser to re-test.

+ + diff --git a/XMLHttpRequest/send-authentication-competing-names-passwords.htm b/XMLHttpRequest/send-authentication-competing-names-passwords.htm new file mode 100644 index 00000000000000..a310a92d6bad9d --- /dev/null +++ b/XMLHttpRequest/send-authentication-competing-names-passwords.htm @@ -0,0 +1,55 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm b/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm new file mode 100644 index 00000000000000..6a94febb13ea08 --- /dev/null +++ b/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm @@ -0,0 +1,36 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() (expects to succeed) + + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-authentication-existing-session-interactive.htm b/XMLHttpRequest/send-authentication-existing-session-interactive.htm new file mode 100644 index 00000000000000..d6e56ef944f782 --- /dev/null +++ b/XMLHttpRequest/send-authentication-existing-session-interactive.htm @@ -0,0 +1,30 @@ + + + + XMLHttpRequest: send() - "Basic" authenticated requests with user name and password from interactive session + + + + + +

Please follow these steps to complete the test:

+
    +
  1. Load page and authenticate with "user" and "pass"
  2. +
  3. Go back
  4. +
  5. Click complete test
  6. +
+
+ + + diff --git a/XMLHttpRequest/send-authentication-prompt-interactive-2.htm b/XMLHttpRequest/send-authentication-prompt-interactive-2.htm new file mode 100644 index 00000000000000..dc68990b2614d4 --- /dev/null +++ b/XMLHttpRequest/send-authentication-prompt-interactive-2.htm @@ -0,0 +1,25 @@ + + + + XMLHttpRequest: WWW-Authenticate challenge when user,pass are not passed to open() + + + + + +

Please follow these steps to complete the test:

+
    +
  1. If you are prompted for user name and password, type in 'usr' and 'secret'
  2. +
+
+ + + diff --git a/XMLHttpRequest/send-authentication-prompt-interactive.htm b/XMLHttpRequest/send-authentication-prompt-interactive.htm new file mode 100644 index 00000000000000..3dea7ef1b448c4 --- /dev/null +++ b/XMLHttpRequest/send-authentication-prompt-interactive.htm @@ -0,0 +1,25 @@ + + + + XMLHttpRequest: send() - "Basic" authentication gets 401 response + + + + + +

Please follow these steps to complete the test:

+
    +
  1. If you are prompted for user name and password, type in 'usr' and 'secret'
  2. +
+
+ + + diff --git a/XMLHttpRequest/send-authentication.htm b/XMLHttpRequest/send-authentication.htm deleted file mode 100644 index 034f8ec1cc84e1..00000000000000 --- a/XMLHttpRequest/send-authentication.htm +++ /dev/null @@ -1,45 +0,0 @@ - - - - XMLHttpRequest: send() - "Basic" authenticated requests - - - - -
- - - diff --git a/XMLHttpRequest/send-conditional.htm b/XMLHttpRequest/send-conditional.htm index 02ff21736ba2bc..6e57468a7b1b8a 100644 --- a/XMLHttpRequest/send-conditional.htm +++ b/XMLHttpRequest/send-conditional.htm @@ -4,6 +4,7 @@ XMLHttpRequest: send() - conditional requests +
diff --git a/XMLHttpRequest/send-content-type-charset.htm b/XMLHttpRequest/send-content-type-charset.htm index af9b99c1485e74..3b7426c67d2dca 100644 --- a/XMLHttpRequest/send-content-type-charset.htm +++ b/XMLHttpRequest/send-content-type-charset.htm @@ -4,6 +4,8 @@ XMLHttpRequest: send() - charset parameter of Content-Type + +
@@ -12,7 +14,8 @@ test(function() { var client = new XMLHttpRequest() client.open("POST", "resources/content.php", false) - client.setRequestHeader("Content-Type", input) + if(input) + client.setRequestHeader("Content-Type", input) client.send("TEST") assert_equals(client.responseText, "TEST") assert_equals(client.getResponseHeader("x-request-content-type"), output) @@ -46,6 +49,10 @@ "text/plain;charset=utf-8;charset=waddup", "text/plain;charset=UTF-8;charset=UTF-8" ) + request( + null, + "text/plain;charset=UTF-8" + ) diff --git a/XMLHttpRequest/send-content-type-string.htm b/XMLHttpRequest/send-content-type-string.htm index e4967b7b2290fb..33cc3417290e37 100644 --- a/XMLHttpRequest/send-content-type-string.htm +++ b/XMLHttpRequest/send-content-type-string.htm @@ -4,6 +4,7 @@ XMLHttpRequest: send() - Content-Type +
diff --git a/XMLHttpRequest/send-data-blob.htm b/XMLHttpRequest/send-data-blob.htm index cd016e5b5b8170..778716d4d7642d 100644 --- a/XMLHttpRequest/send-data-blob.htm +++ b/XMLHttpRequest/send-data-blob.htm @@ -1,7 +1,7 @@  - + diff --git a/XMLHttpRequest/send-data-formdata.htm b/XMLHttpRequest/send-data-formdata.htm index d5f01ad70b0167..941fb7a052bf14 100644 --- a/XMLHttpRequest/send-data-formdata.htm +++ b/XMLHttpRequest/send-data-formdata.htm @@ -2,7 +2,7 @@ - + XmlHttpRequest: The send() method: FormData data diff --git a/XMLHttpRequest/send-entity-body-document-bogus.htm b/XMLHttpRequest/send-entity-body-document-bogus.htm index c5cb4130712df8..e2833a0d280f07 100644 --- a/XMLHttpRequest/send-entity-body-document-bogus.htm +++ b/XMLHttpRequest/send-entity-body-document-bogus.htm @@ -4,6 +4,7 @@ XMLHttpRequest: send() - unserializable Document +
@@ -12,7 +13,7 @@ test(function() { var client = new XMLHttpRequest() client.open("POST", "resources/content.php", false) - assert_throws("INVALID_STATE_ERR", function() { client.send(input) }) + assert_throws("InvalidStateError", function() { client.send(input) }) }) } var doc = document.implementation.createDocument(null, null, null) diff --git a/XMLHttpRequest/send-entity-body-empty.htm b/XMLHttpRequest/send-entity-body-empty.htm index 194e33cf5e5676..40e710ddbe3df7 100644 --- a/XMLHttpRequest/send-entity-body-empty.htm +++ b/XMLHttpRequest/send-entity-body-empty.htm @@ -4,6 +4,8 @@ XMLHttpRequest: send("") - empty entity body + +
@@ -11,6 +13,7 @@ test(function() { var client = new XMLHttpRequest() client.open("POST", "resources/content.php", false) + client.upload.onloadstart = function(){assert_unreached('this event should not fire for empty strings')} client.send("") assert_equals(client.getResponseHeader("x-request-content-length"), "0") }) diff --git a/XMLHttpRequest/send-entity-body-get-head-async.htm b/XMLHttpRequest/send-entity-body-get-head-async.htm new file mode 100644 index 00000000000000..0bfe551e1c0396 --- /dev/null +++ b/XMLHttpRequest/send-entity-body-get-head-async.htm @@ -0,0 +1,39 @@ + + + + XMLHttpRequest: send() - non-empty data argument and GET/HEAD - async, no upload events should fire + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-entity-body-get-head.htm b/XMLHttpRequest/send-entity-body-get-head.htm index 660202b28a8ec8..4f9f74cc248f36 100644 --- a/XMLHttpRequest/send-entity-body-get-head.htm +++ b/XMLHttpRequest/send-entity-body-get-head.htm @@ -4,7 +4,7 @@ XMLHttpRequest: send() - non-empty data argument and GET/HEAD - + @@ -12,12 +12,20 @@ +
@@ -11,8 +12,9 @@ test(function() { var client = new XMLHttpRequest() client.open("POST", "resources/content.php", false) + client.upload.onloadstart = function(){assert_unreached('this event should not fire for null')} client.send(null) - assert_equals(client.getResponseHeader("x-request-content-length"), "NO") + assert_equals(client.getResponseHeader("x-request-content-length"), "0") assert_equals(client.getResponseHeader("x-request-content-type"), "NO") }) diff --git a/XMLHttpRequest/send-network-error-async-events.htm b/XMLHttpRequest/send-network-error-async-events.htm index b55f8212ae233e..64671b9d3ffe4b 100644 --- a/XMLHttpRequest/send-network-error-async-events.htm +++ b/XMLHttpRequest/send-network-error-async-events.htm @@ -1,8 +1,9 @@  - - + + + diff --git a/XMLHttpRequest/send-network-error-sync-events.htm b/XMLHttpRequest/send-network-error-sync-events.htm index e77532429125c9..2e42aee5c72fca 100644 --- a/XMLHttpRequest/send-network-error-sync-events.htm +++ b/XMLHttpRequest/send-network-error-sync-events.htm @@ -1,7 +1,7 @@  - + @@ -18,7 +18,7 @@ xhr.open("POST", "http://nonexistent-origin.w3c-test.org", false); - assert_throws("NETWORK_ERR", function() + assert_throws("NetworkError", function() { xhr.send("Test Message"); }); diff --git a/XMLHttpRequest/send-non-same-origin.htm b/XMLHttpRequest/send-non-same-origin.htm index 4f3d77c6f8ac49..0f3e4204823aa6 100644 --- a/XMLHttpRequest/send-non-same-origin.htm +++ b/XMLHttpRequest/send-non-same-origin.htm @@ -15,7 +15,7 @@ test(function() { var client = new XMLHttpRequest() client.open("GET", url, false) - assert_throws("NETWORK_ERR", function() { client.send() }) + assert_throws("NetworkError", function() { client.send() }) }, document.title + " (" + url + ")") } url("mailto:test@example.org") diff --git a/XMLHttpRequest/send-redirect-bogus-sync.htm b/XMLHttpRequest/send-redirect-bogus-sync.htm index a7680823cc5363..dfadca321fb965 100644 --- a/XMLHttpRequest/send-redirect-bogus-sync.htm +++ b/XMLHttpRequest/send-redirect-bogus-sync.htm @@ -4,6 +4,7 @@ XMLHttpRequest: send() - Redirects (bogus Location header; sync) +
@@ -11,14 +12,15 @@ function redirect(code, location) { test(function() { var client = new XMLHttpRequest() - client.open("GET", "resources/redirect.php?location=" + location + "&code=" + code) - assert_throws("NETWORK_ERR", function() { client.send(null) }) + client.open("GET", "resources/redirect.php?location=" + location + "&code=" + code, false) + assert_throws("NetworkError", function() { client.send(null) }) }, document.title + " (" + code + ": " + location + ")") } + redirect("301", "foobar://abcd") redirect("302", "http://z") redirect("302", "mailto:someone@example.org") redirect("303", "http://z") - redirect("303", "mailto:someone@example.org") + redirect("303", "tel:1234567890") diff --git a/XMLHttpRequest/send-redirect-bogus.htm b/XMLHttpRequest/send-redirect-bogus.htm index 08de977d01c573..23b07a33d20e63 100644 --- a/XMLHttpRequest/send-redirect-bogus.htm +++ b/XMLHttpRequest/send-redirect-bogus.htm @@ -4,8 +4,7 @@ XMLHttpRequest: send() - Redirects (bogus Location header) - - +
@@ -32,7 +31,7 @@ redirect("302", "http://example.not") redirect("302", "mailto:someone@example.org") redirect("303", "http://example.not") - redirect("303", "mailto:someone@example.org") + redirect("303", "foobar:someone@example.org") diff --git a/XMLHttpRequest/send-redirect-infinite-sync.htm b/XMLHttpRequest/send-redirect-infinite-sync.htm new file mode 100644 index 00000000000000..a24477d25fdffb --- /dev/null +++ b/XMLHttpRequest/send-redirect-infinite-sync.htm @@ -0,0 +1,24 @@ + + + + XMLHttpRequest: send() - Redirects (infinite loop; sync) + + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-redirect-infinite.htm b/XMLHttpRequest/send-redirect-infinite.htm new file mode 100644 index 00000000000000..f66196515cce74 --- /dev/null +++ b/XMLHttpRequest/send-redirect-infinite.htm @@ -0,0 +1,35 @@ + + + + XMLHttpRequest: send() - Redirects (infinite loop) + + + + + + + + + +
+ + + diff --git a/XMLHttpRequest/send-redirect-no-location.htm b/XMLHttpRequest/send-redirect-no-location.htm index a1dcfcf3619323..ffa358efb32b98 100644 --- a/XMLHttpRequest/send-redirect-no-location.htm +++ b/XMLHttpRequest/send-redirect-no-location.htm @@ -4,6 +4,11 @@ XMLHttpRequest: send() - Redirects (no Location header) + +
diff --git a/XMLHttpRequest/send-redirect-to-cors.htm b/XMLHttpRequest/send-redirect-to-cors.htm new file mode 100644 index 00000000000000..7301808d51f08e --- /dev/null +++ b/XMLHttpRequest/send-redirect-to-cors.htm @@ -0,0 +1,36 @@ + + + + XMLHttpRequest: send() - Redirect to CORS-enabled resource + + + + + +
+ + + diff --git a/XMLHttpRequest/send-redirect-to-non-cors.htm b/XMLHttpRequest/send-redirect-to-non-cors.htm new file mode 100644 index 00000000000000..7ad3aa4fcb1f8f --- /dev/null +++ b/XMLHttpRequest/send-redirect-to-non-cors.htm @@ -0,0 +1,37 @@ + + + + XMLHttpRequest: send() - Redirect to cross-origin resource, not CORS-enabled + + + + + +
+ + + diff --git a/XMLHttpRequest/send-redirect.htm b/XMLHttpRequest/send-redirect.htm index 63e04e2735d507..65b568c6156dff 100644 --- a/XMLHttpRequest/send-redirect.htm +++ b/XMLHttpRequest/send-redirect.htm @@ -4,6 +4,7 @@ XMLHttpRequest: send() - Redirects (basics) +
diff --git a/XMLHttpRequest/send-response-event-order.htm b/XMLHttpRequest/send-response-event-order.htm index 3773eaf7c2cba6..d47f914b745b71 100644 --- a/XMLHttpRequest/send-response-event-order.htm +++ b/XMLHttpRequest/send-response-event-order.htm @@ -23,7 +23,7 @@ test.step(function() { var xhr = new XMLHttpRequest(); - var expect = ["loadstart", "upload.loadstart", "upload.progress", "upload.load", "upload.loadend", 4, "progress","load", "loadend"]; + var expect = ["loadstart", "upload.loadstart", "upload.progress", "upload.load", "upload.loadend", "progress", 4, "load", "loadend"]; var actual = []; xhr.onreadystatechange = function() diff --git a/XMLHttpRequest/send-response-upload-event-loadend.htm b/XMLHttpRequest/send-response-upload-event-loadend.htm index 86f12e6005cadc..d28c265aa2b67d 100644 --- a/XMLHttpRequest/send-response-upload-event-loadend.htm +++ b/XMLHttpRequest/send-response-upload-event-loadend.htm @@ -3,7 +3,7 @@ - + diff --git a/XMLHttpRequest/send-response-upload-event-loadstart.htm b/XMLHttpRequest/send-response-upload-event-loadstart.htm index 77244127cf89ae..5750d186f7b0f4 100644 --- a/XMLHttpRequest/send-response-upload-event-loadstart.htm +++ b/XMLHttpRequest/send-response-upload-event-loadstart.htm @@ -3,7 +3,7 @@ - + XMLHttpRequest: The send() method: Fire a progress event named loadstart on the XMLHttpRequestUpload (synchronous flag is unset) diff --git a/XMLHttpRequest/send-response-upload-event-progress.htm b/XMLHttpRequest/send-response-upload-event-progress.htm index 76032319d09842..8b4e74953914e2 100644 --- a/XMLHttpRequest/send-response-upload-event-progress.htm +++ b/XMLHttpRequest/send-response-upload-event-progress.htm @@ -3,7 +3,7 @@ - + XMLHttpRequest: The send() method: Fire a progress event named progress on the XMLHttpRequestUpload (synchronous flag is unset) diff --git a/XMLHttpRequest/send-send.htm b/XMLHttpRequest/send-send.htm index eec4fa9e18512f..b6d92420aa7eb0 100644 --- a/XMLHttpRequest/send-send.htm +++ b/XMLHttpRequest/send-send.htm @@ -4,7 +4,7 @@ XMLHttpRequest: send() - send() - +
@@ -13,7 +13,7 @@ var client = new XMLHttpRequest() client.open("GET", "resources/well-formed.xml") client.send(null) - assert_throws("INVALID_STATE_ERR", function() { client.send(null) }) + assert_throws("InvalidStateError", function() { client.send(null) }) client.abort() }) diff --git a/XMLHttpRequest/send-sync-no-response-event-order.htm b/XMLHttpRequest/send-sync-no-response-event-order.htm index effbb869bf3506..6f50cab9044aac 100644 --- a/XMLHttpRequest/send-sync-no-response-event-order.htm +++ b/XMLHttpRequest/send-sync-no-response-event-order.htm @@ -6,7 +6,8 @@ - + + diff --git a/XMLHttpRequest/send-sync-response-event-order.htm b/XMLHttpRequest/send-sync-response-event-order.htm index 0f68ac39b37b93..9021f0ef918f72 100644 --- a/XMLHttpRequest/send-sync-response-event-order.htm +++ b/XMLHttpRequest/send-sync-response-event-order.htm @@ -7,7 +7,8 @@ - + + diff --git a/XMLHttpRequest/send-sync-timeout.htm b/XMLHttpRequest/send-sync-timeout.htm index 94c3f93e71d954..da66a4b0cd9311 100644 --- a/XMLHttpRequest/send-sync-timeout.htm +++ b/XMLHttpRequest/send-sync-timeout.htm @@ -4,8 +4,8 @@ XMLHttpRequest: timeout during sync send() should not run - - + +
diff --git a/XMLHttpRequest/send-timeout-events.htm b/XMLHttpRequest/send-timeout-events.htm index 616f2e8dacf5df..ad9b331296b1ba 100644 --- a/XMLHttpRequest/send-timeout-events.htm +++ b/XMLHttpRequest/send-timeout-events.htm @@ -55,7 +55,7 @@ content += "[" + i + "]"; } - xhr.open("POST", "./resources/content.php", true); + xhr.open("POST", "./resources/trickle.php", true); xhr.timeout = 1; xhr.send(content); }); diff --git a/XMLHttpRequest/setrequestheader-after-send.htm b/XMLHttpRequest/setrequestheader-after-send.htm index 4df806924f7531..84db3886b6fe65 100644 --- a/XMLHttpRequest/setrequestheader-after-send.htm +++ b/XMLHttpRequest/setrequestheader-after-send.htm @@ -4,6 +4,7 @@ XMLHttpRequest: setRequestHeader() after send() +
@@ -14,7 +15,7 @@ client.open("GET", "resources/delay.php?ms=0") client.onreadystatechange = function() { test.step(function() { - assert_throws("INVALID_STATE_ERR", function() { client.setRequestHeader("x-test", "test") }) + assert_throws("InvalidStateError", function() { client.setRequestHeader("x-test", "test") }) if(client.readyState == 4) test.done() }) diff --git a/XMLHttpRequest/setrequestheader-before-open.htm b/XMLHttpRequest/setrequestheader-before-open.htm new file mode 100644 index 00000000000000..2ea7e67affce4c --- /dev/null +++ b/XMLHttpRequest/setrequestheader-before-open.htm @@ -0,0 +1,18 @@ + + + + XMLHttpRequest: setRequestHeader() before open() + + + + + +
+ + + diff --git a/XMLHttpRequest/setrequestheader-bogus-header.htm b/XMLHttpRequest/setrequestheader-bogus-header.htm deleted file mode 100644 index 83476b31833a1a..00000000000000 --- a/XMLHttpRequest/setrequestheader-bogus-header.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - - XMLHttpRequest: setRequestHeader() header argument checks - - - - -
- - - diff --git a/XMLHttpRequest/setrequestheader-bogus-name.htm b/XMLHttpRequest/setrequestheader-bogus-name.htm index 815fd5c401952d..063fdcbec5297c 100644 --- a/XMLHttpRequest/setrequestheader-bogus-name.htm +++ b/XMLHttpRequest/setrequestheader-bogus-name.htm @@ -2,6 +2,7 @@ XMLHttpRequest: setRequestHeader() name argument checks + @@ -13,12 +14,16 @@ test(function() { var client = new XMLHttpRequest() client.open("GET", "...") - assert_throws("SYNTAX_ERR", function() { client.setRequestHeader(name, 'x-value') }) + assert_throws("SyntaxError", function() { client.setRequestHeader(name, 'x-value') }) }) } + try_name("") try_name("t\rt") try_name("t\nt") try_name("t: t") + try_name("t:t") + try_name("t diff --git a/XMLHttpRequest/setrequestheader-bogus-value.htm b/XMLHttpRequest/setrequestheader-bogus-value.htm index 277ef5b2bda347..a9dfd46d7a3ede 100644 --- a/XMLHttpRequest/setrequestheader-bogus-value.htm +++ b/XMLHttpRequest/setrequestheader-bogus-value.htm @@ -1,6 +1,7 @@ + XMLHttpRequest: setRequestHeader() value argument checks @@ -13,11 +14,17 @@ test(function() { var client = new XMLHttpRequest() client.open("GET", "...") - assert_throws("SYNTAX_ERR", function() { client.setRequestHeader("x-test", value) }) + assert_throws("SyntaxError", function() { client.setRequestHeader("x-test", value) }, ' given value ' + value+', ') }) } try_value("t\rt") try_value("t\nt") + try_value("テスト") + test(function() { + var client = new XMLHttpRequest() + client.open("GET", "...") + assert_throws({name:'TypeError'}, function() { client.setRequestHeader("x-test") }) + }) diff --git a/XMLHttpRequest/status-async.htm b/XMLHttpRequest/status-async.htm index 3936b8fea93319..66274b1ff0f941 100644 --- a/XMLHttpRequest/status-async.htm +++ b/XMLHttpRequest/status-async.htm @@ -4,16 +4,18 @@ XMLHttpRequest: status/statusText - various responses - - - - + + + +
- - - - + + + +
+ diff --git a/XMLHttpRequest/tests/submissions/Opera/resources/upload.php b/XMLHttpRequest/tests/submissions/Opera/resources/upload.php new file mode 100644 index 00000000000000..978fa0e5b3a8a0 --- /dev/null +++ b/XMLHttpRequest/tests/submissions/Opera/resources/upload.php @@ -0,0 +1,12 @@ + $v) + echo "{$k}={$v},"; +echo "\n"; +if (!empty($_FILES)) + foreach ($_FILES as $k => $v) + echo "{$k}={$v['name']}:{$v['type']}:{$v['size']},"; + +?> diff --git a/XMLHttpRequest/timeout-cors-async.htm b/XMLHttpRequest/timeout-cors-async.htm new file mode 100644 index 00000000000000..ca5a7e503245c8 --- /dev/null +++ b/XMLHttpRequest/timeout-cors-async.htm @@ -0,0 +1,37 @@ + + + + XMLHttpRequest: timeout event and cross-origin request + + + + + + + + + +
+ + + diff --git a/XMLHttpRequest/timeout-sync.htm b/XMLHttpRequest/timeout-sync.htm new file mode 100644 index 00000000000000..d9026a35a8ced4 --- /dev/null +++ b/XMLHttpRequest/timeout-sync.htm @@ -0,0 +1,25 @@ + + + + XMLHttpRequest: timeout not allowed for sync requests + + + + + + +
+ + + diff --git a/XMLHttpRequest/withcredentials-anonymous.htm b/XMLHttpRequest/withcredentials-anonymous.htm new file mode 100644 index 00000000000000..88c5f797c749b2 --- /dev/null +++ b/XMLHttpRequest/withcredentials-anonymous.htm @@ -0,0 +1,33 @@ + + + + XMLHttpRequest: setting withCredentials on anonymous and sync request should throw + + + + + + +
+ + + diff --git a/XMLHttpRequest/withcredentials-set.htm b/XMLHttpRequest/withcredentials-set.htm new file mode 100644 index 00000000000000..e025fe0fcc98f6 --- /dev/null +++ b/XMLHttpRequest/withcredentials-set.htm @@ -0,0 +1,28 @@ + + + + XMLHttpRequest: setting withCredentials and reading value back + + + + + +
+ + + diff --git a/XMLHttpRequest/withcredentials-wrong-state.htm b/XMLHttpRequest/withcredentials-wrong-state.htm new file mode 100644 index 00000000000000..5da50a3d7bfffc --- /dev/null +++ b/XMLHttpRequest/withcredentials-wrong-state.htm @@ -0,0 +1,30 @@ + + + + XMLHttpRequest: setting withCredentials when not in UNSENT, OPENED state + + + + + +
+ + + diff --git a/XMLHttpRequest/xmlhttprequest-basic.htm b/XMLHttpRequest/xmlhttprequest-basic.htm index 6626ddfe191e79..4ee8b49164be27 100644 --- a/XMLHttpRequest/xmlhttprequest-basic.htm +++ b/XMLHttpRequest/xmlhttprequest-basic.htm @@ -4,6 +4,9 @@ XMLHttpRequest: prototype and members + + +
diff --git a/XMLHttpRequest/xmlhttprequest-eventtarget.htm b/XMLHttpRequest/xmlhttprequest-eventtarget.htm index f7050b5f7db5f7..62dff6252382b4 100644 --- a/XMLHttpRequest/xmlhttprequest-eventtarget.htm +++ b/XMLHttpRequest/xmlhttprequest-eventtarget.htm @@ -4,13 +4,15 @@ XMLHttpRequest: implements EventTarget + +
+ + + + + + + + +
@@ -11,7 +20,7 @@ test(function() { var client = new XMLHttpRequest() client.open("GET", "resources/infinite-redirects.php", false) - assert_throws("NETWORK_ERR", function() { client.send(null) }, "send") + assert_throws("NetworkError", function() { client.send(null) }, "send") assert_equals(client.status, 0, "status") assert_equals(client.statusText, "", "statusText") assert_equals(client.getAllResponseHeaders(), "", "getAllResponseHeaders") diff --git a/XMLHttpRequest/xmlhttprequest-network-error.htm b/XMLHttpRequest/xmlhttprequest-network-error.htm index a8fb963a919cca..420d757d1dacab 100644 --- a/XMLHttpRequest/xmlhttprequest-network-error.htm +++ b/XMLHttpRequest/xmlhttprequest-network-error.htm @@ -4,6 +4,14 @@ XMLHttpRequest: members during network errors + + + + + + + +
diff --git a/XMLHttpRequest/xmlhttprequest-timeout-aborted.html b/XMLHttpRequest/xmlhttprequest-timeout-aborted.html index 5983f0925ea1f8..d6b7dc3eb0fe26 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-aborted.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-aborted.html @@ -3,7 +3,14 @@ XHR2 Timeout Property Tests - + + + + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-aborted.js b/XMLHttpRequest/xmlhttprequest-timeout-aborted.js index 4f7fbd0f85368c..54142fd6355f03 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-aborted.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-aborted.js @@ -1,6 +1,15 @@ if (this.document === undefined) importScripts("xmlhttprequest-timeout.js"); +/* +This sets up three requests: +The first request will only be open()ed, not aborted, timeout will be 400 but will never triggered because send() isn't called. +After a 1 second delay, the test asserts that no load/error/timeout/abort events fired +Second request will be aborted immediately after send(), test asserts that abort fired + +Third request is set up to call abort() after a 1 second delay, but it also has a 400ms timeout. Asserts that timeout fired. +(abort() is called 600ms later and should not fire an abort event per spec. This is untested!) +*/ runTestRequests([ new AbortedRequest(false), new AbortedRequest(true, -1), new AbortedRequest(true, TIME_NORMAL_LOAD) ]); diff --git a/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html b/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html index 404dfc42db8e47..3f9641312ce1c9 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.html @@ -3,7 +3,10 @@ XHR2 Timeout Property Tests - + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.js b/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.js index a9dfc824acf1d1..a6a67f1b85ff2e 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-abortedonmain.js @@ -1,2 +1,8 @@ +/* +This test sets up two requests: +one that gets abort()ed from a 0ms timeout (0ms will obviously be clamped to whatever the implementation's minimal value is), asserts abort event fires +one that will be aborted after 200ms (TIME_DELAY), (with a timeout at 400ms) asserts abort event fires. Does not assert that the timeout event does *not* fire. +*/ + runTestRequests([ new AbortedRequest(true, 0), new AbortedRequest(true, TIME_DELAY) ]); diff --git a/XMLHttpRequest/xmlhttprequest-timeout-overrides.html b/XMLHttpRequest/xmlhttprequest-timeout-overrides.html index 9bc6eac16b5e7f..1c8430b31acd33 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-overrides.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-overrides.html @@ -3,7 +3,10 @@ XHR2 Timeout Property Tests - + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-overrides.js b/XMLHttpRequest/xmlhttprequest-timeout-overrides.js index 995e0755e0bb5a..7f8e8281e99c24 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-overrides.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-overrides.js @@ -1,6 +1,11 @@ if (this.document === undefined) importScripts("xmlhttprequest-timeout.js"); - +/* +Sets up three requests to a resource that will take 0.6 seconds to load: +1) timeout first set to 1000ms, after 400ms timeout is set to 0, asserts load fires +2) timeout first set to 1000ms, after 200ms timeout is set to 400, asserts load fires (race condition..?!?) +3) timeout first set to 0, after 400ms it is set to 1000, asserts load fires +*/ runTestRequests([ new RequestTracker(true, "timeout disabled after initially set", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, 0), new RequestTracker(true, "timeout overrides load after a delay", TIME_NORMAL_LOAD, TIME_DELAY, TIME_REGULAR_TIMEOUT), new RequestTracker(true, "timeout enabled after initially disabled", 0, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD) ]); diff --git a/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html b/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html index 7690ef80e1e39a..12ecf0487ac813 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.js b/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.js index 28ce9c33ed3755..7114dfe025736b 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-overridesexpires.js @@ -1,6 +1,13 @@ if (this.document === undefined) importScripts("xmlhttprequest-timeout.js"); - +/* + Starts three requests: + 1) XHR to resource which will take a least 600ms with timeout initially set to 1000ms. After 800ms timeout is supposedly reset to 200ms, + but the resource should have finished loading already. Asserts "load" fires. + 2) XHR with initial timeout set to 1000, after 400ms sets timeout to 300ms. Asserts "timeout" fires. + (Originally new value was 200ms. Race condition-y. Setting the new timeout to 300ms would be a better test of the "measured from start of fetching" requirement.) + 3) XHR with initial timeout set to 200, after 400ms sets timeout to 500ms. Asserts "timeout" fires (the change happens when timeout already fired and the request is done). +*/ runTestRequests([ new RequestTracker(true, "timeout set to expiring value after load fires", TIME_NORMAL_LOAD, TIME_LATE_TIMEOUT, TIME_DELAY), - new RequestTracker(true, "timeout set to expired value before load fires", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_DELAY), - new RequestTracker(true, "timeout set to non-expiring value after timeout fires", TIME_DELAY, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD) ]); + new RequestTracker(true, "timeout set to expired value before load fires", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_DELAY+100), + new RequestTracker(true, "timeout set to non-expiring value after timeout fires", TIME_DELAY, TIME_REGULAR_TIMEOUT, 500) ]); diff --git a/XMLHttpRequest/xmlhttprequest-timeout-runner.js b/XMLHttpRequest/xmlhttprequest-timeout-runner.js index b478d0d3bbbd62..3d92b2ebf4cd29 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-runner.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-runner.js @@ -4,11 +4,11 @@ function testResultCallbackHandler(event) { return; } if (event.data.type == "is") { - test(function() { assert_equals(event.data.got, event.data.expected, event.data.msg); }); + test(function() { assert_equals(event.data.got, event.data.expected); }, "Timeout test: " + event.data.msg); return; } if (event.data.type == "ok") { - test(function() { assert_true(event.data.bool, event.data.msg); }); + test(function() { assert_true(event.data.bool); }, "Timeout test: " + event.data.msg); return; } } @@ -18,8 +18,3 @@ window.addEventListener("message", testResultCallbackHandler); // Setting up testharness.js setup({ explicit_done: true, timeout: 30 * 1000 }); -// Abort test execution if an individual test case fails. -add_result_callback(function (t) { - if (t.status == t.FAIL) - done(); -}); diff --git a/XMLHttpRequest/xmlhttprequest-timeout-simple.html b/XMLHttpRequest/xmlhttprequest-timeout-simple.html index 1ba48204039ca1..fd2046b936e916 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-simple.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-simple.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html b/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html index 94b65b2ac081ce..0dbc69a67ca10f 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-synconmain.html @@ -3,7 +3,8 @@ XHR2 Timeout Property Tests - + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-synconworker.js b/XMLHttpRequest/xmlhttprequest-timeout-synconworker.js index dd2857aeb74c92..5a6c3fc557908c 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-synconworker.js +++ b/XMLHttpRequest/xmlhttprequest-timeout-synconworker.js @@ -1,5 +1,10 @@ -if (this.document === undefined) +if (this.document === undefined){ importScripts("xmlhttprequest-timeout.js"); +}else{ + throw "This test expects to be run as a Worker"; +} + +/* NOT TESTED: setting timeout before calling open( ... , false) in a worker context. The test code always calls open() first. */ runTestRequests([ new RequestTracker(false, "no time out scheduled, load fires normally", 0), new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD), diff --git a/XMLHttpRequest/xmlhttprequest-timeout-twice.html b/XMLHttpRequest/xmlhttprequest-timeout-twice.html index 099754c779edd1..ba8c4231eaa634 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-twice.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-twice.html @@ -5,6 +5,11 @@ XHR2 Timeout Property Tests + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html index df01a37961bfb4..09b8560043c9e9 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-aborted.html @@ -3,7 +3,14 @@ XHR2 Timeout Property Tests in Worker - + + + + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html index 9146c28dc40a1d..0d84dfd78e382c 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-overrides.html @@ -3,7 +3,10 @@ XHR2 Timeout Property Tests in Worker - + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html index 4f3f3d81e65909..3d47351f06f7f3 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-overridesexpires.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests in Worker - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html index 62b1d3890e3f9b..7f794e31eeaa56 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-simple.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests in Worker - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html index 15d646c40427bc..8e34c5033e6fcd 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-synconworker.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests in Worker - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html b/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html index fcc1bfd5b429c7..88d5d7c7d270dc 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html +++ b/XMLHttpRequest/xmlhttprequest-timeout-worker-twice.html @@ -3,7 +3,11 @@ XHR2 Timeout Property Tests in Worker - + + + + + diff --git a/XMLHttpRequest/xmlhttprequest-timeout.js b/XMLHttpRequest/xmlhttprequest-timeout.js index 263afb36659506..4cd261703d638f 100644 --- a/XMLHttpRequest/xmlhttprequest-timeout.js +++ b/XMLHttpRequest/xmlhttprequest-timeout.js @@ -272,7 +272,7 @@ var SyncRequestSettingTimeoutAfterOpen = { catch (e) { pass = true; } - ok(pass, "Synchronous XHR must not allow a timeout to be set"); + ok(pass, "Synchronous XHR must not allow a timeout to be set - setting timeout must throw"); TestCounter.testComplete(); } }; @@ -288,7 +288,7 @@ var SyncRequestSettingTimeoutBeforeOpen = { catch (e) { pass = true; } - ok(pass, "Synchronous XHR must not allow a timeout to be set"); + ok(pass, "Synchronous XHR must not allow a timeout to be set - calling open() after timeout is set must throw"); TestCounter.testComplete(); } }; diff --git a/XMLHttpRequest/xmlhttprequest-unsent.htm b/XMLHttpRequest/xmlhttprequest-unsent.htm index c6f689176f6dac..4424c51eb65f61 100644 --- a/XMLHttpRequest/xmlhttprequest-unsent.htm +++ b/XMLHttpRequest/xmlhttprequest-unsent.htm @@ -4,15 +4,15 @@ XMLHttpRequest: members during UNSENT - - - - - - - - - + + + + + + + + + @@ -20,8 +20,8 @@