summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_bug596687.js
blob: 5c2b4fbfe25e671df18d96a8caaee1edeecc6fe0 (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
add_task(function* test() {
  var tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);

  var gotTabAttrModified = false;
  var gotTabClose = false;

  function onTabClose() {
    gotTabClose = true;
    tab.addEventListener("TabAttrModified", onTabAttrModified, false);
  }

  function onTabAttrModified() {
    gotTabAttrModified = true;
  }

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

  yield BrowserTestUtils.removeTab(tab);

  ok(gotTabClose, "should have got the TabClose event");
  ok(!gotTabAttrModified, "shouldn't have got the TabAttrModified event after TabClose");

  tab.removeEventListener("TabClose", onTabClose, false);
  tab.removeEventListener("TabAttrModified", onTabAttrModified, false);
});