Skip to content

Commit

Permalink
Merge pull request mozilla#425 from ochameau/bug/751546-fix-tab-utils…
Browse files Browse the repository at this point in the history
…-dead-object

Bug 751546: Fix "dead object" exception in api-utils/tab/observer. r=@Gozala
  • Loading branch information
ochameau committed May 3, 2012
2 parents 35cf82a + 9ef15ef commit 61165fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/api-utils/lib/tabs/observer.js
Expand Up @@ -71,6 +71,12 @@ windowObserver.on("open", onWindowOpen);

function onWindowClose(chromeWindow) {
if (!isBrowser(chromeWindow)) return; // Ignore if it's not a browser window.
// Bug 751546: Emit `deactivate` event on window close immediatly
// Otherwise we are going to face "dead object" exception on `select` event
if (getActiveTab(chromeWindow) == selectedTab) {
observer._emit("deactivate", selectedTab);
selectedTab = null;
}
getTabContainers(chromeWindow).forEach(function (container) {
observer.ignore(container);
});
Expand Down

0 comments on commit 61165fc

Please sign in to comment.