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

Unified Diff: LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php

Issue 1128813003: Give shared workers their own content security policies (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 7 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: LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php
diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php
index a090d783b36d3b03a6d9af8b509f248fbf76af07..06e5d20bb0b1d9a0f29ccbfd20d02ea5bbe8b25e 100644
--- a/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php
+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php
@@ -34,7 +34,7 @@ var fn = function() {
postMessage('Function() function blocked');
}
try {
- fn = new Function("", "postMessage('Function() function allowed');");
+ fn = new Function("", "postMessage('Function() function allowed');");
}
catch(e) {
}
@@ -57,13 +57,31 @@ try {
try {
var xhr = new XMLHttpRequest;
- xhr.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt", true);
+ xhr.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt", true);
postMessage("xhr allowed");
} catch(e) {
postMessage("xhr blocked");
}
<?php
+} else if ($_GET["type"] == "shared-make-xhr") {
+?>
+
+onconnect = function (e) {
+ var port = e.ports[0];
+ try {
+ var xhr = new XMLHttpRequest;
+ xhr.open(
+ "GET",
+ "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt",
+ true);
+ port.postMessage("xhr allowed");
+ } catch(e) {
+ port.postMessage("xhr blocked");
+ }
+}
+
+<?php
} else if ($_GET["type"] == "set-timeout") {
?>
@@ -92,5 +110,22 @@ xhr.onload = function () {
xhr.send();
<?php
+} else if ($_GET["type"] == "shared-report-referrer") {
+?>
+
+onconnect = function (e) {
+ var port = e.ports[0];
+ var xhr = new XMLHttpRequest;
+ xhr.open(
+ "GET",
+ "http://127.0.0.1:8000/security/resources/echo-referrer-header.php",
+ true);
+ xhr.onload = function () {
+ port.postMessage(this.responseText);
+ };
+ xhr.send();
+};
+
+<?php
}
?>

Powered by Google App Engine
This is Rietveld 408576698