tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

register-closed-window.https.html (1187B)


      1 <!DOCTYPE html>
      2 <title>Service Worker: Register() on Closed Window</title>
      3 <meta name=timeout content=long>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="resources/testharness-helpers.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/common/get-host-info.sub.js"></script>
      8 <script src="resources/test-helpers.sub.js"></script>
      9 <body>
     10 <script>
     11 
     12 var host_info = get_host_info();
     13 var frameURL = host_info['HTTPS_ORIGIN'] + base_path() +
     14               'resources/register-closed-window-iframe.html';
     15 
     16 async_test(function(t) {
     17  var frame;
     18  with_iframe(frameURL).then(function(f) {
     19    frame = f;
     20    return new Promise(function(resolve) {
     21      window.addEventListener('message', function messageHandler(evt) {
     22        window.removeEventListener('message', messageHandler);
     23        resolve(evt.data);
     24      });
     25      frame.contentWindow.postMessage('START', '*');
     26    });
     27  }).then(function(result) {
     28    assert_equals(result, 'OK', 'frame should complete without crashing');
     29    frame.remove();
     30    t.done();
     31  }).catch(unreached_rejection(t));
     32 }, 'Call register() on ServiceWorkerContainer owned by closed window.');
     33 
     34 </script>
     35 </body>