summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_bug455852.js
blob: 567f655e9974ab9f823457928c4250db99cd591e (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
add_task(async function () {
  is(gBrowser.tabs.length, 1, "one tab is open");

  gBrowser.selectedBrowser.focus();
  isnot(
    document.activeElement,
    gURLBar.inputField,
    "location bar is not focused"
  );

  var tab = gBrowser.selectedTab;
  Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);

  EventUtils.synthesizeKey("w", { accelKey: true });

  is(tab.parentNode, null, "ctrl+w removes the tab");
  is(gBrowser.tabs.length, 1, "a new tab has been opened");
  is(
    document.activeElement,
    gURLBar.inputField,
    "location bar is focused for the new tab"
  );

  if (Services.prefs.prefHasUserValue("browser.tabs.closeWindowWithLastTab")) {
    Services.prefs.clearUserPref("browser.tabs.closeWindowWithLastTab");
  }
});