Closed
Bug 660880
Opened 13 years ago
Closed 13 years ago
WidgetViews are not destroyed on window close
Categories
(Add-on SDK Graveyard :: General, defect, P1)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
1.0
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
Attachments
(1 file, 1 obsolete file)
5.72 KB,
patch
|
irakli
:
review+
|
Details | Diff | Splinter Review |
I think title is quite explicit. WidgetView doesn't dispatch 'detach' event nor is destroyed when a browser window is closed.
Assignee | ||
Updated•13 years ago
|
Attachment #536333 -
Flags: review?(rFobic)
Updated•13 years ago
|
Priority: -- → P1
Target Milestone: --- → 1.0
Comment 3•13 years ago
|
||
Comment on attachment 536333 [details] [diff] [review] Fix this and add a test Review of attachment 536333 [details] [diff] [review]: ----------------------------------------------------------------- Just a small readability issues. ::: packages/addon-kit/lib/widget.js @@ +320,5 @@ > this._views.splice(idx, 1); > }, > > + // Called on browser window closed, to destroy related views > + _onWindowClosed: function _onWindowClosed(window) { Please either comment why it should be backwards or use `for (let element in array)` which is easier to read. @@ +322,5 @@ > > + // Called on browser window closed, to destroy related views > + _onWindowClosed: function _onWindowClosed(window) { > + for (let i = this._views.length - 1; i >= 0; i--) { > + let view = this._views[i]; I assume you're trying to find a view associated for that window. In that case can you please factor that out into separate function `getWindowView(window, views)` or similar. That would be much easier to understand and maintain.
Attachment #536333 -
Flags: review?(rFobic) → review-
Assignee | ||
Comment 4•13 years ago
|
||
Actually it is not justified in this case to go backward. I badly copy paste loop code from a piece of code that has to go backward and where this behavior is commented. So I just use regular loop and added some additional comment. myk: I'm more concerned about bug and addon breakage on window close than the leak. The leak is not that big as document should be destroyed, so we may end up with unecessary SDK WidgetViews objects. But what is really wrong with this bug is that when a window is closed and addon code use widget.postMessage or widget.port.emit, it will throw an exception and avoid next widget on following windows to receive the event/message.
Assignee: nobody → poirot.alex
Attachment #536333 -
Attachment is obsolete: true
Attachment #536616 -
Flags: review?(rFobic)
Comment 5•13 years ago
|
||
Comment on attachment 536616 [details] [diff] [review] Use regular loop and add some comments. Review of attachment 536616 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, thanks! Make sure to get a+ as well ;)
Attachment #536616 -
Flags: review?(rFobic) → review+
Comment 6•13 years ago
|
||
Comment on attachment 536616 [details] [diff] [review] Use regular loop and add some comments. a=myk for landing during freeze.
Assignee | ||
Comment 7•13 years ago
|
||
Landed: https://github.com/mozilla/addon-sdk/commit/22687408a3f46b8a2facadc51e5304d830cf19ce
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Whiteboard: [triage:followup]
You need to log in
before you can comment on or make changes to this bug.
Description
•