https://github.com/web-platform-tests/wpt
Raw File
Tip revision: ea3771a0328f94e52d367ef169f037506e5d7812 authored by jgraham on 11 April 2018, 17:24:28 UTC
Update config.py
Tip revision: ea3771a
unregister.https.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>
async_test(function(t) {
    var scope = 'resources/scope/unregister-twice';
    var registration;
    navigator.serviceWorker.register('resources/empty-worker.js',
                                     {scope: scope})
      .then(function(r) {
          registration = r;
          return registration.unregister();
        })
      .then(function() {
          return registration.unregister();
        })
      .then(function(value) {
          assert_equals(value, false,
                        'unregistering twice should resolve with false');
          t.done();
        })
      .catch(unreached_rejection(t));
  }, 'Unregister twice');

async_test(function(t) {
    var scope = 'resources/scope/successful-unregister/';
    navigator.serviceWorker.register('resources/empty-worker.js',
                                     {scope: scope})
      .then(function(registration) {
          return registration.unregister();
        })
      .then(function(value) {
          assert_equals(value, true,
                        'unregistration should resolve with true');
          t.done();
        })
      .catch(unreached_rejection(t));
  }, 'Register then unregister');
</script>
back to top