Status

()

Core
XBL
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: peterv, Assigned: peterv)

Tracking

Trunk
mozilla1.9.2a1
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

9 years ago
Created attachment 386585 [details] [diff] [review]
v1

If an element with a binding doesn't have a parent, we won't unlink it because we currently rely on a parent to do that by calling Unbind on its children.
If an element with a binding doesn't have an owner document anymore, we won't unlink it because we can't get at the binding from the element.

Comment 1

9 years ago
Comment on attachment 386585 [details] [diff] [review]
v1

>diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp
>--- a/content/base/src/nsGenericElement.cpp
>+++ b/content/base/src/nsGenericElement.cpp
>@@ -3987,8 +3987,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
>         NS_IF_RELEASE(slots->mControllers);
>       slots->mChildrenList = nsnull;
>     }
>   }
>+
>+  {
>+    nsIDocument *doc;
>+    if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc()) &&
>+        tmp->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
>+      nsAutoScriptBlocker scriptBlocker;
>+      doc->BindingManager()->ChangeDocumentFor(tmp, doc, nsnull);
>+    }
>+  }
> NS_IMPL_CYCLE_COLLECTION_UNLINK_END
Scriptblocker in unlink? Very scary. Does ChangeDocumentFor really need it?

Comment 2

9 years ago
Perhaps the scriptblocker could be set before calling cycle collector?
(Assignee)

Comment 3

9 years ago
Created attachment 386746 [details] [diff] [review]
v1.1

Yeah, I don't think it needs a script blocker.
Attachment #386585 - Attachment is obsolete: true
Attachment #386746 - Flags: superreview?(bzbarsky)
Attachment #386746 - Flags: review?(Olli.Pettay)
Attachment #386746 - Flags: superreview?(bzbarsky) → superreview+
Comment on attachment 386746 [details] [diff] [review]
v1.1

Looks ok.  Does this fix those addBinding leaks we were seeing on mochitest, perchance?

Updated

9 years ago
Attachment #386746 - Flags: review?(Olli.Pettay) → review+
(Assignee)

Comment 5

9 years ago
http://hg.mozilla.org/mozilla-central/rev/fe1f520ff772

I'll try to make a testcase, but it could be hard (dependent on order of CC or GC).
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.