tor-browser

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

fetch-event-network-error.https.html (1330B)


      1 <!DOCTYPE html>
      2 <title>Service Worker: Fetch event network error</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="resources/test-helpers.sub.js"></script>
      6 <script>
      7 var resolve_test_done;
      8 
      9 var test_done_promise = new Promise(function(resolve) {
     10    resolve_test_done = resolve;
     11  });
     12 
     13 // Called by the child frame.
     14 function notify_test_done(result) {
     15  resolve_test_done(result);
     16 }
     17 
     18 promise_test(function(t) {
     19    var scope = 'resources/fetch-event-network-error-controllee-iframe.html';
     20    var script = 'resources/fetch-event-network-error-worker.js';
     21    var frame;
     22 
     23    return service_worker_unregister_and_register(t, script, scope)
     24      .then(function(registration) {
     25          t.add_cleanup(function() {
     26              return service_worker_unregister(t, scope);
     27            });
     28 
     29          return wait_for_state(t, registration.installing, 'activated');
     30        })
     31      .then(function() {
     32          return with_iframe(scope);
     33        })
     34      .then(function(f) {
     35          frame = f;
     36          return test_done_promise;
     37        })
     38      .then(function(result) {
     39          frame.remove();
     40          assert_equals(result, 'PASS');
     41        });
     42  }, 'Rejecting the fetch event or using preventDefault() causes a network ' +
     43     'error');
     44 </script>