tor-browser

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

resources-with-0x00-in-header.window.js (1551B)


      1 // META: script=/common/get-host-info.sub.js
      2 
      3 async_test(t => {
      4  const script = document.createElement("script");
      5  t.add_cleanup(() => script.remove());
      6  script.src = "resources/script-with-0x00-in-header.py";
      7  script.onerror = t.step_func_done();
      8  script.onload = t.unreached_func();
      9  document.body.append(script);
     10 }, "Expect network error for script with 0x00 in a header");
     11 
     12 async_test(t => {
     13  const frame = document.createElement("iframe");
     14  t.add_cleanup(() => frame.remove());
     15  frame.src = "resources/document-with-0x00-in-header.py";
     16  // If network errors result in load events for frames per
     17  // https://github.com/whatwg/html/issues/125 and https://github.com/whatwg/html/issues/1230 this
     18  // should be changed to use the load event instead.
     19  t.step_timeout(() => {
     20    assert_equals(window.frameLoaded, undefined);
     21    t.done();
     22  }, 1000);
     23  document.body.append(frame);
     24 }, "Expect network error for frame navigation to resource with 0x00 in a header");
     25 
     26 async_test(t => {
     27  const img = document.createElement("img");
     28  t.add_cleanup(() => img.remove());
     29  img.src = "resources/blue-with-0x00-in-a-header.asis";
     30  img.onerror = t.step_func_done();
     31  img.onload = t.unreached_func();
     32  document.body.append(img);
     33 }, "Expect network error for image with 0x00 in a header");
     34 
     35 promise_test(async t => {
     36  return promise_rejects_js(t, TypeError, fetch(get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/h1-parsing/resources/blue-with-0x00-in-a-header.asis", {mode:"no-cors"}));
     37 }, "Expect network error for fetch with 0x00 in a header");