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

  var gotTabAttrModified = false;
  var gotTabClose = false;

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

  function onTabAttrModified() {
    gotTabAttrModified = true;
  }

  tab.addEventListener("TabClose", onTabClose);

  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);
  tab.removeEventListener("TabAttrModified", onTabAttrModified);
});