OLD | NEW |
1 // Adapter for testharness.js-style tests with Service Workers | 1 // Adapter for testharness.js-style tests with Service Workers |
2 | 2 |
3 function service_worker_test(url, description) { | 3 function service_worker_test(url, description) { |
4 var t = async_test(description); | 4 var t = async_test(description); |
5 t.step(function() { | 5 t.step(function() { |
6 | 6 |
7 navigator.serviceWorker.register(url, {scope:'nonexistent'}).then( | 7 navigator.serviceWorker.register(url, {scope:'nonexistent'}).then( |
8 t.step_func(function(worker) { | 8 t.step_func(function(worker) { |
9 var messageChannel = new MessageChannel(); | 9 var messageChannel = new MessageChannel(); |
10 messageChannel.port1.onmessage = t.step_func(onMessage); | 10 messageChannel.port1.onmessage = t.step_func(onMessage); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 function with_iframe(url, f) { | 51 function with_iframe(url, f) { |
52 var frame = document.createElement('iframe'); | 52 var frame = document.createElement('iframe'); |
53 frame.src = url; | 53 frame.src = url; |
54 frame.onload = function() { | 54 frame.onload = function() { |
55 f(frame); | 55 f(frame); |
56 }; | 56 }; |
57 document.body.appendChild(frame); | 57 document.body.appendChild(frame); |
58 } | 58 } |
59 | 59 |
60 function normalizeURL(url) { | 60 function normalizeURL(url) { |
61 return new URL(url, document.location).toString(); | 61 return new URL(url, document.location).toString().replace(/#.*$/, ''); |
62 } | 62 } |
OLD | NEW |