Closed Bug 839990 Opened 11 years ago Closed 11 years ago

(tabs) Calling tab.destroy() twice causes an error

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: evold, Unassigned)

References

Details

I get the following error when I call tab.destroy() twice 

TypeError: tab is null
resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/tabs/utils.js 146
Traceback (most recent call last):
  File "chrome://browser/content/browser.xul", line 1, in oncommand
    <?xml version="1.0"?>
  File "chrome://browser/content/browser.js", line 9161, in BrowserOpenTab
    openUILinkIn(BROWSER_NEW_TAB_URL, "tab");
  File "chrome://browser/content/utilityOverlay.js", line 206, in openUILinkIn
    openLinkIn(url, where, params);
  File "chrome://browser/content/utilityOverlay.js", line 318, in openLinkIn
    isUTF8: aIsUTF8});
  File "chrome://browser/content/tabbrowser.xml", line 1130, in loadOneTab
    isUTF8: aIsUTF8});
  File "chrome://browser/content/tabbrowser.xml", line 1374, in addTab
    t.dispatchEvent(evt);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/tabs/observer.js", line 49, in handleEvent
    this._emit(EVENTS[event.type], event.target, event);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 123, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 153, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/windows/tabs-firefox.js", line 105, in _onTabEvent
    this._emitEvent(type, wrappedTab);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/windows/tabs-firefox.js", line 110, in _emitEvent
    tabs._emit(type, tab);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 123, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 153, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/test-addon/lib/main.js", line 8, in 
    tab.destroy();
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/tabs/tab-firefox.js", line 60, in destroy
    this._browser.removeEventListener(EVENTS.ready.dom, this._onReady, true);
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/tabs/tab-firefox.js", line 86, in TabTrait<._browser
    get _browser() getBrowserForTab(this._tab),
  File "resource://jid1-rysibkibbbgqbg-at-jetpack/addon-sdk/lib/sdk/tabs/utils.js", line 146, in getBrowserForTab
    if (tab.browser) // fennec
Also see https://github.com/mozilla/addon-sdk/commit/b06eb5ba5d95fa7c2ccfb916ed7a4bc388579a9a#commitcomment-2597436 basically the `TABS.splice(TABS.indexOf(this), 1);` would cause other breakage if the error above didn't happen first..
Summary: Calling tab.destroy() twice causes an error → (tabs) Calling tab.destroy() twice causes an error
Fixed by bug 833783:
https://github.com/mozilla/addon-sdk/commit/435be058081ce064eaa574e3d0d2f1a83e29fca7
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.