Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/navigation-redirect-other-origin.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/navigation-redirect-other-origin.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/navigation-redirect-other-origin.html |
deleted file mode 100644 |
index fbff9f620cb922fb7d3d5df6b2b647e3187b781e..0000000000000000000000000000000000000000 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/navigation-redirect-other-origin.html |
+++ /dev/null |
@@ -1,66 +0,0 @@ |
-<!DOCTYPE html> |
-<script src="../../resources/get-host-info.js?pipe=sub"></script> |
-<script src="test-helpers.js"></script> |
-<script> |
-var host_info = get_host_info(); |
-var SCOPE = 'navigation-redirect-scope1.php'; |
-var SCRIPT = 'navigation-redirect-worker.js'; |
- |
-var registration; |
-var worker; |
-var wait_for_worker_promise = navigator.serviceWorker.getRegistration(SCOPE) |
- .then(function(reg) { |
- if (reg) |
- return reg.unregister(); |
- }) |
- .then(function() { |
- return navigator.serviceWorker.register(SCRIPT, {scope: SCOPE}); |
- }) |
- .then(function(reg) { |
- registration = reg; |
- worker = reg.installing; |
- return new Promise(function(resolve) { |
- worker.addEventListener('statechange', function() { |
- if (worker.state == 'activated') |
- resolve(); |
- }); |
- }); |
- }); |
- |
-function send_result(message_id, result) { |
- window.parent.postMessage( |
- {id: message_id, result: result}, |
- host_info['HTTP_ORIGIN']); |
-} |
- |
-function get_intercepted_urls(worker) { |
- return new Promise(function(resolve) { |
- var channel = new MessageChannel(); |
- channel.port1.onmessage = function(msg) { resolve(msg.data.urls); }; |
- worker.postMessage({port: channel.port2}, [channel.port2]); |
- }); |
-} |
- |
-window.addEventListener('message', on_message, false); |
- |
-function on_message(e) { |
- if (e.origin != host_info['HTTP_ORIGIN']) { |
- console.error('invalid origin: ' + e.origin); |
- return; |
- } |
- if (e.data.message == 'wait_for_worker') { |
- wait_for_worker_promise.then(function() { send_result(e.data.id, 'ok'); }); |
- } else if (e.data.message == 'get_intercepted_urls') { |
- get_intercepted_urls(worker) |
- .then(function(urls) { |
- send_result(e.data.id, urls); |
- }); |
- } else if (e.data.message == 'unregister') { |
- registration.unregister() |
- .then(function() { |
- send_result(e.data.id, 'ok'); |
- }); |
- } |
-} |
- |
-</script> |