summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-tabs.js
blob: 08485beecc4de96ca617893e34407461609a53b5 (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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

// Tests adding and removing tabs

"use strict";

add_task(async function () {
  const dbg = await initDebugger(
    "doc-scripts.html",
    "simple1.js",
    "simple2.js"
  );

  await selectSource(dbg, "simple1.js");
  await selectSource(dbg, "simple2.js");
  is(countTabs(dbg), 2);

  info("Test reloading the debugger");
  await reload(dbg, "simple1.js", "simple2.js");
  await waitForSelectedSource(dbg, "simple2.js");
  is(countTabs(dbg), 2);

  info("Test reloading the debuggee a second time");
  await reload(dbg, "simple1.js", "simple2.js");
  await waitForSelectedSource(dbg, "simple2.js");
  is(countTabs(dbg), 2);
});

add_task(async function () {
  const dbg = await initDebugger(
    "doc-scripts.html",
    "simple1.js",
    "simple2.js"
  );

  await selectSource(dbg, "simple1.js");
  await selectSource(dbg, "simple2.js");
  await closeTab(dbg, "simple1.js");
  await closeTab(dbg, "simple2.js");

  info("Test reloading the debugger");
  await reload(dbg, "simple1.js", "simple2.js");
  is(countTabs(dbg), 0);
});