tor-browser

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

main-frame-navigation.https.html (1316B)


      1 <!DOCTYPE html>
      2 <title>Test about: main frame navigation in a prerendered page</title>
      3 <meta name="timeout" content="long">
      4 <script src="/common/utils.js"></script>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="../resources/utils.js"></script>
      8 <script src="resources/utils.js"></script>
      9 
     10 <body>
     11 <script>
     12 setup(() => assertSpeculationRulesIsSupported());
     13 
     14 promise_test(async t => {
     15  const uid = token();
     16  const bc = new PrerenderChannel('result', uid);
     17 
     18  const gotMessage = new Promise(resolve => {
     19    bc.addEventListener('message', e => {
     20      resolve(e.data);
     21    }, {
     22      once: true
     23    });
     24  });
     25 
     26  const url = `resources/main-frame-navigation.html?uid=${uid}`;
     27  window.open(url, '_blank', 'noopener');
     28 
     29  const result = await gotMessage;
     30 
     31  assert_equals(result.onprerenderingchangeCalled, true,
     32      'prerenderingchange event should be called after activation.');
     33  assert_equals(result.prerenderingValueBeforeActivation, true,
     34      'document.prerendering should be true prior to activation.');
     35  assert_equals(result.prerenderingValueAfterActivation, false,
     36      'document.prerendering should be false after activation.');
     37 }, 'Test document.prerendering and prerenderingchange event in the navigated ' +
     38   'page');
     39 </script>