tor-browser

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

prefetch-accept.html (974B)


      1 <!DOCTYPE html>
      2 <title>Ensures that prefetch works with documents</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/prefetch-helper.js"></script>
      8 <body>
      9 <script>
     10 
     11 promise_test(async t => {
     12    const {href, uid} = await prefetch({
     13        file: "prefetch-exec.html",
     14        type: "text/html",
     15        origin: document.origin});
     16    const popup = window.open(href + "&cache_bust=" + token());
     17    const remoteContext = new RemoteContext(uid);
     18    t.add_cleanup(() => popup.close());
     19    await remoteContext.execute_script(() => "OK");
     20    const results = await get_prefetch_info(href);
     21    assert_equals(results.length, 2);
     22    assert_equals(results[0].headers.accept, results[1].headers.accept);
     23 }, "Document prefetch should send the exact Accept header as navigation")
     24 
     25 </script>
     26 </body>