From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../web-platform/tests/fetch/nosniff/image.html | 29 ++++++++++++++++++++ .../tests/fetch/nosniff/importscripts.html | 14 ++++++++++ .../tests/fetch/nosniff/importscripts.js | 17 ++++++++++++ .../tests/fetch/nosniff/parsing-nosniff.html | 28 +++++++++++++++++++ .../tests/fetch/nosniff/resources/css.py | 15 ++++++++++ .../tests/fetch/nosniff/resources/image.py | 16 +++++++++++ .../tests/fetch/nosniff/resources/js.py | 17 ++++++++++++ .../fetch/nosniff/resources/nosniff-first.asis | 7 +++++ .../fetch/nosniff/resources/nosniff-last.asis | 7 +++++ .../fetch/nosniff/resources/nosniff-no-x.asis | 6 ++++ .../nosniff/resources/nosniff-quoted-single.asis | 6 ++++ .../fetch/nosniff/resources/nosniff-quoted.asis | 6 ++++ .../fetch/nosniff/resources/nosniff-uppercase.asis | 6 ++++ .../tests/fetch/nosniff/resources/worker.py | 16 +++++++++++ .../web-platform/tests/fetch/nosniff/script.html | 32 ++++++++++++++++++++++ .../tests/fetch/nosniff/stylesheet.html | 30 ++++++++++++++++++++ .../web-platform/tests/fetch/nosniff/worker.html | 28 +++++++++++++++++++ 17 files changed, 280 insertions(+) create mode 100644 testing/web-platform/tests/fetch/nosniff/image.html create mode 100644 testing/web-platform/tests/fetch/nosniff/importscripts.html create mode 100644 testing/web-platform/tests/fetch/nosniff/importscripts.js create mode 100644 testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/css.py create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/image.py create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/js.py create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-first.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-last.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-no-x.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted-single.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/nosniff-uppercase.asis create mode 100644 testing/web-platform/tests/fetch/nosniff/resources/worker.py create mode 100644 testing/web-platform/tests/fetch/nosniff/script.html create mode 100644 testing/web-platform/tests/fetch/nosniff/stylesheet.html create mode 100644 testing/web-platform/tests/fetch/nosniff/worker.html (limited to 'testing/web-platform/tests/fetch/nosniff') diff --git a/testing/web-platform/tests/fetch/nosniff/image.html b/testing/web-platform/tests/fetch/nosniff/image.html new file mode 100644 index 000000000..e5869d94e --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/image.html @@ -0,0 +1,29 @@ + + +
+ diff --git a/testing/web-platform/tests/fetch/nosniff/importscripts.html b/testing/web-platform/tests/fetch/nosniff/importscripts.html new file mode 100644 index 000000000..920b6bdd4 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/importscripts.html @@ -0,0 +1,14 @@ + + +
+ diff --git a/testing/web-platform/tests/fetch/nosniff/importscripts.js b/testing/web-platform/tests/fetch/nosniff/importscripts.js new file mode 100644 index 000000000..aeb615487 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/importscripts.js @@ -0,0 +1,17 @@ +// Testing importScripts() +function log(w) { this.postMessage(w) } +function f() { log("FAIL") } +function p() { log("PASS") } + +["", "?type=", "?type=x", "?type=x/x"].forEach(function(urlpart) { + try { + importScripts("resources/js.py" + urlpart) + } catch(e) { + (e.name == "NetworkError") ? p() : log("FAIL (no NetworkError exception): " + urlpart) + } + +}) +importScripts("resources/js.py?type=text/javascript&outcome=p") +importScripts("resources/js.py?type=text/ecmascript&outcome=p") +importScripts("resources/js.py?type=text/ecmascript;blah&outcome=p") +log("END") diff --git a/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html b/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html new file mode 100644 index 000000000..10c5cadfc --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/parsing-nosniff.html @@ -0,0 +1,28 @@ + + +
+ diff --git a/testing/web-platform/tests/fetch/nosniff/resources/css.py b/testing/web-platform/tests/fetch/nosniff/resources/css.py new file mode 100644 index 000000000..7c4c63b59 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/css.py @@ -0,0 +1,15 @@ +def main(request, response): + outcome = request.GET.first("outcome", "f") + type = request.GET.first("type", None) + + content = "/* nothing to see here */" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/testing/web-platform/tests/fetch/nosniff/resources/image.py b/testing/web-platform/tests/fetch/nosniff/resources/image.py new file mode 100644 index 000000000..8fb05edc6 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/image.py @@ -0,0 +1,16 @@ +import os.path + +def main(request, response): + type = request.GET.first("type", None) + + body = open(os.path.join(os.path.dirname(__file__), "../../../images/blue96x96.png"), "rb").read() + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(body)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(body) diff --git a/testing/web-platform/tests/fetch/nosniff/resources/js.py b/testing/web-platform/tests/fetch/nosniff/resources/js.py new file mode 100644 index 000000000..0c06d9cd2 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/js.py @@ -0,0 +1,17 @@ +def main(request, response): + outcome = request.GET.first("outcome", "f") + type = request.GET.first("type", "Content-Type missing") + + content = "// nothing to see here" + content += "\n" + content += "log('FAIL: " + type + "')" if (outcome == "f") else "p()" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != "Content-Type missing"): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-first.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-first.asis new file mode 100644 index 000000000..bccc53eef --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-first.asis @@ -0,0 +1,7 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-options: nosniff +X-Content-Type-Options: no + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-last.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-last.asis new file mode 100644 index 000000000..e3de0733e --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-last.asis @@ -0,0 +1,7 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: no +X-Content-Type-options: nosniff + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-no-x.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-no-x.asis new file mode 100644 index 000000000..329d0f721 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-no-x.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +Content-Type-Options: nosniff + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted-single.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted-single.asis new file mode 100644 index 000000000..501f18999 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted-single.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: 'NosniFF' + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted.asis new file mode 100644 index 000000000..c6de62b68 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-quoted.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: "nosniFF" + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/nosniff-uppercase.asis b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-uppercase.asis new file mode 100644 index 000000000..8097fddce --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/nosniff-uppercase.asis @@ -0,0 +1,6 @@ +HTTP/1.1 200 YOU HAVE NO POWER HERE +Content-Length: 22 +Content-Type: x/x +X-Content-Type-Options: NOSNIFF + +// nothing to see here diff --git a/testing/web-platform/tests/fetch/nosniff/resources/worker.py b/testing/web-platform/tests/fetch/nosniff/resources/worker.py new file mode 100644 index 000000000..3903ba349 --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/resources/worker.py @@ -0,0 +1,16 @@ +def main(request, response): + type = request.GET.first("type", None) + + content = "// nothing to see here" + content += "\n" + content += "this.postMessage('hi')" + + response.add_required_headers = False + response.writer.write_status(200) + response.writer.write_header("x-content-type-options", "nosniff") + response.writer.write_header("content-length", len(content)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(content) diff --git a/testing/web-platform/tests/fetch/nosniff/script.html b/testing/web-platform/tests/fetch/nosniff/script.html new file mode 100644 index 000000000..667f3c99a --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/script.html @@ -0,0 +1,32 @@ + + +
+ diff --git a/testing/web-platform/tests/fetch/nosniff/stylesheet.html b/testing/web-platform/tests/fetch/nosniff/stylesheet.html new file mode 100644 index 000000000..0ad04038e --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/stylesheet.html @@ -0,0 +1,30 @@ + + + +
+ diff --git a/testing/web-platform/tests/fetch/nosniff/worker.html b/testing/web-platform/tests/fetch/nosniff/worker.html new file mode 100644 index 000000000..466b2075e --- /dev/null +++ b/testing/web-platform/tests/fetch/nosniff/worker.html @@ -0,0 +1,28 @@ + + +
+ -- cgit v1.2.3