summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/test/browser_toolbox_browsertoolbox_host.js
blob: 8efb7959ced17b53eb81636aac7ca6f56aa7af89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

const TEST_URL = "data:text/html,test browsertoolbox host";

add_task(async function () {
  const {
    Toolbox,
  } = require("resource://devtools/client/framework/toolbox.js");

  const tab = await addTab(TEST_URL);
  const options = { doc: document };
  const toolbox = await gDevTools.showToolboxForTab(tab, {
    hostType: Toolbox.HostType.BROWSERTOOLBOX,
    hostOptions: options,
  });

  is(toolbox.topWindow, window, "Toolbox is included in browser.xhtml");
  const iframe = document.querySelector(
    ".devtools-toolbox-browsertoolbox-iframe"
  );
  ok(iframe, "A toolbox iframe was created in the provided document");
  is(toolbox.doc, iframe.contentDocument, "Toolbox is in the custom iframe");

  await toolbox.destroy();
  iframe.remove();
});