Backed out changeset b64d6f5b63db (bug 918751) for OS X permaorange in XMLHttpRequest/send-non-same-origin.sub.htm
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 29 Aug 2016 21:27:32 -0700
changeset 353003 26e22af660e543ebb69930f082188b69ec756185
parent 353002 fecb1018cdcbf931db0892b6fba2e8348286f1d8
child 353048 49253ea90409c02b5a6fb1d3687ab3de73d32bea
child 353066 cb74e60bc40a18ffa711ca07129855c094b792c1
child 353084 e99c4f271bddd6f29d2a72d24a568e63e3e459d0
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs918751
milestone51.0a1
backs outb64d6f5b63db798e1be7f4a068c8a5f3b1dca9a5
first release with
nightly linux32
26e22af660e5 / 51.0a1 / 20160830030201 / files
nightly linux64
26e22af660e5 / 51.0a1 / 20160830030201 / files
nightly mac
26e22af660e5 / 51.0a1 / 20160830030201 / files
nightly win32
26e22af660e5 / 51.0a1 / 20160830030201 / files
nightly win64
26e22af660e5 / 51.0a1 / 20160830030201 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset b64d6f5b63db (bug 918751) for OS X permaorange in XMLHttpRequest/send-non-same-origin.sub.htm
dom/xhr/XMLHttpRequestMainThread.cpp
testing/web-platform/meta/XMLHttpRequest/send-after-setting-document-domain.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-non-same-origin.sub.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-redirect-bogus-sync.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-redirect-infinite-sync.htm.ini
testing/web-platform/meta/XMLHttpRequest/xmlhttprequest-network-error-sync.htm.ini
testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-1.htm
testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-2.htm
testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-helper.js
testing/web-platform/tests/XMLHttpRequest/send-after-setting-document-domain.htm
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2608,17 +2608,17 @@ XMLHttpRequestMainThread::InitiateFetch(
     // ref to us to be extra safe.
     mChannel->SetNotificationCallbacks(mNotificationCallbacks);
     mChannel = nullptr;
 
     mErrorLoad = true;
 
     // Per spec, we throw on sync errors, but not async.
     if (mFlagSynchronous) {
-      return NS_ERROR_DOM_NETWORK_ERR;
+      return rv;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XMLHttpRequestMainThread::Send(nsIVariant* aVariant)
@@ -2869,17 +2869,17 @@ XMLHttpRequestMainThread::SendInternal(c
       DispatchProgressEvent(mUpload, ProgressEventType::loadstart,
                             0, mUploadTotal);
     }
   }
 
   if (!mChannel) {
     // Per spec, silently fail on async request failures; throw for sync.
     if (mFlagSynchronous) {
-      return NS_ERROR_DOM_NETWORK_ERR;
+      return NS_ERROR_FAILURE;
     } else {
       // Defer the actual sending of async events just in case listeners
       // are attached after the send() method is called.
       NS_DispatchToCurrentThread(
         NewRunnableMethod<ProgressEventType>(this,
           &XMLHttpRequestMainThread::CloseRequestWithError,
           ProgressEventType::error));
       return NS_OK;
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/XMLHttpRequest/send-after-setting-document-domain.htm.ini
@@ -0,0 +1,6 @@
+[send-after-setting-document-domain.htm]
+  type: testharness
+  expected: ERROR
+  [loading documents from the origin document.domain was set to should throw]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm.ini
@@ -0,0 +1,5 @@
+[send-authentication-basic-cors-not-enabled.htm]
+  type: testharness
+  [XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)]
+    expected: FAIL
+
--- a/testing/web-platform/meta/XMLHttpRequest/send-non-same-origin.sub.htm.ini
+++ b/testing/web-platform/meta/XMLHttpRequest/send-non-same-origin.sub.htm.ini
@@ -1,4 +1,17 @@
 [send-non-same-origin.sub.htm]
   type: testharness
+  [XMLHttpRequest: send() - non same-origin (mailto:test@example.org)]
+    expected: FAIL
+
   [XMLHttpRequest: send() - non same-origin (tel:+31600000000)]
     expected: FAIL
+
+  [XMLHttpRequest: send() - non same-origin (http://www2.web-platform.test:8000/)]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - non same-origin (javascript:alert('FAIL'))]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - non same-origin (folder.txt)]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/XMLHttpRequest/send-redirect-bogus-sync.htm.ini
@@ -0,0 +1,17 @@
+[send-redirect-bogus-sync.htm]
+  type: testharness
+  [XMLHttpRequest: send() - Redirects (bogus Location header; sync) (301: foobar://abcd)]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - Redirects (bogus Location header; sync) (302: http://z)]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - Redirects (bogus Location header; sync) (302: mailto:someone@example.org)]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - Redirects (bogus Location header; sync) (303: http://z)]
+    expected: FAIL
+
+  [XMLHttpRequest: send() - Redirects (bogus Location header; sync) (303: tel:1234567890)]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/XMLHttpRequest/send-redirect-infinite-sync.htm.ini
@@ -0,0 +1,5 @@
+[send-redirect-infinite-sync.htm]
+  type: testharness
+  [XMLHttpRequest: send() - Redirects (infinite loop; sync) (301)]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/XMLHttpRequest/xmlhttprequest-network-error-sync.htm.ini
@@ -0,0 +1,5 @@
+[xmlhttprequest-network-error-sync.htm]
+  type: testharness
+  [XMLHttpRequest: members during network errors (sync)]
+    expected: FAIL
+
deleted file mode 100644
--- a/testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-1.htm
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<html>
-  <head>
-    <title>XMLHttpRequest: send() with document.domain set: loading documents from original origin after setting document.domain</title>
-    <script src="send-after-setting-document-domain-window-helper.js"></script>
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[2]/ol[1]/li[3]" />
-  </head>
-  <body>
-    <script>
-      run_test(function() {
-        document.domain = document.domain; // this is not a noop, it does actually change the security context
-        var client = new XMLHttpRequest();
-        client.open("GET", "status.py?content=hello", false);
-        client.send(null);
-        assert_equals(client.responseText, "hello");
-        document.domain = document.domain.replace(/^\w+\./, "");
-        client.open("GET", "status.py?content=hello2", false);
-        client.send(null);
-        assert_equals(client.responseText, "hello2");
-      }, "loading documents from original origin after setting document.domain");
-    </script>
-  </body>
-</html>
deleted file mode 100644
--- a/testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-2.htm
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html>
-<html>
-  <head>
-    <title>XMLHttpRequest: send() with document.domain set: loading documents from the origin document.domain was set to should throw</title>
-    <script src="send-after-setting-document-domain-window-helper.js"></script>
-    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[2]/ol[1]/li[3]" />
-  </head>
-  <body>
-    <script>
-      run_test(function() {
-        document.domain = document.domain.replace(/^\w+\./, "");
-        var client = new XMLHttpRequest();
-        client.open("GET", location.protocol + "//" + document.domain + location.pathname.replace(/[^\/]*$/, "") + "status.py?content=hello3", false);
-        assert_throws("NetworkError", function() {
-          client.send(null);
-        });
-      }, "loading documents from the origin document.domain was set to should throw");
-    </script>
-  </body>
-</html>
deleted file mode 100644
--- a/testing/web-platform/tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-helper.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function assert_equals(value, expected) {
-  if (value != expected) {
-    throw "Got wrong value.\nExpected '" + expected + "',\ngot '" + value + "'";
-  }
-}
-
-function assert_throws(expected_exc, func) {
-  try {
-    func.call(this);
-  } catch(e) {
-    var actual = e.name || e.type;
-    if (actual != expected_exc) {
-      throw "Got wrong exception.\nExpected '" + expected_exc + "',\ngot '" + actual + "'.";
-    }
-    return;
-  }
-  throw "Expected exception, but none was thrown";
-}
-
-function run_test(test, name) {
-  var result = {passed: true, message: null, name: name};
-  try {
-    test();
-  } catch(e) {
-    result.passed = false;
-    result.message = e + "";
-  }
-  opener.postMessage(result, "*");
-}
--- a/testing/web-platform/tests/XMLHttpRequest/send-after-setting-document-domain.htm
+++ b/testing/web-platform/tests/XMLHttpRequest/send-after-setting-document-domain.htm
@@ -1,39 +1,38 @@
 <!doctype html>
 <html>
   <head>
     <title>XMLHttpRequest: send() with document.domain set</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
+    <!-- The spec doesn't seem to explicitly cover this case (as of June 2013) -->
     <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[2]/ol[1]/li[3]" />
   </head>
   <body>
     <div id="log"></div>
     <script>
-      var test_base_url = location.protocol+'//www2.'+location.host+"/XMLHttpRequest/resources/",
-          test_windows = [
-            window.open(test_base_url + "send-after-setting-document-domain-window-1.htm"),
-            window.open(test_base_url + "send-after-setting-document-domain-window-2.htm"),
-          ],
-          num_tests_left = test_windows.length;
+      // first make sure we actually run off a domain with at least three parts, in order to be able to shorten it..
+      if (location.hostname.split(/\./).length < 3) {
+        location.href = location.protocol+'//www2.'+location.host+location.pathname
+      }
 
-      async_test(function(wrapper_test) {
-        window.addEventListener("message", function(evt) {
-          // run a shadow test that just forwards the results
-          async_test(function(test) {
-            assert_true(evt.data.passed, evt.data.message);
-            test.done();
-          }, evt.data.name);
-
-          // after last result comes in, close all test
-          // windows and complete the wrapper test.
-          if (--num_tests_left == 0) {
-            for (var i=0; i<test_windows.length; ++i) {
-              test_windows[i].close();
-            }
-            wrapper_test.done();
-          }
-        }, false);
-      }, "All tests ran");
+      test(function() {
+        document.domain = document.domain // this is not a noop, it does actually change the security context
+        var client = new XMLHttpRequest()
+        client.open("GET", "resources/status.py?content=hello", false)
+        client.send(null)
+        assert_equals(client.responseText, "hello")
+        document.domain = document.domain.replace(/^\w+\./, '')
+        client.open("GET", "resources/status.py?content=hello2", false)
+        client.send(null)
+        assert_equals(client.responseText, "hello2")
+      }, "loading documents from original origin after setting document.domain")
+      // try to load a document from the origin document.domain was set to
+      test(function () {
+        var client = new XMLHttpRequest()
+        client.open("GET", location.protocol + '//' + document.domain + location.pathname.replace(/[^\/]*$/, '') + "resources/status.py?content=hello3", false)
+        // AFAIK this should throw
+        assert_throws('NetworkError', function(){client.send(null)})
+      }, "loading documents from the origin document.domain was set to should throw")
     </script>
   </body>
 </html>