tor-browser

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

browser_toolbox_browsertoolbox_host.js (868B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 const TEST_URL = "data:text/html,test browsertoolbox host";
      5 
      6 add_task(async function () {
      7  const {
      8    Toolbox,
      9  } = require("resource://devtools/client/framework/toolbox.js");
     10 
     11  const tab = await addTab(TEST_URL);
     12  const options = { doc: document };
     13  const toolbox = await gDevTools.showToolboxForTab(tab, {
     14    hostType: Toolbox.HostType.BROWSERTOOLBOX,
     15    hostOptions: options,
     16  });
     17 
     18  is(toolbox.topWindow, window, "Toolbox is included in browser.xhtml");
     19  const iframe = document.querySelector(
     20    ".devtools-toolbox-browsertoolbox-iframe"
     21  );
     22  ok(iframe, "A toolbox iframe was created in the provided document");
     23  is(toolbox.doc, iframe.contentDocument, "Toolbox is in the custom iframe");
     24 
     25  await toolbox.destroy();
     26  iframe.remove();
     27 });