tor-browser

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

inline-speculation-rules-after-stylesheet.https.html (925B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/utils.js"></script>
      5 <script src="/common/dispatcher/dispatcher.js"></script>
      6 <script src="../resources/utils.js"></script>
      7 <script src="resources/utils.sub.js"></script>
      8 <link rel="stylesheet" href="/css/cssom/support/black.css">
      9 
     10 <body>
     11 <script type="speculationrules">
     12 {
     13  "prefetch": [{
     14    "where": { "href_matches": "*prefetch.py*" },
     15    "eagerness":"immediate"
     16  }]
     17 }
     18 </script>
     19 
     20 <script>
     21  setup(() => assertSpeculationRulesIsSupported());
     22 
     23  promise_test(async t => {
     24    const url = getPrefetchUrl();
     25    addLink(url);
     26 
     27    await new Promise(resolve => t.step_timeout(resolve, 2000));
     28 
     29    assert_equals(await isUrlPrefetched(url), 1, 'URL should be prefetched');
     30  }, 'Inline speculation rules script after an external stylesheet should work');
     31 
     32 </script>
     33 </body>
     34 </html>