tor-browser

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

head.js (1321B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const EXAMPLE_PARENT_ROOT = getRootDirectory(gTestPath).replace(
      8  "chrome://mochitests/content",
      9  "https://example.net"
     10 );
     11 const EXAMPLE_FRAME_ROOT = getRootDirectory(gTestPath).replace(
     12  "chrome://mochitests/content",
     13  "https://example.org"
     14 );
     15 
     16 const FRAMEBUSTING_PARENT_URL =
     17  EXAMPLE_PARENT_ROOT + "framebusting_intervention_parent.html";
     18 const FRAMEBUSTING_FRAME_URL =
     19  EXAMPLE_FRAME_ROOT + "framebusting_intervention_frame.html";
     20 
     21 async function triggerFramebustingIntervention(tab) {
     22  info("Loading framebusting parent page...");
     23  BrowserTestUtils.startLoadingURIString(
     24    tab.linkedBrowser,
     25    FRAMEBUSTING_PARENT_URL
     26  );
     27  await BrowserTestUtils.browserLoaded(
     28    tab.linkedBrowser,
     29    /*includeSubFrames=*/ false,
     30    FRAMEBUSTING_PARENT_URL
     31  );
     32 
     33  info("Loading framebusting frame page...");
     34  await SpecialPowers.spawn(
     35    tab.linkedBrowser,
     36    [FRAMEBUSTING_FRAME_URL],
     37    src => {
     38      const iframe = content.document.createElement("iframe");
     39      iframe.id = "framebustingframe";
     40      iframe.src = src;
     41      content.document.body.appendChild(iframe);
     42    }
     43  );
     44 }