| 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>
|
|
|