Closed
Bug 1183848
Opened 9 years ago
Closed 9 years ago
BrowserElementParent leaks forever via mozfullscreenchange listener
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
People
(Reporter: khuey, Assigned: xidorn)
References
Details
(Keywords: memory-leak)
Attachments
(1 file, 2 obsolete files)
4.72 KB,
patch
|
khuey
:
review+
|
Details | Diff | Splinter Review |
http://hg.mozilla.org/mozilla-central/diff/447b220d7c55/dom/browser-element/BrowserElementParent.js#l1.30 replaced a weakly held observer service listener with a strongly held DOM event listener. That event listener never gets removed, which causes every BrowserElementParent to be leaked forever.
Assignee | ||
Comment 1•9 years ago
|
||
I'm not quite sure how to confirm whether the leakage is fixed with this patch. Kyle, could you verify that?
Flags: needinfo?(khuey)
Attachment #8633861 -
Flags: review?(bugs)
Reporter | ||
Comment 2•9 years ago
|
||
The data came out of a Firefox OS about:memory dump in bug 1183361, so I can't verify it either. It would be easy to do with a b2g phone though (just use it for a while and see how high the orphan-nodes amount in the parent process gets).
Flags: needinfo?(khuey)
Comment 3•9 years ago
|
||
Comment on attachment 8633861 [details] [diff] [review] patch unload is not dispatched to document, so unless you're trying to catch some other unload happening elsewhere in the tree, this isn't right.
Attachment #8633861 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8633861 -
Attachment is obsolete: true
Attachment #8635073 -
Flags: review?(khuey)
Attachment #8635073 -
Flags: review?(bugs)
Comment 5•9 years ago
|
||
Comment on attachment 8635073 [details] [diff] [review] patch So Bug 899354 added nondeterministicGetWeakMapKeys usage. Hmm, technically we really should use addSystemEventListener to add the listener. And the old code had a bug that if one removed all the browser-parents, the listener was removed, but this._window._browserElementParents was still there. So, if you use addSystemEventListener, and not the normal addEventListener this should be fine. But khuey should definitely look at this too, given he reviewed Bug 899354
Attachment #8635073 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8635073 -
Attachment is obsolete: true
Attachment #8635073 -
Flags: review?(khuey)
Attachment #8635849 -
Flags: review?(khuey)
Reporter | ||
Comment 7•9 years ago
|
||
I don't understand why it is ok to not remove the event listener?
Flags: needinfo?(quanxunzhen)
Assignee | ||
Comment 8•9 years ago
|
||
The listeners won't live longer than the window object, since they are only referenced by it. And since one window has at most one set of listeners, even if multiple BrowserElementParents are created on a same window, the number of listeners won't increase.
Flags: needinfo?(quanxunzhen)
Reporter | ||
Comment 9•9 years ago
|
||
Comment on attachment 8635849 [details] [diff] [review] patch, r=smaug Review of attachment 8635849 [details] [diff] [review]: ----------------------------------------------------------------- ok. I still haven't actually tested this though ... ::: dom/browser-element/BrowserElementParent.js @@ +112,5 @@ > + let els = Cc["@mozilla.org/eventlistenerservice;1"] > + .getService(Ci.nsIEventListenerService); > + for (let event of windowEvents) { > + els.addSystemEventListener(this._window, event, handler, > + /* useCapture = */ true); I'm assuming that swapping visibilitychange to use the system event listener and useCapture=true won't break anything ...
Attachment #8635849 -
Flags: review?(khuey) → review+
Comment 11•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fda440fa9aa1
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Assignee | ||
Comment 13•9 years ago
|
||
I don't think we are using browser element anywhere other than Firefox OS, hence it doesn't seem to be necessary to uplift the patch.
Flags: needinfo?(quanxunzhen)
Updated•9 years ago
|
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•