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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/post-addressspace-from-serviceworker.html

Issue 1929353002: CORS-RFC1918: Service Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Works. Created 4 years, 8 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/cors-rfc1918/resources/post-addressspace-from-serviceworker.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/post-addressspace-from-serviceworker.html b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/post-addressspace-from-serviceworker.html
new file mode 100644
index 0000000000000000000000000000000000000000..771e6165db81f857bc30ad33d655ee5d518d2c48
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/post-addressspace-from-serviceworker.html
@@ -0,0 +1,32 @@
+<script src='/serviceworker/resources/test-helpers.js'></script>
+<script>
+ function postDataToParent(e) {
+ window.parent.postMessage(e.data, "*");
+ }
+
+ var script = "/security/cors-rfc1918/resources/post-addressspace-to-owner-serviceworker.js";
+ var scope = "/security/cors-rfc1918/resources/post-addressspace-from-serviceworker.html";
+ var registration;
+
+ var t = { step_func: f => f};
+ service_worker_unregister_and_register(t, script, scope)
+ .then(r => {
+ if (!r) {
+ throw({ name: "WTF" });
+ }
+ registration = r;
+ return wait_for_state(t, registration.installing, 'activated');
+ })
+ .then(_ => {
+ return new Promise(resolve => {
+ var ports = new MessageChannel();
+ ports.port1.onmessage = e => {
+ postDataToParent(e);
+ resolve();
+ };
+ registration.active.postMessage("go", [ports.port2]);
+ });
+ })
+ .then(_ => service_worker_unregister(t, scope))
+ .catch(e => window.parent.postMessage({ "origin": e.name }, "*"));
+</script>

Powered by Google App Engine
This is Rietveld 408576698