From bf2444fec1ab92b50ea4081cb2cb497cb334a522 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 6 Jul 2018 17:26:37 +0000 Subject: [PATCH] Bug 1467831 [wpt PR 11427] - Fetch: basic syntax tests for Cross-Origin-Resource-Policy, a=testonly Automatic update from web-platform-testsFetch: basic syntax tests for Cross-Origin-Resource-Policy Supplements #11171. For https://github.com/whatwg/fetch/pull/733. -- wpt-commits: b7373b42eeac24ff6cb3ed494ffbf09e781287da wpt-pr: 11427 --- testing/web-platform/meta/MANIFEST.json | 14 ++++++++++++++ .../cross-origin-resource-policy/syntax.any.js | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 testing/web-platform/tests/fetch/cross-origin-resource-policy/syntax.any.js diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 42d1e76382d6e..845d07a77b9e8 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -338949,6 +338949,16 @@ {} ] ], + "fetch/cross-origin-resource-policy/syntax.any.js": [ + [ + "/fetch/cross-origin-resource-policy/syntax.any.html", + {} + ], + [ + "/fetch/cross-origin-resource-policy/syntax.any.worker.html", + {} + ] + ], "fetch/data-urls/base64.any.js": [ [ "/fetch/data-urls/base64.any.html", @@ -569238,6 +569248,10 @@ "cd28267293f2d20ee78d6b946fe6b8793edf1bae", "testharness" ], + "fetch/cross-origin-resource-policy/syntax.any.js": [ + "77377a2a82a22bf9ff637a1e3b918eda6cb28858", + "testharness" + ], "fetch/data-urls/README.md": [ "868cb170fa0c5626008fef77e37dee16e76b10d5", "support" diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/syntax.any.js b/testing/web-platform/tests/fetch/cross-origin-resource-policy/syntax.any.js new file mode 100644 index 0000000000000..cf5b06d5c4f4b --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/syntax.any.js @@ -0,0 +1,18 @@ +// META: script=/common/get-host-info.sub.js + +const crossOriginURL = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/hello.py?corp="; + +[ + "same", + "same, same-origin", + "SAME-ORIGIN", + "Same-Origin", + "same-origin, <>", + "same-origin, same-origin" +].forEach(incorrectHeaderValue => { + // Note: an incorrect value results in a successful load, so this test is only meaningful in + // implementations with support for the header. + promise_test(t => { + return fetch(crossOriginURL + encodeURIComponent(incorrectHeaderValue), { mode: "no-cors" }); + }, "Parsing Cross-Origin-Resource-Policy: " + incorrectHeaderValue); +});