Closed Bug 847309 Opened 12 years ago Closed 10 years ago

Internal exception when an add-on whose Widget was removed by the user unloads

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: u463949, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [Australis:M-])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0 Build ID: 20130227155931 Steps to reproduce: 1. Install the following add-on: var Widget = require("sdk/widget").Widget; exports.main = function() { Widget({ id: "widget-test", label: "widget test", content: "Test.", width: 50 }); } 2. Remove the add-on's widget from the add-on bar by dragging it to the palette. 3. Close Firefox Actual results: Internal exceptions in the SDK: ==================== error: widget: An exception occurred. TypeError: this._symbiont is null resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js 929 Traceback (most recent call last): File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/deprecated/errors.js", line 23, in return callback.apply(this, arguments); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/deprecated/window-utils.js", line 123, in observe this._unregWindow(window); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/deprecated/window-utils.js", line 98, in _unregWindow this._delegate.onUntrack(window); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 521, in browserManager_onUntrack this.items.forEach(function(i) i._onWindowClosed(window)); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 521, in this.items.forEach(function(i) i._onWindowClosed(window)); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 309, in _onWindowClosed view.destroy(); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 470, in WidgetView_destroy this._chrome.destroy(); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 929, in WC_destroy this._symbiont.destroy(); error: widget: An exception occurred. TypeError: this.node.parentNode is null resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js 927 Traceback (most recent call last): File "resource://gre/modules/XPIProvider.jsm", line 1685, in shutdownObserver BOOTSTRAP_REASONS.APP_SHUTDOWN); File "resource://gre/modules/XPIProvider.jsm", line 3742, in XPI_callBootstrapMethod this.bootstrapScopes[aId][aMethod](params, aReason); File "jar:file:///home/ove/.mozilla/firefox/3yqpwadl.default/extensions/jid1-Izhfvv5cR1Cgdg@jetpack.xpi!/bootstrap.js", line 229, in shutdown unload(loader, reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/toolkit/loader.js", line 368, in unload notifyObservers(subject, 'sdk:loader:destroy', reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/events.js", line 62, in data: data File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 77, in onunload unload(reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 56, in unload observers.forEach(function(observer) { File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 58, in observer(reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 67, in unloaders.slice().forEach(function(unloadWrapper) { File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 68, in unloadWrapper(reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/system/unload.js", line 41, in unloadWrapper originalDestructor.call(obj, reason); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 346, in destroy this._views[i].destroy(); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 470, in WidgetView_destroy this._chrome.destroy(); File "resource://jid1-izhfvv5cr1cgdg-at-jetpack/addon-sdk/lib/sdk/widget.js", line 927, in WC_destroy this.node.parentNode.removeChild(this.node); ==================== Also, the widget did not save its state and reappeared in the add-on bar after the browser was restarted. Expected results: No exceptions; the widget does not add itself to the add-on bar when the browser is started again.
Alex, can you take a look at this?
Flags: needinfo?(poirot.alex)
Priority: -- → P2
We are having yet another issue with the customization dialog, where some exception happens when we are trying to initialize widget iframe while the widget is detached from DOM in the toolbar palette... I'm on it. I already have a workaround patch, but I'd prefer to land a sane fix with some firefox tweaks.
Assignee: nobody → poirot.alex
Flags: needinfo?(poirot.alex)
Depends on: 854937
Depends on: 854962
Attached file Pull request 917
Here is a patch that uses bug 854962 new event to better handle user customization of widgets (when an item is moved across toolbar and moved to the palette) I need to do some more testing against bug 854962 patch before asking review, but feedback is much appreciated at any time.
Thank you for helping. This fixes the original problem, but when you access the widget (e.g. changing the icon) while it is in the palette, there is fallout: TypeError: this._symbiont is null resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/addon-sdk/lib/sdk/widget.js 703 Traceback (most recent call last): File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/addon-sdk/lib/sdk/timers.js", line 31, in notify callback.apply(null, args); File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/self-destructing-cookies/lib/main.js", line 108, in exports.realmain introduction: newInstall File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/self-destructing-cookies/lib/gui-desktop.js", line 86, in exports.setup for (var t in tabs) exports.handleTabChanged(tabs[t]); File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/self-destructing-cookies/lib/gui-desktop.js", line 162, in exports.handleTabChanged view.port.emit("icon", self.data.url("toolbar-r.png")); File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/addon-sdk/lib/sdk/widget.js", line 394, in self._chrome.update(self._baseWidget, "emit", arguments); File "resource://jid0-9xfbwuwnvpx4wwsfbwmcm4jj69e-at-jetpack/addon-sdk/lib/sdk/widget.js", line 703, in WC_update let port = this._symbiont.port; The widget is invisible after this until you restart the browser.
(In reply to Ove Soerensen from comment #4) > Thank you for helping. This fixes the original problem, but when you access > the widget (e.g. changing the icon) while it is in the palette, there is > fallout: > ... > The widget is invisible after this until you restart the browser. Thanks for testing the patch so quickly! I just pushed a new commit that should prevent this meaningless exception. But we may warn and throw a meaningfull error here, when you try to communicate with a widget that is hidden. Otherwise, this new commit will most likely not solve the invisible widget. I would imagine the main issue is that this SDK patch depends on bug 854962, that is in Firefox codebase and still not landed, so still not available in nightly.
From a purely egoistical point of view, I would find it most convenient if the widget would just ignore me while it is hidden :). Is it even possible for an add-on to determine if a widget is visible? There does not seem to be an obvious way, at least judging from the documentation. Anyway, great to see progress on this; kudos.
Looks like I won't have time to look at SDK bugs anymore.
Assignee: poirot.alex → nobody
Whiteboard: [Australis:M-]
Let's take a look at this again in triage.
Priority: P2 → --
widget is being removed.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: