tor-browser

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

fetch-request-xhr-sync-error.https.window.js (1023B)


      1 // META: script=resources/test-helpers.sub.js
      2 
      3 "use strict";
      4 
      5 promise_test(async t => {
      6  const url = "resources/fetch-request-xhr-sync-error-worker.js";
      7  const scope = "resources/fetch-request-xhr-sync-iframe.html";
      8 
      9  const registration = await service_worker_unregister_and_register(t, url, scope);
     10  t.add_cleanup(() => registration.unregister());
     11 
     12  await wait_for_state(t, registration.installing, 'activated');
     13  const frame = await with_iframe(scope);
     14  t.add_cleanup(() => frame.remove());
     15 
     16  assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-1.txt"));
     17  assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-2.txt"));
     18  assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-3.txt"));
     19 }, "Verify synchronous XMLHttpRequest always throws a NetworkError for ReadableStream errors");