summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_destroy-before-ready.js
blob: efc17ec57c57b752b5c82cc7a5b442ffe9c00713 (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
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test that switching to the inspector panel and not waiting for it to be fully
// loaded doesn't fail the test with unhandled rejected promises.

add_task(async function() {
  // At least one assertion is needed to avoid failing the test, but really,
  // what we're interested in is just having the test pass when switching to the
  // inspector.
  ok(true);

  await addTab("data:text/html;charset=utf-8,test inspector destroy");

  info("Open the toolbox on the debugger panel");
  const target = await TargetFactory.forTab(gBrowser.selectedTab);
  const toolbox = await gDevTools.showToolbox(target, "jsdebugger");

  info("Switch to the inspector panel and immediately end the test");
  const onInspectorSelected = toolbox.once("inspector-selected");
  toolbox.selectTool("inspector");
  await onInspectorSelected;
});