tor-browser

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

no-proactive-swap-when-other-contexts-in-group.html (1515B)


      1 <!DOCTYPE html>
      2 <title>No proactive browsing context group changes when other contexts in group</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js"></script>
      8 
      9 <body>
     10 <script>
     11 
     12 promise_test(async t => {
     13  const rcHelper = new RemoteContextHelper();
     14  const rcPopup1 = await rcHelper.addWindow(undefined, { target: 'my_popup' });
     15 
     16  await rcPopup1.executeScript(() => {
     17    window.intendedTarget1 = true;
     18  });
     19  assert_true(window.open('', 'my_popup').intendedTarget1,
     20              'lookup by name');
     21 
     22  // There is no security reason (e.g. COOP) to change browsing context groups
     23  // for this navigation. Some implementations perform BCG swaps for performance
     24  // reasons, but they cannot do so in this case, as this test harness page and
     25  // the popup are in the same browsing context group.
     26  const rcPopup2 = await rcPopup1.navigateToNew();
     27 
     28  // In order to find the popup by name, the popup and this opener must be in
     29  // the same browsing context group.
     30  await rcPopup2.executeScript(() => {
     31    window.intendedTarget2 = true;
     32  });
     33  assert_true(window.open('', 'my_popup').intendedTarget2,
     34              'lookup by name after navigation');
     35 }, 'no proactive browsing context group change when other contexts in group');
     36 
     37 </script>
     38 </body>