summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/browser/browser_toolbox_swap_inspector.js
blob: a5262eeec5b594d67fd2320c020b3f457291cdf2 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Verify that inspector does not reboot when opening and closing RDM.

const TEST_URL = "http://example.com/";

const checkToolbox = async function (tab, location) {
  const toolbox = gDevTools.getToolboxForTab(tab);
  ok(!!toolbox, `Toolbox exists ${location}`);
};

addRDMTask(
  "",
  async function () {
    const tab = await addTab(TEST_URL);

    info("Open toolbox outside RDM");
    {
      const { toolbox, inspector } = await openInspector();
      inspector.walker.once("new-root", () => {
        ok(false, "Inspector saw new root, would reboot!");
      });
      checkToolbox(tab, "outside RDM");
      await openRDM(tab);
      checkToolbox(tab, "after opening RDM");
      await closeRDM(tab);
      checkToolbox(tab, tab.linkedBrowser, "after closing RDM");
      await toolbox.destroy();
    }

    info("Open toolbox inside RDM");
    {
      const { ui } = await openRDM(tab);
      const { toolbox, inspector } = await openInspector();
      inspector.walker.once("new-root", () => {
        ok(false, "Inspector saw new root, would reboot!");
      });
      checkToolbox(tab, ui.getViewportBrowser(), "inside RDM");
      await closeRDM(tab);
      checkToolbox(tab, tab.linkedBrowser, "after closing RDM");
      await toolbox.destroy();
    }

    await removeTab(tab);
  },
  { onlyPrefAndTask: true }
);