Backed out changeset 6d0ac4c74fd5 (bug 1298823) for frequent failures in test_request.html
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 01 Mar 2017 14:18:32 +0100
changeset 345300 8a5b7f743d6655ebda44bb1d2523aa6f155d0605
parent 345299 f6479c35a73ca37abded7fe570dccc67d3e38fac
child 345301 6b3ce92ad51e9f4569fc300e22a61c4971de6e2a
push id31436
push userkwierso@gmail.com
push dateThu, 02 Mar 2017 01:18:52 +0000
treeherdermozilla-central@e91de6fb2b3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1298823
milestone54.0a1
backs out6d0ac4c74fd5a4e2f53e83c00ff8ca24abe5e1d7
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 6d0ac4c74fd5 (bug 1298823) for frequent failures in test_request.html
dom/fetch/Request.cpp
testing/web-platform/meta/fetch/api/policies/referrer-origin-service-worker.https.html.ini
testing/web-platform/meta/fetch/api/policies/referrer-origin-worker.html.ini
testing/web-platform/meta/fetch/api/policies/referrer-origin.html.ini
testing/web-platform/meta/fetch/api/request/request-init-001.sub.html.ini
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -333,17 +333,18 @@ Request::Constructor(const GlobalObject&
 
   RequestMode mode = aInit.mMode.WasPassed() ? aInit.mMode.Value() : fallbackMode;
   RequestCredentials credentials =
     aInit.mCredentials.WasPassed() ? aInit.mCredentials.Value()
                                    : fallbackCredentials;
 
   if (mode == RequestMode::Navigate ||
       (aInit.IsAnyMemberPresent() && request->Mode() == RequestMode::Navigate)) {
-    mode = RequestMode::Same_origin;
+    aRv.ThrowTypeError<MSG_INVALID_REQUEST_MODE>(NS_LITERAL_STRING("navigate"));
+    return nullptr;
   }
 
   if (aInit.IsAnyMemberPresent()) {
     request->SetReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR));
     request->SetReferrerPolicy(ReferrerPolicy::_empty);
   }
   if (aInit.mReferrer.WasPassed()) {
     const nsString& referrer = aInit.mReferrer.Value();
@@ -368,17 +369,21 @@ Request::Constructor(const GlobalObject&
         uri->GetSpec(spec);
         CopyUTF8toUTF16(spec, referrerURL);
         if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
           nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull();
           if (principal) {
             nsresult rv = principal->CheckMayLoad(uri, /* report */ false,
                                                   /* allowIfInheritsPrincipal */ false);
             if (NS_FAILED(rv)) {
-              referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR);
+              nsAutoCString globalOrigin;
+              principal->GetOrigin(globalOrigin);
+              aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer,
+                                                                NS_ConvertUTF8toUTF16(globalOrigin));
+              return nullptr;
             }
           }
         }
       } else {
         RefPtr<URL> url = ParseURLFromWorker(aGlobal, referrer, aRv);
         if (NS_WARN_IF(aRv.Failed())) {
           aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
           return nullptr;
@@ -393,20 +398,21 @@ Request::Constructor(const GlobalObject&
           nsresult rv = NS_OK;
           // ReferrerSameOriginChecker uses a sync loop to get the main thread
           // to perform the same-origin check.  Overall, on Workers this method
           // can create 3 sync loops (two for constructing URLs and one here) so
           // in the future we may want to optimize it all by off-loading all of
           // this work in a single sync loop.
           RefPtr<ReferrerSameOriginChecker> checker =
             new ReferrerSameOriginChecker(worker, referrerURL, rv);
-          IgnoredErrorResult error;
-          checker->Dispatch(Terminating, error);
-          if (error.Failed() || NS_FAILED(rv)) {
-            referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR);
+          checker->Dispatch(Terminating, aRv);
+          if (aRv.Failed() || NS_FAILED(rv)) {
+            aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer,
+                                                              worker->GetLocationInfo().mOrigin);
+            return nullptr;
           }
         }
       }
       request->SetReferrer(referrerURL);
     }
   }
 
   if (aInit.mReferrerPolicy.WasPassed()) {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/fetch/api/policies/referrer-origin-service-worker.https.html.ini
@@ -0,0 +1,6 @@
+[referrer-origin-service-worker.https.html]
+  type: testharness
+  [Cross-origin referrer is overridden by client origin]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1341223
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/fetch/api/policies/referrer-origin-worker.html.ini
@@ -0,0 +1,5 @@
+[referrer-origin-worker.html]
+  type: testharness
+  [Cross-origin referrer is overridden by client origin]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/fetch/api/policies/referrer-origin.html.ini
@@ -0,0 +1,5 @@
+[referrer-origin.html]
+  type: testharness
+  [Cross-origin referrer is overridden by client origin]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/fetch/api/request/request-init-001.sub.html.ini
@@ -0,0 +1,8 @@
+[request-init-001.sub.html]
+  type: testharness
+  [Check referrer init value of http://test.url and associated getter]
+    expected: FAIL
+
+  [Check mode init value of navigate and associated getter]
+    expected: FAIL
+