tor-browser

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

performance-navigation-timing-attributes.tentative.window.js (1846B)


      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: script=/websockets/constants.sub.js
      9 // META: timeout=long
     10 
     11 'use strict';
     12 
     13 // Ensure that empty attributes are reported as empty strings and missing
     14 // attributes are reported as null.
     15 promise_test(async t => {
     16  const rcHelper = new RemoteContextHelper();
     17  // Open a window with noopener so that BFCache will work.
     18  const rc1 = await rcHelper.addWindow(
     19      /*config=*/ null, /*options=*/ {features: 'noopener'});
     20  const rc1_url = await rc1.executeScript(() => {
     21    return location.href;
     22  });
     23  // Add a cross-origin iframe.
     24  const rc1_child = await rc1.addIframe(
     25      /*extraConfig=*/ {
     26        origin: 'HTTP_REMOTE_ORIGIN',
     27        scripts: [],
     28        headers: [],
     29      },
     30      /*attributes=*/ {id: '', name: ''},
     31  );
     32  // Use WebSocket to block BFCache.
     33  await useWebSocket(rc1);
     34  const rc1_child_url = await rc1_child.executeScript(() => {
     35    return location.href;
     36  });
     37  // Check the BFCache result and the reported reasons.
     38  await assertBFCacheEligibility(rc1, /*shouldRestoreFromBFCache=*/ false);
     39  await assertNotRestoredReasonsEquals(
     40      rc1,
     41      /*url=*/ rc1_url,
     42      /*src=*/ null,
     43      /*id=*/ null,
     44      /*name=*/ null,
     45      /*reasons=*/[{'reason': 'websocket'}],
     46      /*children=*/[{
     47        'url': null,
     48        'src': rc1_child_url,
     49        // Id and name should be empty.
     50        'id': '',
     51        'name': '',
     52        'reasons': null,
     53        'children': null
     54      }]);
     55 });