diff options
Diffstat (limited to 'testing/web-platform/tests/fetch/nosniff/importscripts.js')
-rw-r--r-- | testing/web-platform/tests/fetch/nosniff/importscripts.js | 17 |
1 files changed, 17 insertions, 0 deletions
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") |