From 07b63bb4d273b001a5bebf2f2e9cd3cb3d806749 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 9 Nov 2018 16:56:56 +0000 Subject: [PATCH] Bug 1499659 [wpt PR 13559] - Fetch: test nosniff parsing better, a=testonly Automatic update from web-platform-testsFetch: X-Content-Type-Options: nosniff parsing For https://github.com/whatwg/fetch/pull/818. -- wpt-commits: 10f708e6f13141fc92ca9318c7606590f659fcf2 wpt-pr: 13559 --- .../tests/fetch/nosniff/parsing-nosniff.html | 28 --------- .../fetch/nosniff/parsing-nosniff.window.js | 24 ++++++++ .../nosniff/resources/nosniff-first.asis | 7 --- .../fetch/nosniff/resources/nosniff-last.asis | 7 --- .../fetch/nosniff/resources/nosniff-no-x.asis | 6 -- .../resources/nosniff-quoted-single.asis | 6 -- .../nosniff/resources/nosniff-quoted.asis | 6 -- .../nosniff/resources/nosniff-uppercase.asis | 6 -- .../tests/fetch/nosniff/resources/nosniff.py | 10 ++++ .../resources/x-content-type-options.json | 58 +++++++++++++++++++ 10 files changed, 92 insertions(+), 66 deletions(-) delete mode 100644 testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html create mode 100644 testing/web-platform/tests/fetch/nosniff/parsing-nosniff.window.js delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-first.asis delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-last.asis delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-no-x.asis delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted-single.asis delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted.asis delete mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-uppercase.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff.py create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/x-content-type-options.json diff --git a/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html b/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html deleted file mode 100644 index 10c5cadfcaadd..0000000000000 --- a/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html +++ /dev/null @@ -1,28 +0,0 @@ - - -
- diff --git a/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.window.js b/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.window.js new file mode 100644 index 0000000000000..043e659127b2c --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.window.js @@ -0,0 +1,24 @@ +promise_test(() => fetch("resources/x-content-type-options.json").then(res => res.json()).then(runTests), "Loading JSONā€¦"); + +function runTests(allTestData) { + for (let i = 0; i < allTestData.length; i++) { + const testData = allTestData[i], + input = encodeURIComponent(testData.input); + async_test(t => { + const script = document.createElement("script"); + t.add_cleanup(() => script.remove()); + // A