Closed Bug 1194270 Opened 9 years ago Closed 9 years ago

Tell the cycle collector about more fields of nsGlobalWindow

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

Details

Attachments

(1 file)

It looks like this should have happened back in bug 808612.
I just looked at all the fields, and there are some more that should be added to the traverse/unlink methods.
Summary: Tell the cycle collector about nsGlobalWindow::mLocation → Tell the cycle collector about more fields of nsGlobalWindow
Kyle, I noticed that nsGlobalWindow::mIndexedDB is not traversed or unlinked. Should I add it? There's a bunch of IDB classes that traverse but don't unlink IDBFactory for some reason, so maybe I could do that here, too?
Flags: needinfo?(khuey)
I also filed bug 1194322 for a couple of wake lock fields that aren't being reported to the CC.
(In reply to Andrew McCreight [:mccr8] from comment #2)
> Kyle, I noticed that nsGlobalWindow::mIndexedDB is not traversed or
> unlinked. Should I add it? There's a bunch of IDB classes that traverse but
> don't unlink IDBFactory for some reason, so maybe I could do that here, too?

Hmm ... I guess it doesn't leak because FreeInnerObjects clears mIndexedDB?  Not sure if we need to bother CCing it or not in that case.
Flags: needinfo?(khuey)
The IDB classes traversing but not unlinking stuff is expected.  IDB unlink methods are designed to create an acyclic graph, not a completely disconnected graph.  That allows us to use certain pointers during cleanup without having to null check them constantly.
try looks green: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d47fa561ec04

Based on your comment, it sounds like it is okay to null out the IDB field, because presumably IDB won't be going through the window.

Also, remove what looks like an obsolete pre-cycle-collector comment about cyclical ownership.
Attachment #8652465 - Flags: review?(khuey)
Comment on attachment 8652465 [details] [diff] [review]
Tell the cycle collector about more fields of nsGlobalWindow.

Review of attachment 8652465 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsGlobalWindow.h
@@ -1634,5 @@
> -  // through JavaScript.  If there is any chance that a member variable
> -  // could own objects that are implemented in JavaScript, then those
> -  // objects will keep the global object (this object) alive.  To prevent
> -  // these cycles, ownership of such members must be released in
> -  // |CleanUp| and |DetachFromDocShell|.

lol
Attachment #8652465 - Flags: review?(khuey) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/831fb361c4bc
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: