summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/nosniff/importscripts.js
blob: aeb6154870b7e1d980594f7f042429f953a7cd02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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")