tor-browser

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

fetch-event-respond-with-stops-propagation.https.html (1346B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/test-helpers.sub.js"></script>
      5 <script>
      6 promise_test(function(t) {
      7    var script =
      8        'resources/fetch-event-respond-with-stops-propagation-worker.js';
      9    var scope = 'resources/simple.html';
     10 
     11    return service_worker_unregister_and_register(t, script, scope)
     12      .then(function(registration) {
     13          t.add_cleanup(function() {
     14              return service_worker_unregister(t, scope);
     15            });
     16 
     17          return wait_for_state(t, registration.installing, 'activated');
     18        })
     19      .then(function() {
     20          return with_iframe(scope);
     21        })
     22      .then(function(frame) {
     23          t.add_cleanup(function() { frame.remove(); });
     24          var channel = new MessageChannel();
     25          var saw_message = new Promise(function(resolve) {
     26              channel.port1.onmessage = function(e) { resolve(e.data); }
     27            });
     28          var worker = frame.contentWindow.navigator.serviceWorker.controller;
     29 
     30          worker.postMessage({port: channel.port2}, [channel.port2]);
     31          return saw_message;
     32        })
     33      .then(function(message) {
     34          assert_equals(message, 'PASS');
     35        })
     36  }, 'respondWith() invokes stopImmediatePropagation()');
     37 </script>