tor-browser

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

browser_dbg-fission-frame-sources.js (1465B)


      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 TEST_COM_URI = `${URL_ROOT_COM_SSL}examples/doc_dbg-fission-frame-sources.html`;
      8 
      9 add_task(async function () {
     10  // Simply load a test page with a remote frame and wait for both sources to
     11  // be visible.
     12  // simple1.js is imported by the main page. simple2.js comes from the frame.
     13  const dbg = await initDebuggerWithAbsoluteURL(
     14    TEST_COM_URI,
     15    "simple1.js",
     16    "simple2.js"
     17  );
     18 
     19  const rootNodes = dbg.win.document.querySelectorAll(
     20    selectors.sourceTreeRootNode
     21  );
     22 
     23  info("Expands the main root node");
     24  await expandAllSourceNodes(dbg, rootNodes[0]);
     25 
     26  // We need to assert the actual DOM nodes in the source tree, because the
     27  // state can contain simple1.js and simple2.js, but only show one of them.
     28  info("Waiting for simple1.js from example.com (parent page)");
     29  await waitUntil(() => findSourceNodeWithText(dbg, "simple1.js"));
     30 
     31  is(
     32    rootNodes.length,
     33    2,
     34    "Found 2 sourceview root nodes when iframe has dedicated target"
     35  );
     36 
     37  info("Expands the remote frame root node");
     38  await expandAllSourceNodes(dbg, rootNodes[1]);
     39 
     40  info("Waiting for simple2.js from example.org (frame)");
     41  await waitUntil(() => findSourceNodeWithText(dbg, "simple2.js"));
     42 
     43  await dbg.toolbox.closeToolbox();
     44 });