tor-browser

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

performance-navigation-timing-bfcache.tentative.window.js (1115B)


      1 // META: title=RemoteContextHelper navigation using BFCache
      2 // META: script=./test-helper.js
      3 // META: script=/common/dispatcher/dispatcher.js
      4 // META: script=/common/get-host-info.sub.js
      5 // META: script=/common/utils.js
      6 // META: script=/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js
      7 // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js
      8 // META: timeout=long
      9 
     10 'use strict';
     11 
     12 // Ensure that notRestoredReasons is empty for successful BFCache restore.
     13 promise_test(async t => {
     14  const rcHelper = new RemoteContextHelper();
     15 
     16  // Open a window with noopener so that BFCache will work.
     17  const rc1 = await rcHelper.addWindow(
     18      /*config=*/ null, /*options=*/ {features: 'noopener'});
     19 
     20  // Check the BFCache result and verify that no reasons are recorded
     21  // for successful restore.
     22  await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ true);
     23  assert_true(await rc1.executeScript(() => {
     24    let reasons =
     25        performance.getEntriesByType('navigation')[0].notRestoredReasons;
     26    return reasons === null;
     27  }));
     28 });