Closed
Bug 257690
Opened 20 years ago
Closed 20 years ago
CreateGeneratedFrameFor() doesn't add the generated content as anonymous content
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
People
(Reporter: jst, Assigned: jst)
Details
(Keywords: fixed-aviary1.0, fixed1.7.5)
Attachments
(3 files, 1 obsolete file)
6.49 KB,
patch
|
Details | Diff | Splinter Review | |
5.66 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
asa
:
approval-aviary+
asa
:
approval1.7.5+
|
Details | Diff | Splinter Review |
6.60 KB,
patch
|
Details | Diff | Splinter Review |
... and that causes the content to not be properly torn down, which causes leaks
etc. Patch coming up.
Assignee | ||
Comment 1•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #157632 -
Flags: superreview?(bzbarsky)
Attachment #157632 -
Flags: review?(bzbarsky)
Comment 2•20 years ago
|
||
So is the problem here that the generated content holds a strong ref to the
document and the document somehow ends up holding a ref to the content?
If so, why are we limiting this to image content and not the other types of
generated content here?
Assignee | ||
Comment 3•20 years ago
|
||
Oh, all types of generated content should get the same behaviour. The problem is
that if we don't tell the presshell about the anon content, the anon content
will never be properly destroyed, so it'll hold dangling pointers to the
document etc even, and most importantly, since the anon content is never
notified about the document going away, it never clears its references to its
event listener, and that's the primary cause of the leaks.
Where else do I need to patch this?
Assignee | ||
Comment 4•20 years ago
|
||
Oh, I see... just other places in the same method...
Comment 5•20 years ago
|
||
Wait. The only thing holding a ref to the anon content is the frame, right? So
when the frame goes away it should get destroyed...
How do event listeners come into that?
I agree the patch is probably the right thing to do; just trying to figure out
how we actually leak.
Assignee | ||
Comment 6•20 years ago
|
||
Sorry, this doesn't actually cause any leaks as I thought it did, it only makes
us hit the assertion at
http://lxr.mozilla.org/mozilla/source/content/base/src/nsGenericElement.cpp#817
which isn't that bad, but it's still the right thing to do. I've got a diff to
do this for all types of generated content, not just for images.
Assignee | ||
Comment 7•20 years ago
|
||
Updated diff that should cover all types of generated content.
Attachment #157632 -
Attachment is obsolete: true
Assignee | ||
Comment 8•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #157632 -
Flags: superreview?(bzbarsky)
Attachment #157632 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•20 years ago
|
Attachment #157641 -
Flags: superreview?(bzbarsky)
Attachment #157641 -
Flags: review?(bzbarsky)
Comment 9•20 years ago
|
||
Comment on attachment 157641 [details] [diff] [review]
diff -w for review
>Index: layout/html/style/src/nsCSSFrameConstructor.cpp
>@@ -1524,38 +1525,36 @@ nsCSSFrameConstructor::CreateGeneratedFr
> rv = NS_NewAttributeContent(aContent, attrNameSpace, attrName,
> getter_AddRefs(content));
Now that you're falling through later, you need to bail here if rv fails. In
fact, this code should have been returning early on allocation failure here all
along.
> NS_NewTextFrame(shell, &textFrame);
> textFrame->Init(aPresContext, content, aParentFrame, aStyleContext,
As long as you're here, mind doing a null-check on this too? And making sure
NS_NewTextFrame will set the out param to null on alloc failure?
>+ nsresult rv = NS_NewISupportsArray(getter_AddRefs(anonymousItems));
The api really sucks here.. want to file a bug to clean it up so we can just
pass in a content node here and the presshell will deal?
r+sr=bzbarsky with those first two issues fixed.
Attachment #157641 -
Flags: superreview?(bzbarsky)
Attachment #157641 -
Flags: superreview+
Attachment #157641 -
Flags: review?(bzbarsky)
Attachment #157641 -
Flags: review+
Assignee | ||
Comment 10•20 years ago
|
||
Filed bug 257868 on the lame nsIPresShell::SetAnonymousContentFor() API.
Assignee | ||
Comment 11•20 years ago
|
||
Assignee | ||
Comment 12•20 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 13•20 years ago
|
||
Comment on attachment 157641 [details] [diff] [review]
diff -w for review
We should probably take this on the aviary branch, to keep our developers'
sanity (by eliminating lots and lots of asserts when browsing mozilla.org
pages), if nothing else.
Attachment #157641 -
Flags: approval1.7.x?
Attachment #157641 -
Flags: approval-aviary?
Comment 14•20 years ago
|
||
Comment on attachment 157641 [details] [diff] [review]
diff -w for review
a=asa for branch checkins.
Attachment #157641 -
Flags: approval1.7.x?
Attachment #157641 -
Flags: approval1.7.x+
Attachment #157641 -
Flags: approval-aviary?
Attachment #157641 -
Flags: approval-aviary+
Comment 16•20 years ago
|
||
jst, can you put this on 1.7 as well please?
Comment 17•20 years ago
|
||
Could we PLEASE land stuff on both branches in parallel? This checkin made a
patch I needed to land on both branches only apply to one of them (and made me
waste a good bit of time trying to figure out what went wrong). That should NOT
be happening with Gecko changes. As long as people land this sort of thing on
both branches at once consistently, it makes it easier for everyone else to do
the same...
What bz said. It is not acceptable to put off landing patches on 1.7. The
branches need to stay in sync as we go or it's tons more work for everyone.
You need to log in
before you can comment on or make changes to this bug.
Description
•