blob: e52adfa37800853a86da9f5f30bc0dd41e4afcb6 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests for importScripts: redirect</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
promise_test(async t => {
const scope = 'resources/import-scripts-redirect';
await service_worker_unregister(t, scope);
let reg = await navigator.serviceWorker.register(
'resources/import-scripts-redirect-worker.js', { scope: scope });
assert_not_equals(reg.installing, null, 'worker is installing');
await reg.unregister();
}, 'importScripts() supports redirects');
promise_test(async t => {
const scope = 'resources/import-scripts-redirect';
await service_worker_unregister(t, scope);
let reg = await navigator.serviceWorker.register(
'resources/import-scripts-redirect-worker.js', { scope: scope });
assert_not_equals(reg.installing, null, 'worker is installing');
await wait_for_state(t, reg.installing, 'activated');
await Promise.all([
wait_for_update(t, reg),
reg.update()
]);
assert_not_equals(reg.installing, null, 'worker is installing');
await reg.unregister();
}, 'importScripts() supports redirects and can be updated');
</script>
</body>