Bug 1453301 - Stop supporting about:blank in fetch to match the spec. r?baku draft
authorThomas Wisniewski <wisniewskit@gmail.com>
Fri, 03 Aug 2018 21:52:36 -0400
changeset 826623 b6544990b6fea351f7a0360ad4d6c0fa3a2f342e
parent 826605 4146a5857135b8542858b9e23bc5a71237e05f49
push id118376
push userwisniewskit@gmail.com
push dateSat, 04 Aug 2018 17:02:13 +0000
reviewersbaku
bugs1453301
milestone63.0a1
Bug 1453301 - Stop supporting about:blank in fetch to match the spec. r?baku MozReview-Commit-ID: DMku5SAunfo
dom/fetch/FetchDriver.cpp
dom/tests/mochitest/fetch/test_fetch_basic.js
testing/web-platform/meta/fetch/api/basic/scheme-about.any.js.ini
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -472,17 +472,17 @@ FetchDriver::HttpFetch(const nsACString&
   // is true, and unset otherwise."
 
   // Set skip serviceworker flag.
   // While the spec also gates on the client being a ServiceWorker, we can't
   // infer that here. Instead we rely on callers to set the flag correctly.
   const nsLoadFlags bypassFlag = mRequest->SkipServiceWorker() ?
                                  nsIChannel::LOAD_BYPASS_SERVICE_WORKER : 0;
 
-  nsSecurityFlags secFlags = nsILoadInfo::SEC_ABOUT_BLANK_INHERITS;
+  nsSecurityFlags secFlags = 0;
   if (mRequest->Mode() == RequestMode::Cors) {
     secFlags |= nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS;
   } else if (mRequest->Mode() == RequestMode::Same_origin ||
              mRequest->Mode() == RequestMode::Navigate) {
     secFlags |= nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS;
   } else if (mRequest->Mode() == RequestMode::No_cors) {
     secFlags |= nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
   } else {
--- a/dom/tests/mochitest/fetch/test_fetch_basic.js
+++ b/dom/tests/mochitest/fetch/test_fetch_basic.js
@@ -1,18 +1,13 @@
 function testAboutURL() {
   var p1 = fetch('about:blank').then(function(res) {
-    is(res.status, 200, "about:blank should load a valid Response");
-    is(res.headers.get('content-type'), 'text/html;charset=utf-8',
-       "about:blank content-type should be text/html;charset=utf-8");
-    is(res.headers.has('content-length'), false,
-       "about:blank should not have a content-length header");
-    return res.text().then(function(v) {
-      is(v, "", "about:blank body should be empty");
-    });
+    ok(false, "about:blank should fail");
+  }, function(e) {
+    ok(e instanceof TypeError, "about:blank should fail");
   });
 
   var p2 = fetch('about:config').then(function(res) {
     ok(false, "about:config should fail");
   }, function(e) {
     ok(e instanceof TypeError, "about:config should fail");
   });
 
deleted file mode 100644
--- a/testing/web-platform/meta/fetch/api/basic/scheme-about.any.js.ini
+++ /dev/null
@@ -1,21 +0,0 @@
-[scheme-about.any.worker.html]
-  [Fetching about:blank with method GET is KO]
-    expected: FAIL
-
-  [Fetching about:blank with method PUT is KO]
-    expected: FAIL
-
-  [Fetching about:blank with method POST is KO]
-    expected: FAIL
-
-
-[scheme-about.any.html]
-  [Fetching about:blank with method GET is KO]
-    expected: FAIL
-
-  [Fetching about:blank with method PUT is KO]
-    expected: FAIL
-
-  [Fetching about:blank with method POST is KO]
-    expected: FAIL
-