tor-browser

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

back-forward-cache-with-closed-webrtc-connection-ccns.https.tentative.window.js (1267B)


      1 // META: title=Testing BFCache support for page with closed WebRTC connection and "Cache-Control: no-store" header.
      2 // META: script=/common/dispatcher/dispatcher.js
      3 // META: script=/common/utils.js
      4 // META: script=/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js
      5 // META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js
      6 // META: script=resources/webrtc-test-helpers.sub.js
      7 
      8 'use strict';
      9 
     10 promise_test(async t => {
     11  const rcHelper = new RemoteContextHelper();
     12 
     13  // Open a window with noopener so that BFCache will work.
     14  const rc1 = await rcHelper.addWindow(
     15    /*config=*/ { headers: [['Cache-Control', 'no-store']] },
     16    /*options=*/ { features: 'noopener' }
     17  );
     18  // Make sure that we only run the remaining of the test when page with
     19  // "Cache-Control: no-store" header is eligible for BFCache.
     20  await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ true);
     21 
     22  await openThenCloseWebRTC(rc1);
     23  // The page should not be eligible for BFCache because of the usage
     24  // of WebRTC.
     25  await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ false);
     26  await assertNotRestoredFromBFCache(rc1, [
     27    'WebRTCSticky',
     28    'MainResourceHasCacheControlNoStore'
     29  ]);
     30 });