Update XMLHttpRequest tests.
authorMs2ger@igalia.com <Ms2ger@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 16:00:18 +0000 (16:00 +0000)
committerMs2ger@igalia.com <Ms2ger@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 16:00:18 +0000 (16:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179421

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* resources/import-expectations.json: enabled some more tests
* web-platform-tests/XMLHttpRequest/abort-during-done.htm:
* web-platform-tests/XMLHttpRequest/abort-during-headers-received.htm:
* web-platform-tests/XMLHttpRequest/abort-during-loading.htm:
* web-platform-tests/XMLHttpRequest/open-after-abort.htm:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-2-expected.txt:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-2.htm:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-3-expected.txt:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-3.htm:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-4.htm:
* web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm:
* web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin-expected.txt:
* web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm:
* web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm: Added.
* web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm:
* web-platform-tests/XMLHttpRequest/resources/workerxhr-origin-referrer.js:
* web-platform-tests/XMLHttpRequest/resources/workerxhr-simple.js:
* web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-simple.js:
* web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconmain.js:
* web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconworker.js:
* web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-twice.js:
* web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout.js:
* web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm:
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm: Added.
* web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm: Added.
* web-platform-tests/XMLHttpRequest/send-entity-body-document-expected.txt:
* web-platform-tests/XMLHttpRequest/send-entity-body-document.htm:
* web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm:
* web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm:
* web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm: Added.
* web-platform-tests/XMLHttpRequest/send-redirect-infinite.htm:
* web-platform-tests/XMLHttpRequest/send-redirect-no-location.htm:
* web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm:
* web-platform-tests/XMLHttpRequest/setrequestheader-after-send.htm:
* web-platform-tests/XMLHttpRequest/setrequestheader-before-open.htm:
* web-platform-tests/XMLHttpRequest/w3c-import.log:
* web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-reused.html:
* web-platform-tests/XMLHttpRequest/xmlhttprequest-unsent.htm:

LayoutTests:

* TestExpectations: removed flaky expectation: the test was fixed upstream.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

51 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-done.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-headers-received.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/abort-during-loading.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-after-abort.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-2-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-2.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-3-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-3.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-4.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/workerxhr-origin-referrer.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/workerxhr-simple.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-simple.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconmain.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconworker.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-twice.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout.js
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-infinite.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-no-location.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-after-send.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-before-open.htm
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-reused.html
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-unsent.htm

index 7a4ac4d..989df7a 100644 (file)
@@ -1,3 +1,12 @@
+2017-11-08  Ms2ger  <Ms2ger@igalia.com>
+
+        Update XMLHttpRequest tests.
+        https://bugs.webkit.org/show_bug.cgi?id=179421
+
+        Reviewed by Sam Weinig.
+
+        * TestExpectations: removed flaky expectation: the test was fixed upstream.
+
 2017-11-07  Ryan Haddad  <ryanhaddad@apple.com>
 
         Update TestExpectations for slow  WPT encoding LayoutTests.
index 987be0c..adb2efb 100644 (file)
@@ -1381,7 +1381,6 @@ webkit.org/b/168175 imported/w3c/web-platform-tests/html/browsers/browsing-the-w
 webkit.org/b/168175 imported/w3c/web-platform-tests/html/browsers/offline/browser-state/navigator_online_online.html [ Pass Failure ]
 webkit.org/b/169264 imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html [ Failure ]
 
-imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm [ Failure Pass  ]
 imported/w3c/web-platform-tests/cssom/MediaList.html [ Failure ]
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/document-adopt-base-url.html [ ImageOnlyFailure ]
 
index f79bc4e..d0b49f5 100644 (file)
@@ -1,3 +1,59 @@
+2017-11-08  Ms2ger  <Ms2ger@igalia.com>
+
+        Update XMLHttpRequest tests.
+        https://bugs.webkit.org/show_bug.cgi?id=179421
+
+        Reviewed by Sam Weinig.
+
+        * resources/import-expectations.json: enabled some more tests
+        * web-platform-tests/XMLHttpRequest/abort-during-done.htm:
+        * web-platform-tests/XMLHttpRequest/abort-during-headers-received.htm:
+        * web-platform-tests/XMLHttpRequest/abort-during-loading.htm:
+        * web-platform-tests/XMLHttpRequest/open-after-abort.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-2-expected.txt:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-2.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-3-expected.txt:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-3.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-4.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin-expected.txt:
+        * web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm:
+        * web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm: Added.
+        * web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm:
+        * web-platform-tests/XMLHttpRequest/resources/workerxhr-origin-referrer.js:
+        * web-platform-tests/XMLHttpRequest/resources/workerxhr-simple.js:
+        * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-simple.js:
+        * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconmain.js:
+        * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconworker.js:
+        * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-twice.js:
+        * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout.js:
+        * web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm:
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-basic.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-entity-body-document-expected.txt:
+        * web-platform-tests/XMLHttpRequest/send-entity-body-document.htm:
+        * web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm:
+        * web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm:
+        * web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt: Added.
+        * web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm: Added.
+        * web-platform-tests/XMLHttpRequest/send-redirect-infinite.htm:
+        * web-platform-tests/XMLHttpRequest/send-redirect-no-location.htm:
+        * web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm:
+        * web-platform-tests/XMLHttpRequest/setrequestheader-after-send.htm:
+        * web-platform-tests/XMLHttpRequest/setrequestheader-before-open.htm:
+        * web-platform-tests/XMLHttpRequest/w3c-import.log:
+        * web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-reused.html:
+        * web-platform-tests/XMLHttpRequest/xmlhttprequest-unsent.htm:
+
 2017-11-07  Brady Eidson  <beidson@apple.com>
 
         Implement "UpdateWorkerState" and use it
index 1395692..df922ff 100644 (file)
     "web-platform-tests/XMLHttpRequest": "import", 
     "web-platform-tests/XMLHttpRequest/abort-after-stop.htm": "skip", 
     "web-platform-tests/XMLHttpRequest/event-error-order.sub.html": "skip", 
-    "web-platform-tests/XMLHttpRequest/event-error.html": "skip", 
     "web-platform-tests/XMLHttpRequest/event-timeout-order.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/event-upload-progress-crossorigin.sub.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm": "skip", 
     "web-platform-tests/XMLHttpRequest/preserve-ua-header-on-redirect.htm": "skip", 
     "web-platform-tests/XMLHttpRequest/send-after-setting-document-domain.htm": "skip", 
     "web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm": "skip", 
     "web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-authentication-basic.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm": "skip", 
-    "web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm": "skip", 
     "web-platform-tests/accelerometer": "skip", 
     "web-platform-tests/ambient-light": "skip", 
     "web-platform-tests/animation-timing": "skip", 
index c025c41..8930172 100644 (file)
@@ -76,7 +76,7 @@
             assert_equals(client.statusText, "")
             assert_equals(client.responseXML, null)
             assert_equals(client.getAllResponseHeaders(), "")
-            setTimeout(function() {
+            test.step_timeout(function() {
               assert_array_equals(result, expected)
               test.done();
             }, 100); // wait a bit in case XHR timeout causes spurious event
index 0dbad0b..a837347 100644 (file)
@@ -40,7 +40,7 @@
           assert_equals(client.statusText, "")
           assert_equals(client.responseXML, null)
           assert_equals(client.getAllResponseHeaders(), "")
-          setTimeout(function() {
+          test.step_timeout(function() {
             assert_array_equals(result, expected)
             test.done();
           }, 100); // wait a bit in case XHR timeout causes spurious event
index 0470813..501de90 100644 (file)
@@ -40,7 +40,7 @@
           assert_equals(client.statusText, "")
           assert_equals(client.responseXML, null)
           assert_equals(client.getAllResponseHeaders(), "")
-          setTimeout(function() {
+          test.step_timeout(function() {
             assert_array_equals(result, expected)
             test.done();
           }, 100); // wait a bit in case XHR timeout causes spurious event
@@ -51,4 +51,3 @@
     </script>
   </body>
 </html>
-
index ca8a4e1..c9c6304 100644 (file)
@@ -13,7 +13,7 @@
       test.step(function() {
         var client = new XMLHttpRequest(),
             result = [],
-            expected = [1,  4, 1] // open() -> 1, 
+            expected = [1,  4, 1] // open() -> 1,
                                     // abort() -> 4, open() -> 1
         client.onreadystatechange = function() {
           test.step(function() {
index c243cf0..e525698 100644 (file)
@@ -1,5 +1,5 @@
 
-FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 2; evil) assert_throws: open() when associated document's IFRAME is removed function "function () { 
-            client.open("GET", "folder.txt") 
+FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 2; evil) assert_throws: open() when associated document's IFRAME is removed function "function () {
+            client.open("GET", "folder.txt")
           }" did not throw
 
index 398764e..ed4ba01 100644 (file)
@@ -13,8 +13,8 @@
         test(function() {
           var client = new self[0].XMLHttpRequest()
           document.body.removeChild(document.getElementsByTagName("iframe")[0])
-          assert_throws("InvalidStateError", function() { 
-            client.open("GET", "folder.txt") 
+          assert_throws("InvalidStateError", function() {
+            client.open("GET", "folder.txt")
           }, "open() when associated document's IFRAME is removed")
           })
       }
index 9096fdd..281a295 100644 (file)
@@ -1,5 +1,5 @@
 
-FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 3; evil) assert_throws: send() when associated document's IFRAME is removed function "function () { 
+FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 3; evil) assert_throws: send() when associated document's IFRAME is removed function "function () {
             client.send(null)
           }" did not throw
 
index b3652df..344434b 100644 (file)
@@ -13,7 +13,7 @@
           var client = new self[0].XMLHttpRequest()
           client.open("GET", "folder.txt")
           document.body.removeChild(document.getElementsByTagName("iframe")[0])
-          assert_throws("InvalidStateError", function() { 
+          assert_throws("InvalidStateError", function() {
             client.send(null)
           }, "send() when associated document's IFRAME is removed")
         })
index 9ddbb9b..3804c9b 100644 (file)
@@ -11,7 +11,7 @@
     /*
     It's unclear what the pass condition should be for this test.
     Implementations:
-    Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed. 
+    Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed.
     Chrome: completes request to readyState=4 but responseText is "" so it's pretty much terminated with an extra event for "DONE" state
     Pass condition is now according to my suggested spec text in https://github.com/whatwg/xhr/pull/3 , if that's not accepted we'll have to amend this test
     */
@@ -20,7 +20,7 @@
         test.step(function() {
           var hasErrorEvent = false
           var client = new self[0].XMLHttpRequest()
-          client.onreadystatechange = function() { 
+          client.onreadystatechange = function() {
             test.step(function() {
               if(client.readyState == 4) {
                 assert_equals(client.responseText, "", "responseText is empty on inactive document error condition")
index e4f0aee..9927963 100644 (file)
@@ -22,7 +22,7 @@
             ifr.onload = function() {
               // Again, do things async so we're not doing loads from inside
               // load events.
-              setTimeout(function() {
+              test.step_timeout(function() {
                 client = new ifr.contentWindow.XMLHttpRequest();
                 count++;
                 // Important to do a normal navigation, not a reload.
index 4ecc3cc..c9488cd 100644 (file)
@@ -1,7 +1,6 @@
 Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/inspect-headers.py?filter_name=origin&cors
 
-PASS XMLHttpRequest: redirected worker scripts, origin and referrer 
-FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
 FAIL Referer header assert_equals: expected "Referer: http://localhost:8800/XMLHttpRequest/resources/workerxhr-origin-referrer.js\n" but got "Referer: http://localhost:8800/XMLHttpRequest/resources/redirect.py?location=workerxhr-origin-referrer.js\n"
+FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
 PASS Request URL test 
 
index 5e2065a..e5e5a4e 100644 (file)
@@ -1,43 +1,11 @@
- <!DOCTYPE html>
-<html>
-<head>
-    <meta charset="utf-8" />
-    <title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
-    <script src="/resources/testharness.js"></script>
-    <script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-    <div id="log"></div>
-    <script type="text/javascript">
-        var test = async_test() // This "test" does not actually do any assertations. It's just there to have multiple, separate, asyncronous sub-tests.
-        var expectations = {
-            'Referer header': 'Referer: '+(location.href.replace(/[^/]*$/, ''))+"resources/workerxhr-origin-referrer.js\n",
-            'Origin header': 'Origin: '+location.protocol+'//'+location.hostname+((location.port === "")?"":":"+location.port)+'\n',
-            'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.py?full'
-        }
-        // now start the worker
-        var finalWorkerURL = "workerxhr-origin-referrer.js";
-        var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
-        var worker = new Worker(url)
-        worker.onmessage = function (e) {
-            var subtest = async_test(e.data.test)
-            subtest.step(function(){
-                var thisExpectation = expectations[e.data.test]
-                delete expectations[e.data.test]
-                assert_equals(e.data.result, thisExpectation)
-                subtest.done()
-            })
-            var allDone = true
-            for(var prop in expectations){
-                  allDone = false
-            }
-            if(allDone){
-                test.step(function(){
-                    test.done()
-                })
-            }
-        }
-
-    </script>
-</body>
-</html>
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var finalWorkerURL = "workerxhr-origin-referrer.js";
+var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
+fetch_tests_from_worker(new Worker(url));
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt
new file mode 100644 (file)
index 0000000..3723c68
--- /dev/null
@@ -0,0 +1,6 @@
+Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/inspect-headers.py?filter_name=origin&cors
+
+PASS Referer header 
+FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
+PASS Request URL test 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm
new file mode 100644 (file)
index 0000000..21cf1fc
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>XMLHttpRequest: worker scripts, origin and referrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+fetch_tests_from_worker(new Worker("resources/workerxhr-origin-referrer.js"));
+</script>
index fd0664a..00a4c0d 100644 (file)
         var client = new XMLHttpRequest();
         client.onreadystatechange = function() {
           if (client.readyState !== 4) return;
-                                       try{
+          try{
             var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;
-                                       }catch(e){
-                                               assert_unreached('Exception when reading responseXML');
-                                       }
+          }catch(e){
+            assert_unreached('Exception when reading responseXML');
+          }
           assert_equals( client.responseXML.documentElement.tagName,  'test' );
           assert_equals( client.responseXML.documentElement.firstChild.tagName,  'message' );
           assert_equals( client.responseXML.documentElement.firstChild.textContent,  'Hello World!' );
index 5e2ef2a..e378de2 100644 (file)
@@ -1,34 +1,63 @@
-// 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)
+importScripts("/resources/testharness.js")
+
+async_test(function() {
+    var expected = 'Referer: ' +
+                   location.href.replace(/[^/]*$/, '') +
+                   "workerxhr-origin-referrer.js\n"
+
+    var xhr = new XMLHttpRequest()
+    xhr.onreadystatechange = this.step_func(function() {
+        if (xhr.readyState == 4) {
+            assert_equals(xhr.responseText, expected)
+            this.done()
         }
-}
-xhr.open('GET', 'inspect-headers.py?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)
+    })
+    xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
+    xhr.send()
+}, 'Referer header')
+
+async_test(function() {
+    var expected = 'Origin: ' +
+                   location.protocol +
+                   '//' +
+                   location.hostname +
+                   (location.port === "" ? "" : ":" + location.port) +
+                   '\n'
+
+    var xhr = new XMLHttpRequest()
+    xhr.onreadystatechange = this.step_func(function() {
+        if (xhr.readyState == 4) {
+            assert_equals(xhr.responseText, expected)
+            this.done()
         }
-}
-xhr2.open('GET', location.protocol + '//www2.'+location.hostname+((location.port === "")?"":":"+location.port)+(location.pathname.replace(/[^/]*$/, ''))+'inspect-headers.py?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.py 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)
+    })
+    var url = location.protocol +
+              '//www2.' +
+              location.hostname +
+              (location.port === "" ? "" : ":" + location.port) +
+              location.pathname.replace(/[^/]*$/, '') +
+              'inspect-headers.py?filter_name=origin&cors'
+    xhr.open('GET', url, true)
+    xhr.send()
+}, 'Origin header')
+
+async_test(function() {
+    // If "origin" / base URL is the origin of this JS file, we can load files
+    // from the server it originates from.. and requri.py will be able to tell us
+    // what the requested URL was
+
+    var expected = location.href.replace(/[^/]*$/, '') +
+                   'requri.py?full'
+
+    var xhr = new XMLHttpRequest()
+    xhr.onreadystatechange = this.step_func(function() {
+        if (xhr.readyState == 4) {
+            assert_equals(xhr.responseText, expected)
+            this.done()
         }
-}
-xhr3.open('GET', 'requri.py?full', true)
-xhr3.send()
+    })
+    xhr.open('GET', 'requri.py?full', true)
+    xhr.send()
+}, 'Request URL test')
+
+done()
index f6bcec0..9bae5a5 100644 (file)
@@ -1,10 +1,9 @@
-
 var xhr=new XMLHttpRequest()
 xhr.onreadystatechange = function(){
-       if(xhr.readyState == 4){
-               var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
-               self.postMessage(status)
-       }
+  if(xhr.readyState == 4){
+    var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
+    self.postMessage(status)
+  }
 }
 xhr.open('GET', 'folder.txt', true)
 xhr.send()
index 0207cf1..989a8d4 100644 (file)
@@ -2,5 +2,5 @@ if (this.document === undefined)
   importScripts("xmlhttprequest-timeout.js");
 
 runTestRequests([ new RequestTracker(true, "no time out scheduled, load fires normally", 0),
-                 new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
-                 new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
+                  new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
+                  new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
index 5a6c3fc..0924466 100644 (file)
@@ -1,11 +1,11 @@
 if (this.document === undefined){
   importScripts("xmlhttprequest-timeout.js");
 }else{
-       throw "This test expects to be run as a Worker";
+  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),
-                 new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
+                  new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
+                  new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
index 0061c73..92b7157 100644 (file)
@@ -2,5 +2,5 @@ if (this.document === undefined)
   importScripts("xmlhttprequest-timeout.js");
 
 runTestRequests([ new RequestTracker(true, "load fires normally with no timeout set, twice", 0, TIME_REGULAR_TIMEOUT, 0),
-                 new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD),
-                 new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);
+                  new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD),
+                  new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);
index 01e63cd..ac35f48 100644 (file)
@@ -245,7 +245,7 @@ AbortedRequest.prototype = {
   /**
    * Check the event received, and if it's the right (and only) one we get.
    *
-   * WebKit fires abort events even for DONE and UNSENT states, which is 
+   * WebKit fires abort events even for DONE and UNSENT states, which is
    * discussed in http://webkit.org/b/98404
    * That's why we chose to accept secondary "abort" events in this test.
    *
index 321a2ac..7fb4b2d 100644 (file)
@@ -21,7 +21,7 @@
       }
 
       const encoded_content = "%e6%a9%9f";
-      const encoded_xml = 
+      const encoded_xml =
         encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>");
       const encoded_html =
         encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt
new file mode 100644 (file)
index 0000000..8c0bfa2
--- /dev/null
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://www1.localhost:8800/XMLHttpRequest/resources/auth1/corsenabled.py due to access control checks.
+
+PASS XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure) 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm
new file mode 100644 (file)
index 0000000..fcacdd5
--- /dev/null
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      var test = async_test()
+      test.step(function() {
+        var client = new XMLHttpRequest(),
+          urlstart = 'www1.'+location.host + location.pathname.replace(/\/[^\/]*$/, '/')
+        client.withCredentials = true
+        client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/corsenabled.py", true, 'user', 'pass')
+        client.setRequestHeader("x-user", 'user')
+        client.setRequestHeader("x-pass", 'pass')
+        client.onreadystatechange = function(){
+          if (client.readyState === 4) {
+            test.step(function(){
+              assert_equals(client.responseText, '')
+              assert_equals(client.status, 0)
+              assert_equals(client.getResponseHeader('x-challenge'), null)
+              test.done()
+            })
+          }
+        }
+        client.send(null)
+      }, document.title)
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt
new file mode 100644 (file)
index 0000000..d84cd53
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm
new file mode 100644 (file)
index 0000000..464d69c
--- /dev/null
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/common/utils.js"></script>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      test(function() {
+        var client = new XMLHttpRequest(),
+          urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+          user = token()
+        client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
+        client.setRequestHeader("x-user", user)
+        client.send(null)
+        // Repeat request but *without* credentials in the open() call.
+        // Is the UA supposed to cache credentials from above request and use them? Yes.
+        client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false)
+        client.setRequestHeader("x-user", user)
+        client.send(null)
+
+        assert_equals(client.responseText, user + "\n" + 'pass')
+        //assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
+
+      }, document.title)
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm
new file mode 100644 (file)
index 0000000..84d0dd6
--- /dev/null
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader()</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/common/utils.js"></script>
+    <!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. -->
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      var test = async_test()
+      test.step(function() {
+        var client = new XMLHttpRequest(),
+          urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+          user = token()
+        client.open("GET", location.protocol+'//'+urlstart + "resources/auth2/auth.py", false)
+        client.setRequestHeader("x-user", user)
+        client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass"))
+        client.onreadystatechange = function () {
+          if (client.readyState < 4) {return}
+          test.step( function () {
+            assert_equals(client.responseText, user + '\npass')
+            assert_equals(client.status, 200)
+            assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
+            test.done()
+          } )
+        }
+        client.send(null)
+      })
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic.htm
new file mode 100644 (file)
index 0000000..ae3ee57
--- /dev/null
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open()</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/common/utils.js"></script>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      test(function() {
+        var client = new XMLHttpRequest(),
+          urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+          user = token();
+        client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
+        client.setRequestHeader("x-user", user)
+        client.send(null)
+        assert_equals(client.responseText, user + "\n" + 'pass')
+        assert_equals(client.getResponseHeader('x-challenge'), 'DID')
+      }, document.title)
+    </script>
+    <p>Note: this test will only work as expected once per browsing session. Restart browser to re-test.</p>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt
new file mode 100644 (file)
index 0000000..dbd8ed8
--- /dev/null
@@ -0,0 +1,8 @@
+
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass in open() call 
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options another user/pass in open() call - must override cached credentials from previous test 
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass both in URL userinfo AND open() call - expexted that open() wins 
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass *only* in URL userinfo 
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user name in URL userinfo, password in open() call: user name wins and password is thrown away 
+FAIL XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user name and password in URL userinfo, only user name in open() call: user name in open() wins assert_true: responseText should contain the right user and password expected true got false
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm
new file mode 100644 (file)
index 0000000..d58d9e0
--- /dev/null
@@ -0,0 +1,54 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/common/utils.js"></script>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      function request(user1, pass1, user2, pass2, name) {
+        // user1, pass1 will if given become userinfo part of URL
+        // user2, pass2 will if given be passed to open() call
+        test(function() {
+          var client = new XMLHttpRequest(),
+              urlstart = "", userwin, passwin
+          // if user2 is set, winning user name and password is 2
+          if(user2)
+            userwin = user2, passwin = pass2
+          // if user1 is set, and user2 is not set, user1 and pass1 win
+          if(user1 && ! user2)
+            userwin = user1, passwin = pass1
+          // if neither user name is set, pass 2 wins (there will be no userinfo in URL)
+          if (!(user1 || user2))
+            passwin = pass2
+          if(user1) { // should add userinfo to URL (there is no way to create userinfo part of URL with only password in)
+            urlstart = "http://" + user1
+            if(pass1)
+              urlstart += ":" + pass1
+            urlstart += "@" + location.host + location.pathname.replace(/\/[^\/]*$/, '/')
+          }
+          client.open("GET", urlstart + "resources/authentication.py", false, user2, pass2)
+          client.setRequestHeader("x-user", userwin)
+          client.send(null)
+          assert_true(client.responseText == ((userwin||'') + "\n" + (passwin||'')), 'responseText should contain the right user and password')
+
+          // We want to send multiple requests to the same realm here, so we try to make the UA forget its (cached) credentials between each test..
+          // forcing a 401 response to (hopefully) "log out"
+          // NOTE: This is commented out because it causes authentication prompts while running the test
+          //client.open('GET', "resources/authentication.py?logout=1", false)
+          //client.send()
+        }, document.title+' '+name)
+      }
+      request(null, null, token(), token(), 'user/pass in open() call')
+      request(null, null, token(), token(), 'another user/pass in open() call - must override cached credentials from previous test')
+      request("userinfo-user", "userinfo-pass", token(), token(), 'user/pass both in URL userinfo AND open() call - expexted that open() wins')
+      request(token(), token(), null, null, 'user/pass *only* in URL userinfo')
+      request(token(), null, null, token(), 'user name in URL userinfo, password in open() call: user name wins and password is thrown away')
+      request("1", token(), token(), null, 'user name and password in URL userinfo, only user name in open() call: user name in open() wins')
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt
new file mode 100644 (file)
index 0000000..d48bce0
--- /dev/null
@@ -0,0 +1,8 @@
+
+PASS XMLHttpRequest: send() - data argument (1) 
+PASS XMLHttpRequest: send() - data argument (10000000) 
+PASS XMLHttpRequest: send() - data argument (2,2) 
+PASS XMLHttpRequest: send() - data argument (false) 
+PASS XMLHttpRequest: send() - data argument (A\0A) 
+PASS XMLHttpRequest: send() - data argument (1=2&3=4) 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm
new file mode 100644 (file)
index 0000000..526a1fb
--- /dev/null
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+  <head>
+    <title>XMLHttpRequest: send() - data argument</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="/following::ol/li[4]" />
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      function request(input, output) {
+        test(function() {
+          var client = new XMLHttpRequest()
+          client.open("POST", "resources/content.py", false)
+          client.send(input)
+          assert_equals(client.responseText, output)
+        }, document.title + " (" + output + ")")
+      }
+      request(1, "1")
+      request(10000000, "10000000")
+      request([2,2], "2,2")
+      request(false, "false")
+      request("A\0A", "A\0A")
+      request(new URLSearchParams([[1, 2], [3, 4]]), "1=2&3=4")
+    </script>
+  </body>
+</html>
index 434c778..f2762e0 100644 (file)
@@ -1,9 +1,9 @@
 
 PASS XML document, windows-1252 
-PASS image file 
-PASS img tag 
 PASS HTML document, invalid UTF-8 
 PASS HTML document, shift-jis 
-PASS empty div 
 PASS plain text file 
-         
+PASS image file 
+PASS img tag 
+PASS empty div 
+
index 5f1cb68..e3a1070 100644 (file)
   <body>
     <div id="log"></div>
     <script>
-     var expectations = [
-      { contentType: 'application/xml;charset=UTF-8', responseText : '<\u00FF\/>' },
-      { contentType: 'text/html;charset=UTF-8', responseText : '<body>\uFFFD<\/body>' }, /*invalid character code in document turns into FFFD*/
-      { contentType: 'text/html;charset=UTF-8', responseText : '<body>\u30C6\u30b9\u30c8<\/body>' } /* correctly serialized Shift-JIS */,
-      { contentType: 'text/html;charset=UTF-8', responseText: 'top' }, /* There's some markup included, but it's not really relevant for this test suite, so we do an indexOf() test */
-      { contentType: 'text/html;charset=UTF-8' },
-      { contentType: 'text/html;charset=UTF-8', responseText: '<img>foo' },
-      { contentType: 'text/html;charset=UTF-8', responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>' }
-     ]
-
+    var tests = [
+      {
+        title: 'XML document, windows-1252',
+        url: 'resources/win-1252-xml.py',
+        contentType: 'application/xml;charset=UTF-8',
+        responseText: '<\u00FF\/>'
+      },
+      // Invalid character code in document turns into U+FFFD.
+      {
+        title: 'HTML document, invalid UTF-8',
+        url: 'resources/invalid-utf8-html.py',
+        contentType: 'text/html;charset=UTF-8',
+        responseText: '<body>\uFFFD<\/body>'
+      },
+      // Correctly serialized Shift-JIS.
+      {
+        title: 'HTML document, shift-jis',
+        url: 'resources/shift-jis-html.py',
+        contentType: 'text/html;charset=UTF-8',
+        responseText: '<body>\u30C6\u30b9\u30c8<\/body>'
+      },
+      // There's some markup included, but it's not really relevant for this
+      // test suite, so we do an indexOf() test.
+      {
+        title: 'plain text file',
+        url: 'folder.txt',
+        contentType: 'text/html;charset=UTF-8',
+        responseText: 'top'
+      },
+      // This test does not want to assert anything about what markup a
+      // standalone image should be wrapped in. Hence this test lacks a
+      // responseText expectation.
+      {
+        title: 'image file',
+        url: 'resources/image.gif',
+        contentType: 'text/html;charset=UTF-8'
+      },
+      {
+        title: 'img tag',
+        url: 'resources/img-utf8-html.py',
+        contentType: 'text/html;charset=UTF-8',
+        responseText: '<img>foo'
+      },
+      {
+        title: 'empty div',
+        url: 'resources/empty-div-utf8-html.py',
+        contentType: 'text/html;charset=UTF-8',
+        responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>'
+      }
+    ];
 
-      function request(input, number, title) {
-        test(function() {
+    tests.forEach(function(t) {
+      async_test(function() {
+        var iframe = document.createElement("iframe");
+        iframe.onload = this.step_func_done(function() {
           var client = new XMLHttpRequest()
           client.open("POST", "resources/content.py?response_charset_label=UTF-8", false)
-          client.send(input)
-          var exp = expectations[number]
-          assert_equals(client.getResponseHeader('X-Request-Content-Type'), exp.contentType, 'document should be serialized and sent as '+exp.contentType+' (TEST#'+number+')')
-          // The indexOf() assertation will overlook some stuff, i.e. XML prologues that shouldn't be there (looking at you, Presto).
-          // However, arguably these things have little to do with the XHR functionality we're testing.
-          if(exp.responseText){ // This test does not want to assert anything about what markup a standalone IMG should be wrapped in. Hence the GIF test lacks a responseText expectation.
-            assert_true(client.responseText.indexOf(exp.responseText) != -1,
-                        JSON.stringify(exp.responseText) + " not in " +
+          client.send(iframe.contentDocument)
+          assert_equals(client.getResponseHeader('X-Request-Content-Type'),
+                        t.contentType,
+                        'document should be serialized and sent as ' + t.contentType)
+          // The indexOf() assertion will overlook some stuff, e.g. XML
+          // prologues that shouldn't be there (looking at you, Presto).
+          // However, arguably these things have little to do with the XHR
+          // functionality we're testing.
+          if (t.responseText) {
+            assert_true(client.responseText.indexOf(t.responseText) != -1,
+                        JSON.stringify(t.responseText) + " not in " +
                         JSON.stringify(client.responseText));
           }
           assert_equals(client.responseXML, null)
-        }, title)
-      }
-      function init(fr, number, title) { request(fr.contentDocument, number, title) }
+        });
+        iframe.src = t.url;
+        document.body.appendChild(iframe);
+      }, t.title);
+    });
     </script>
-    <!--
-        This test also tests how documents in various encodings are serialized.
-        The below IFRAMEs contain:
-          * one XML document parsed from a windows-1252 source - content is <ÿ/>
-          * one HTML-document parsed from an invalid UTF-8 source, will contain a basic HTML DOM
-             with a U+FFFD replacement character for the invalid char
-          * one HTML document parsed from a valid Shift-JIS source
-     -->
-    <iframe src='resources/win-1252-xml.py' onload="init(this, 0, 'XML document, windows-1252')"></iframe>
-    <iframe src='resources/invalid-utf8-html.py' onload="init(this, 1, 'HTML document, invalid UTF-8')"></iframe>
-    <iframe src='resources/shift-jis-html.py' onload="init(this, 2, 'HTML document, shift-jis')"></iframe>
-    <iframe src='folder.txt' onload="init(this, 3, 'plain text file')"></iframe>
-    <iframe src='resources/image.gif' onload="init(this, 4, 'image file')"></iframe>
-    <iframe src='resources/img-utf8-html.py' onload="init(this, 5, 'img tag')"></iframe>
-    <iframe src='resources/empty-div-utf8-html.py' onload="init(this, 6, 'empty div')"></iframe>
-
   </body>
 </html>
index ff4c4b4..4a7deec 100644 (file)
@@ -4,7 +4,7 @@
     <title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD - async, no upload events should fire</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
-        <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" />  
+        <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" />
 
   </head>
   <body>
index f3b8cef..95ff711 100644 (file)
@@ -4,7 +4,7 @@
     <title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
-        <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />  
+        <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />
 
   </head>
   <body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt
new file mode 100644 (file)
index 0000000..bd71159
--- /dev/null
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://nonexistent-origin.localhost:8800/ due to access control checks.
+
+PASS XMLHttpRequest: The send() method: Fire a progress event named error when Network error happens (synchronous flag is unset) 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm
new file mode 100644 (file)
index 0000000..c803efa
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onerror" data-tested-assertations="../.." />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[9]/ol/li[2] following::ol[1]/li[9]/ol/li[3]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[4] following::dd[4]/p" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#network-error" data-tested-assertations=".." />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[7] following::ol[1]/li[7]/ol/li[3] following::ol[1]/li[7]/ol/li[4] following::ol[1]/li[9] following::ol[1]/li[10]" />
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <title>XMLHttpRequest: The send() method: Fire a progress event named error when Network error happens (synchronous flag is unset)</title>
+</head>
+
+<body>
+    <div id="log"></div>
+
+    <script type="text/javascript">
+        var test = async_test();
+
+        test.step(function(){
+            var xhr = new XMLHttpRequest();
+            var expect =  ["loadstart", "upload.loadstart", 4, "upload.error", "upload.loadend", "error", "loadend"];
+            var actual = [];
+
+            xhr.onreadystatechange = test.step_func(() => {
+                if (xhr.readyState == 4) {
+                    actual.push(xhr.readyState);
+                }
+            });
+
+            xhr.onloadstart        = test.step_func(e => { actual.push(e.type); })
+            xhr.onloadend          = test.step_func_done(e => {
+                actual.push(e.type);
+                assert_array_equals(actual, expect);
+            })
+            xhr.onerror            = test.step_func(e => { actual.push(e.type); })
+
+            xhr.upload.onloadstart = test.step_func(e => { actual.push("upload." + e.type); })
+            xhr.upload.onloadend   = test.step_func(e => { actual.push("upload." + e.type); })
+            xhr.upload.onerror     = test.step_func(e => { actual.push("upload." + e.type); })
+
+            xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", true);
+            xhr.send("Test Message");
+        });
+    </script>
+</body>
+</html>
index 85ae963..3a80348 100644 (file)
@@ -5,7 +5,7 @@
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
     <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2]" />
-    <!-- 
+    <!--
       NOTE: the XHR spec does not really handle this scenario. It's handled in the Fetch spec:
       "If response's headers do not contain a header whose name is Location, return response."
      -->
index 1e705ca..37a90d4 100644 (file)
@@ -25,7 +25,7 @@
 
         // 307 redirects should resend the POST data, and events and headers will be a little different..
         if(shouldResendPost) {
-            expectedHeaders = { 
+            expectedHeaders = {
                 "X-Request-Content-Length": "11988",
                 "X-Request-Content-Type": "text/plain;charset=UTF-8",
                 "X-Request-Method": "POST",
             ];
         } else {
             // setting the right expectations for POST resent as GET without request body
-            expectedHeaders = { 
+            expectedHeaders = {
                 "X-Request-Content-Length": "NO",
                 "X-Request-Content-Type": "NO",
                 "X-Request-Method": "GET",
                 "X-Request-Query": "NO"
-            }            
+            }
             expectedEvents = [
                 "xhr onreadystatechange 1",
                 "xhr loadstart 1",
index 5952144..7ccdb3e 100644 (file)
@@ -4,7 +4,7 @@
     <title>XMLHttpRequest: setRequestHeader() after send()</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" />  
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" />
   </head>
   <body>
     <div id="log"></div>
index d90b02e..cbe4b29 100644 (file)
@@ -4,7 +4,7 @@
     <title>XMLHttpRequest: setRequestHeader() before open()</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" />  
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" />
   </head>
   <body>
     <div id="log"></div>
index 741adf7..79837a1 100644 (file)
@@ -153,6 +153,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-simple.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-user-password-non-same-origin.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/overridemimetype-blob.html
@@ -190,7 +191,12 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/security-consideration.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-accept-language.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-accept.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader-and-arguments.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-blob-with-no-mime-type.html
@@ -204,12 +210,14 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-es-object.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-formdata.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-unexpected-tostring.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document-bogus.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-empty.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-none.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-no-response-event-loadend.htm
 /LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-no-response-event-loadstart.htm
index 23acf7f..48a9893 100644 (file)
     <div id="log"></div>
     <script type="text/javascript">
 
+var test = async_test();
+
 function startRequest() {
     xhr.open("GET", "./resources/content.py?content=Hi", true);
     xhr.timeout = 2000;
-    setTimeout(function () {
+    test.step_timeout(function () {
       xhr.send();
     }, 1000);
 }
 
-var test = async_test();
 test.step(function()
 {
     var count = 0;
@@ -40,7 +41,7 @@ test.step(function()
       assert_unreached("HTTP error should not timeout");
     }
     startRequest();
-    setTimeout(startRequest, 3500);
+    test.step_timeout(startRequest, 3500);
 });
 
     </script>
index a343b76..eb52d63 100644 (file)
@@ -4,16 +4,16 @@
     <title>XMLHttpRequest: members during UNSENT</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
-    <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" />  
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />  
-    
+    <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" />
+    <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />
+
   </head>
   <body>
     <div id="log"></div>