Bug 1453382 [wpt PR 10421] - Fetch: align about:blank handling with the standard, a=testonly
authorAnne van Kesteren <annevk@annevk.nl>
Sun, 22 Apr 2018 16:45:19 +0000
changeset 471440 76370b20f843901da98cdad4b7c441ffc774636a
parent 471439 ca808b7aae84fbac92e7f932ef811849f9797d1b
child 471441 9da50490d56aabaa7d4e7296e7fd1a8cbe759307
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1453382, 10421
milestone61.0a1
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
Bug 1453382 [wpt PR 10421] - Fetch: align about:blank handling with the standard, a=testonly Automatic update from web-platform-testsFetch: align about:blank handling with the standard See https://github.com/whatwg/fetch/commit/72fc2e787be663f5bc39c88665dd3c356abbca0f. Closes https://github.com/whatwg/xhr/issues/194. -- wpt-commits: fa62ac066402b280c37623ee9ec45489939781fc wpt-pr: 10421
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/fetch/api/basic/scheme-about.any.js
testing/web-platform/tests/fetch/api/headers/header-values-normalize.html
testing/web-platform/tests/fetch/api/headers/header-values.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -555352,17 +555352,17 @@
    "9e7c61ac685654e355174c960ba2084d17ff7f2e",
    "testharness"
   ],
   "fetch/api/basic/response-url.js": [
    "444ef1e53b422f74a4bb322099d8b1147ed8f52b",
    "support"
   ],
   "fetch/api/basic/scheme-about.any.js": [
-   "5e4ce2650ed422ae032f27d8aa1fb6f2b6fe7298",
+   "68b11deaa95a691a8e0c76bdc9b7a07b5dea9868",
    "testharness"
   ],
   "fetch/api/basic/scheme-blob-worker.html": [
    "adfea540164a4113484ea29007ac3738bb7456c4",
    "testharness"
   ],
   "fetch/api/basic/scheme-blob.html": [
    "5835c0c3b108f05b61ef0db945f272264b377d6c",
@@ -555492,21 +555492,21 @@
    "5d24fc1719ef796cd93f25a263b16f01121ce2ec",
    "testharness"
   ],
   "fetch/api/credentials/cookies.any.js": [
    "9c542539ac4bf0654d56bb86770810f2efcce53a",
    "testharness"
   ],
   "fetch/api/headers/header-values-normalize.html": [
-   "889c328c2677763c352ec9aa0264218e01a523d4",
+   "14c2700ac0ed8bd0f086eceb14fd1e1536ae1e3a",
    "testharness"
   ],
   "fetch/api/headers/header-values.html": [
-   "c360fd3d220fc13b35e5858dd9c7ddb49256ae72",
+   "ef067a80fb2fb89437e194ddbf5dc18741dca4e6",
    "testharness"
   ],
   "fetch/api/headers/headers-basic.html": [
    "2eadcace244bb97aae5aee14657bf07f19df22aa",
    "testharness"
   ],
   "fetch/api/headers/headers-casing.html": [
    "c83fdd0119c17b30051ab437e66934dc22c8c420",
--- a/testing/web-platform/tests/fetch/api/basic/scheme-about.any.js
+++ b/testing/web-platform/tests/fetch/api/basic/scheme-about.any.js
@@ -1,34 +1,17 @@
 // META: script=../resources/utils.js
 
-function checkFetchResponse(url, method, desc) {
-  if (!desc) {
-    var cut = (url.length >= 40) ? "[...]" : "";
-    cut += " (" + method + ")"
-    desc = "Fetching " + url.substring(0, 40) + cut + " is OK"
-  }
+function checkNetworkError(url, method) {
+  method = method || "GET";
+  const desc = "Fetching " + url.substring(0, 45) + " with method " + method + " is KO"
   promise_test(function(test) {
-    return fetch(url, { method: method }).then(function(resp) {
-     assert_equals(resp.status, 200, "HTTP status is 200");
-     assert_equals(resp.type, "basic", "response type is basic");
-     assert_equals(resp.headers.get("Content-Type"), "text/html;charset=utf-8", "Content-Type is " + resp.headers.get("Content-Type"));
-     return resp.text();
-    })
-  }, desc);
-}
-
-checkFetchResponse("about:blank", "GET");
-checkFetchResponse("about:blank", "PUT");
-checkFetchResponse("about:blank", "POST");
-
-function checkKoUrl(url, desc) {
-  if (!desc)
-    desc = "Fetching " + url.substring(0, 45) + " is KO"
-  promise_test(function(test) {
-    var promise = fetch(url);
+    var promise = fetch(url, { method: method });
     return promise_rejects(test, new TypeError(), promise);
   }, desc);
 }
 
-checkKoUrl("about:invalid.com");
-checkKoUrl("about:config");
-checkKoUrl("about:unicorn");
+checkNetworkError("about:blank", "GET");
+checkNetworkError("about:blank", "PUT");
+checkNetworkError("about:blank", "POST");
+checkNetworkError("about:invalid.com");
+checkNetworkError("about:config");
+checkNetworkError("about:unicorn");
--- a/testing/web-platform/tests/fetch/api/headers/header-values-normalize.html
+++ b/testing/web-platform/tests/fetch/api/headers/header-values-normalize.html
@@ -51,19 +51,19 @@ for(let i = 0; i < 0x21; i++) {
       })
       xhr.send()
     }
   }, "XMLHttpRequest with value " + encodeURI(val))
 
   promise_test((t) => {
     if(fail) {
       return Promise.all([
-        promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val1": val1} })),
-        promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val2": val2} })),
-        promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val3": val3} }))
+        promise_rejects(t, new TypeError(), fetch(url, { headers: {"val1": val1} })),
+        promise_rejects(t, new TypeError(), fetch(url, { headers: {"val2": val2} })),
+        promise_rejects(t, new TypeError(), fetch(url, { headers: {"val3": val3} }))
       ])
     } else {
       return fetch(url, { headers: {"val1": val1, "val2": val2, "val3": val3} }).then((res) => {
         assert_equals(res.headers.get("x-request-val1"), expectedVal1)
         assert_equals(res.headers.get("x-request-val2"), expectedVal2)
         assert_equals(res.headers.get("x-request-val3"), expectedVal3)
       })
     }
--- a/testing/web-platform/tests/fetch/api/headers/header-values.html
+++ b/testing/web-platform/tests/fetch/api/headers/header-values.html
@@ -10,17 +10,17 @@
 [0, 0x0A, 0x0D].forEach(val => {
   val = "x" + String.fromCharCode(val) + "x"
   test(() => {
     let xhr = new XMLHttpRequest()
     xhr.open("POST", "/")
     assert_throws("SyntaxError", () => xhr.setRequestHeader("value-test", val))
   }, "XMLHttpRequest with value " + encodeURI(val) + " needs to throw")
 
-  promise_test(t => promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"value-test": val} })), "fetch() with value " + encodeURI(val) + " needs to throw")
+  promise_test(t => promise_rejects(t, new TypeError(), fetch("/", { headers: {"value-test": val} })), "fetch() with value " + encodeURI(val) + " needs to throw")
 })
 
 // Valid values
 let headerValues =[]
 for(let i = 0; i < 0x100; i++) {
   if(i === 0 || i === 0x0A || i === 0x0D) {
     continue
   }