blob: c6e06f8175398cbdebd86d51b6e7c657cec4326b [file] [log] [blame]
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
</head>
<body>
<script>
promise_test(async (test) => {
const registration = await navigator.serviceWorker.register("skipFetchEvent-worker.js", { scope : 'resources' });
activeWorker = registration.active;
if (activeWorker)
return;
activeWorker = registration.installing;
await new Promise(resolve => {
activeWorker.addEventListener('statechange', () => {
if (activeWorker.state === "activated")
resolve();
});
});
}, "Register service worker");
promise_test(async (test) => {
worker = new Worker('resources/controlled-worker.js');
const event = await new Promise(resolve => worker.onmessage = resolve);
assert_true(event.data.isControlled);
}, "Verify dedicated worker is controlled");
</script>
</body>
</html>