Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/workers/resources/script-src-self.js

Issue 2540983003: CSP: Dedicated workers always inherit policy. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/workers/resources/script-src-self.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/workers/resources/script-src-self.js b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/workers/resources/script-src-self.js
new file mode 100644
index 0000000000000000000000000000000000000000..57f15321a074cfd4a4a0e9ef9cd13f66d6ab2732
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/workers/resources/script-src-self.js
@@ -0,0 +1,25 @@
+importScripts("http://127.0.0.1:8000/resources/testharness.js");
+importScripts("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/testharness-helper.js");
+
+test(t => {
+ // TODO(mkwst): The error event isn't firing. :/
+
+ assert_throws(EvalError(),
+ function () { eval("1 + 1"); },
+ "`eval()` should throw 'EvalError'.");
+
+ assert_throws(EvalError(),
+ function () { var x = new Function("1 + 1"); },
+ "`new Function()` should throw 'EvalError'.");
+}, "`eval()` blocked in " + self.location.protocol);
+
+async_test(t => {
+ waitUntilCSPEventForEval(t, 21)
+ .then(_ => t.done());
+
+ assert_equals(
+ setTimeout("assert_unreached('setTimeout([string]) should not execute.')", 0),
+ 0);
+}, "`setTimeout([string])` blocked in " + self.location.protocol);
+
+done();

Powered by Google App Engine
This is Rietveld 408576698