| Index: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/script-src-self.sub.js
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/script-src-self.sub.js b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/script-src-self.sub.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..43ed2d40e0bbefa91b5b8541ed8dce53ad914af7
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/script-src-self.sub.js
|
| @@ -0,0 +1,31 @@
|
| +importScripts("{{location[server]}}/resources/testharness.js");
|
| +importScripts("{{location[server]}}/content-security-policy/support/testharness-helper.js");
|
| +
|
| +test(t => {
|
| + assert_throws("NetworkError",
|
| + _ => importScripts("http://{{domains[www]}}:{{ports[http][1]}}/content-security-policy/support/fail.js"),
|
| + "importScripts should throw `NetworkError`");
|
| +}, "Cross-origin `importScripts()` blocked in " + self.location.protocol + self.location.search);
|
| +
|
| +test(t => {
|
| + // TODO(mkwst): The error event isn't firing. :/
|
| +
|
| + assert_throws(EvalError(),
|
| + _ => eval("1 + 1"),
|
| + "`eval()` should throw 'EvalError'.");
|
| +
|
| + assert_throws(EvalError(),
|
| + _ => new Function("1 + 1"),
|
| + "`new Function()` should throw 'EvalError'.");
|
| +}, "`eval()` blocked in " + self.location.protocol + self.location.search);
|
| +
|
| +async_test(t => {
|
| + waitUntilCSPEventForEval(t, 27)
|
| + .then(_ => t.done());
|
| +
|
| + assert_equals(
|
| + setTimeout("assert_unreached('setTimeout([string]) should not execute.')", 0),
|
| + 0);
|
| +}, "`setTimeout([string])` blocked in " + self.location.protocol + self.location.search);
|
| +
|
| +done();
|
|
|