Closed
Bug 83635
Opened 24 years ago
Closed 14 years ago
XBL binding not deleted on removal from document tree
Categories
(Core :: XBL, defect)
Core
XBL
Tracking
()
RESOLVED
FIXED
mozilla2.0b7
Tracking | Status | |
---|---|---|
blocking2.0 | --- | - |
People
(Reporter: tim.dewhirst, Assigned: mounir)
References
(Blocks 2 open bugs)
Details
Attachments
(2 files, 2 obsolete files)
1.45 KB,
application/octet-stream
|
Details | |
977 bytes,
patch
|
Details | Diff | Splinter Review |
A problem has been noted with regards to removing an XBL binding from a
document.
If a simple binding is constructed, which simply dumps a message on
construction and destruction, and added to the document and subsequently
deleted, the destructor is not called.
The destructor is only called at browser shutdown if the binding is not removed
from the tree.
A test case attachment follows.
Reporter | ||
Comment 1•24 years ago
|
||
Updated•24 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•23 years ago
|
Status: NEW → ASSIGNED
Target Milestone: mozilla1.0 → mozilla1.0.1
Updated•18 years ago
|
Assignee: hyatt → general
Status: ASSIGNED → NEW
QA Contact: jrgmorrison → ian
Updated•18 years ago
|
OS: Windows 2000 → All
Hardware: PC → All
Target Milestone: mozilla1.0.1 → ---
Comment 3•18 years ago
|
||
So the basic problem is that we only detach bindings when a document is unloaded, and only for those bindings that are in the binding manager's table. When we remove a node from the document, we null out the binding in the document's binding manager and nuke the anonymous content, but do NOT call BindingDetached().
Frankly, I think we should just call BindingDetached either in that code, or in ~nsXBLBinding. Thoughts?
Note that this bug causes various memory leaks if people removeChild a node with a binding attached to it; we have workarounds for some of these in our tabbrowser bindings last I checked...
Flags: blocking1.9?
Is there a risk that that would break a bunch of XUL because we'd behave differently for nodes that are moved out of the tree?
Comment 5•18 years ago
|
||
Maybe. If people remove nodes from the DOM and then call XBL methods on them, the methods will not work. Right now they sorta kinda work, maybe.
One more note: our current behavior is that if you remove a node from the DOM we do nothing. If you reinsert it, we fire the constructor (a second time, with no destructor firing in between). Whether you reinsert it or not, if the destructor did any sort of cleanup we probably leak the node (more likely if you don't reinsert)....
Marking wanted for fixing any mlk involved; correctness isn't blocking 1.9.
Flags: blocking1.9? → blocking1.9-
Whiteboard: [wanted-1.9]
Updated•17 years ago
|
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
Updated•15 years ago
|
Assignee: xbl → nobody
QA Contact: ian → xbl
Comment 7•15 years ago
|
||
(In reply to comment #5)
> Maybe. If people remove nodes from the DOM and then call XBL methods on them,
> the methods will not work. Right now they sorta kinda work, maybe.
>
No. It does not work. Although the binding wasn't destroyed, one cannot access the binding implementation after the node is removed (see my patch on bug 528006).
IMO, this negates the compatibility argument for keeping this behavior until XBL2.
Comment 8•15 years ago
|
||
> No. It does not work.
Indeed; that got changed in bug 398135.
Comment 9•15 years ago
|
||
OK. What sort of compatibility issue remains here then?
Comment 10•15 years ago
|
||
Probably none.
Comment 11•15 years ago
|
||
Re-evauating for blocking then.
Drivers: This bug is causing various leaks related to toolbar customization, along with non-trivial workarounds, like the one in 528006.
blocking2.0: --- → ?
Updated•15 years ago
|
Assignee: nobody → jonas
blocking2.0: ? → beta1
Updated•15 years ago
|
blocking2.0: beta1+ → beta2+
Updated•14 years ago
|
blocking2.0: beta2+ → beta3+
Comment 12•14 years ago
|
||
jst, you marked this beta3+ 10 days ago, no progress since then. Do we expect this to hit code freeze on Monday, Aug 2, 23:00 PT?
Comment 14•14 years ago
|
||
This isn't a regression from anything remotely recent, and we still have no progress on it AFAICT. It's not clear to me why this should block. At a maximum it feels like we just need beta coverage, but I'm leaning to "not a blocker". Setting to betaN for now, but please justify why this is blocking.
blocking2.0: beta4+ → betaN+
Comment 15•14 years ago
|
||
After looking at more details in this bug and talking this over with Jonas I agree with Shawn, this is not a blocker.
Assignee: jonas → mounir.lamouri
blocking2.0: betaN+ → -
Comment 16•14 years ago
|
||
... but I assigned this to Mounir and he will try out the easy fix and see if that fixes the leak issue here, and if it does we should take the fix for fx4, assuming it seems like a safe fix.
Assignee | ||
Comment 17•14 years ago
|
||
Attachment #479555 -
Flags: review?(jonas)
Assignee | ||
Updated•14 years ago
|
Status: NEW → ASSIGNED
I think I'd prefer to call BindingDetached when the binding is removed. The dtor can run at more random times due to CC, so that's more error prone.
Comment on attachment 479555 [details] [diff] [review]
Patch v1
Removing review request while waiting
Attachment #479555 -
Flags: review?(jonas)
Assignee | ||
Comment 20•14 years ago
|
||
Is that what you are expecting?
Attachment #479555 -
Attachment is obsolete: true
Attachment #483942 -
Flags: review?(jonas)
Comment on attachment 483942 [details] [diff] [review]
Patch v2
Yes. Lets get this in sooner rather than later. All XBL changes scare me.
Attachment #483942 -
Flags: review?(jonas)
Attachment #483942 -
Flags: review+
Attachment #483942 -
Flags: approval2.0+
Assignee | ||
Comment 22•14 years ago
|
||
Actually, this patch is breaking a lot of tests:
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1287457169.1287459276.21119.gz
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1287449088.1287449484.10175.gz
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1287449139.1287449728.11664.gz
I will have a look at that later.
Assignee | ||
Comment 23•14 years ago
|
||
So, the problem is, when calling BindingDetached, the destructor is called but when called in that situation, all methods inside the destructor will be undefined. I have no idea why :-/
I have a test case here: http://oldworld.fr/mozilla/xbl-test.xul (you need Remote XUL Manager extension to set the permissions). With the patch applied, if you remove a child, the bindings will be detached and _foo() will try to be called but the call will fail. Without the patch, the destructor will be called later and _foo() will be correctly called.
Assignee | ||
Comment 24•14 years ago
|
||
Ok, I should detach before changing the document actually.
Attachment #483942 -
Attachment is obsolete: true
Assignee | ||
Comment 25•14 years ago
|
||
Gasp, still have one failure on MacOS X only:
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1287600826.1287601188.9198.gz
Assignee | ||
Comment 26•14 years ago
|
||
This is ready to be landed but according to Boris this has to be landed for b7 because it might break some extensions. For example, radio widget has been broken.
Should I push that in b7 branch?
You'll need beltzners approval.
Comment 28•14 years ago
|
||
If this is an API change that would break people, then yes, please put it on the b7 relbranch. I've moved this bug to be a b7 blocker to reflect that.
The relbranch is GECKO20b7pre_20101006_RELBRANCH
Comment 29•14 years ago
|
||
Comment on attachment 484683 [details] [diff] [review]
Patch v2.1
a=beltzner for mozilla-central default and b7 relbranch
Assignee | ||
Comment 30•14 years ago
|
||
Pushed on trunk:
http://hg.mozilla.org/mozilla-central/rev/11591f86a117
And on b7 branch:
http://hg.mozilla.org/mozilla-central/rev/4cb683e8c0f7
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b7
You need to log in
before you can comment on or make changes to this bug.
Description
•