summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_bug481560.js
blob: bb9249e755dfeafbd454c412ca97ba21316d3caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function test() {
  waitForExplicitFinish();

  whenNewWindowLoaded(null, function (win) {
    waitForFocus(function () {
      function onTabClose() {
        ok(false, "shouldn't have gotten the TabClose event for the last tab");
      }
      var tab = win.gBrowser.selectedTab;
      tab.addEventListener("TabClose", onTabClose, false);

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

      ok(win.closed, "accel+w closed the window immediately");

      tab.removeEventListener("TabClose", onTabClose, false);

      finish();
    }, win);
  });
}