testing/web-platform/mozilla/tests/service-workers/service-worker/register-closed-window.https.html
author Ben Kelly <ben@wanderview.com>
Fri, 06 Nov 2015 06:58:04 -0800
changeset 291484 77e2c8fab108b4804defcc5816e93815ed6cf41b
parent 291483 17c4936c9a0ee82f7ac3f7c1392ce619170419ab
permissions -rw-r--r--
Bug 1221351 - P3 Fix test name in register-closed-window.https.html. a=testonly

<!DOCTYPE html>
<title>Service Worker: Register() on Closed Window</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="resources/testharness-helpers.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/get-host-info.sub.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>

var host_info = get_host_info();
var frameURL = host_info['HTTPS_ORIGIN'] + base_path() +
               'resources/register-closed-window-iframe.html';

async_test(function(t) {
  var frame;
  with_iframe(frameURL).then(function(f) {
    frame = f;
    return new Promise(function(resolve) {
      window.addEventListener('message', function messageHandler(evt) {
        window.removeEventListener('message', messageHandler);
        resolve(evt.data);
      });
      frame.contentWindow.postMessage('START', '*');
    });
  }).then(function(result) {
    assert_equals(result, 'OK', 'frame should complete without crashing');
    frame.remove();
    t.done();
  }).catch(unreached_rejection(t));
}, 'Call register() on ServiceWorkerContainer owned by closed window.');

</script>
</body>