summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/sandbox/support
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/content-security-policy/sandbox/support')
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/empty.html0
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/post-origin-on-load-worker.js1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html.sub.headers1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html4
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html.sub.headers1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-message-to-parent.html3
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html3
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html.sub.headers1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js14
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js.headers1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js3
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js.headers1
-rw-r--r--testing/web-platform/tests/content-security-policy/sandbox/support/unsandboxed-post-property-to-opener.html3
14 files changed, 37 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/empty.html b/testing/web-platform/tests/content-security-policy/sandbox/support/empty.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/empty.html
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/post-origin-on-load-worker.js b/testing/web-platform/tests/content-security-policy/sandbox/support/post-origin-on-load-worker.js
new file mode 100644
index 0000000000..21ce5748ab
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/post-origin-on-load-worker.js
@@ -0,0 +1 @@
+postMessage(self.origin);
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html
new file mode 100644
index 0000000000..fafd4dc770
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html
@@ -0,0 +1 @@
+<iframe src="data:text/html,&lt;script&gt;window.top.postMessage(&apos;Message&apos;,&apos;*&apos;);&lt;/script&gt;"></iframe>
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html.sub.headers
new file mode 100644
index 0000000000..a7ea308208
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-data-iframe.sub.html.sub.headers
@@ -0,0 +1 @@
+Content-Security-Policy: sandbox {{GET[sandbox]}}; \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html
new file mode 100644
index 0000000000..9480e521de
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html
@@ -0,0 +1,4 @@
+<script>
+ window.parent.postMessage('PASS (1/2): Script can execute', '*');
+ eval("window.parent.postMessage('PASS (2/2): Eval works', '*')");
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html.sub.headers b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html.sub.headers
new file mode 100644
index 0000000000..c7e4e7cc5b
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-eval.sub.html.sub.headers
@@ -0,0 +1 @@
+Content-Security-Policy: sandbox allow-scripts \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-message-to-parent.html b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-message-to-parent.html
new file mode 100644
index 0000000000..ef4b1a0b95
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-message-to-parent.html
@@ -0,0 +1,3 @@
+<script>
+ window.top.postMessage("Message", "*");
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html
new file mode 100644
index 0000000000..ebbb54d36d
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html
@@ -0,0 +1,3 @@
+<script>
+ window.opener.postMessage(window.testProperty, "*");
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html.sub.headers b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html.sub.headers
new file mode 100644
index 0000000000..a7ea308208
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-post-property-to-opener.html.sub.headers
@@ -0,0 +1 @@
+Content-Security-Policy: sandbox {{GET[sandbox]}}; \ No newline at end of file
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js
new file mode 100644
index 0000000000..d4971266f5
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js
@@ -0,0 +1,14 @@
+self.addEventListener('fetch', function(event) {
+ const url = new URL(event.request.url);
+ if (url.pathname.indexOf('get-origin') != -1) {
+ event.respondWith(new Promise(function(resolve) {
+ resolve(new Response(JSON.stringify({
+ origin: self.origin
+ })));
+ }));
+ }
+ else if (url.pathname.indexOf('fetch') != -1) {
+ event.respondWith(fetch(url.searchParams.get('url'),
+ {mode: event.request.mode}));
+ }
+ });
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js.headers b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js.headers
new file mode 100644
index 0000000000..1efcf8c226
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-service-worker.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: sandbox allow-scripts
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js
new file mode 100644
index 0000000000..eb85eb41b4
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js
@@ -0,0 +1,3 @@
+self.onconnect = e => {
+ e.ports[0].postMessage(self.origin);
+};
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js.headers b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js.headers
new file mode 100644
index 0000000000..1efcf8c226
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/sandboxed-shared-worker.js.headers
@@ -0,0 +1 @@
+Content-Security-Policy: sandbox allow-scripts
diff --git a/testing/web-platform/tests/content-security-policy/sandbox/support/unsandboxed-post-property-to-opener.html b/testing/web-platform/tests/content-security-policy/sandbox/support/unsandboxed-post-property-to-opener.html
new file mode 100644
index 0000000000..ebbb54d36d
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/sandbox/support/unsandboxed-post-property-to-opener.html
@@ -0,0 +1,3 @@
+<script>
+ window.opener.postMessage(window.testProperty, "*");
+</script> \ No newline at end of file