mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Service Worker: registration events</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/test-helpers.sub.js"></script>
|
||||
<script>
|
||||
var t = async_test('Registration: events');
|
||||
t.step(function() {
|
||||
var scope = 'resources/in-scope/';
|
||||
service_worker_unregister_and_register(
|
||||
t, 'resources/events-worker.js', scope)
|
||||
.then(t.step_func(function(registration) {
|
||||
onRegister(registration.installing);
|
||||
}))
|
||||
.catch(unreached_rejection(t));
|
||||
|
||||
function sendMessagePort(worker, from) {
|
||||
var messageChannel = new MessageChannel();
|
||||
worker.postMessage({from:from, port:messageChannel.port2}, [messageChannel.port2]);
|
||||
return messageChannel.port1;
|
||||
}
|
||||
|
||||
function onRegister(sw) {
|
||||
sw.onstatechange = t.step_func(function() {
|
||||
if (sw.state !== 'activated')
|
||||
return;
|
||||
|
||||
sendMessagePort(sw, 'registering doc').onmessage = t.step_func(function (e) {
|
||||
assert_array_equals(e.data.events,
|
||||
['install', 'activate'],
|
||||
'Worker should see install then activate events');
|
||||
service_worker_unregister_and_done(t, scope);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue