https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 1c347c1bcbe13cec655b8487ff2c67f0232bdc90 authored by Luke Bjerring on 29 March 2018, 14:49:12 UTC
Check inherited interfaces exist
Tip revision: 1c347c1
import-scripts-redirect.https.html
<!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>
back to top