blob: 451acdd6561b0e6fd581c4568289c36b23393799 [file] [log] [blame]
<!doctype html>
<meta charset="utf-8">
<title>Background Sync API: Don't crash while stopping service worker.</title>
<script src="../../resources/permissions-helper.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../serviceworker/resources/test-helpers.js"></script>
<script>
promise_test(function(t) {
var url = 'resources/stop-worker-no-crash-worker.js';
var scope = 'resources/stop-worker-no-crash-iframe.html';
var registration;
return PermissionsHelper.setPermission('periodic-background-sync', 'granted')
.then(_ => service_worker_unregister_and_register(t, url, scope))
.then(reg => {
registration = reg;
return wait_for_state(t, registration.installing, 'activated');
})
.then(_ => registration.periodicSync.register('periodic', { minInterval: 1000 }))
.then(_ => internals.terminateServiceWorker(registration.active))
.then(_ => with_iframe(scope)) // Check the sanity of the SW.
.then(_ => service_worker_unregister(t, scope));
}, 'Background Sync API with registered periodic sync tasks should not ' +
'crash while stopping service worker');
</script>