WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
110064
Let JS wrapper manage Attr node lifetime instead of Element.
https://bugs.webkit.org/show_bug.cgi?id=110064
Summary
Let JS wrapper manage Attr node lifetime instead of Element.
Andreas Kling
Reported
2013-02-17 16:51:58 PST
Let JS wrapper manage Attr node lifetime instead of Element.
Attachments
Proposed patch
(18.21 KB, patch)
2013-02-17 16:53 PST
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
Proposed patch
(17.95 KB, patch)
2013-02-17 16:57 PST
,
Andreas Kling
no flags
Details
Formatted Diff
Diff
Proposed patch
(21.36 KB, patch)
2013-02-18 14:40 PST
,
Andreas Kling
abarth
: review-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Andreas Kling
Comment 1
2013-02-17 16:53:53 PST
Created
attachment 188781
[details]
Proposed patch
Andreas Kling
Comment 2
2013-02-17 16:57:16 PST
Created
attachment 188782
[details]
Proposed patch Oops, wrong file.
Alexey Proskuryakov
Comment 3
2013-02-17 19:12:28 PST
Comment on
attachment 188782
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=188782&action=review
> Source/WebCore/ChangeLog:10 > + In practice, this means that Attr nodes disappear when the last JS wrapper is GC'd.
What about XPath? It creates Attr nodes without wrappers.
Geoffrey Garen
Comment 4
2013-02-18 06:47:16 PST
Comment on
attachment 188782
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=188782&action=review
> Source/WebCore/dom/Attr.h:50 > - Element* ownerElement() const { return m_element; } > + Element* ownerElement() const { return m_element.get(); }
This is no longer a good name, since the Element does not own the Attr.
Andreas Kling
Comment 5
2013-02-18 13:11:02 PST
(In reply to
comment #4
)
> (From update of
attachment 188782
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=188782&action=review
> > > Source/WebCore/dom/Attr.h:50 > > - Element* ownerElement() const { return m_element; } > > + Element* ownerElement() const { return m_element.get(); } > > This is no longer a good name, since the Element does not own the Attr.
Alas, it's DOM API. I can add a comment about how it's not really owned by the Element.
Andreas Kling
Comment 6
2013-02-18 13:14:53 PST
(In reply to
comment #3
)
> (From update of
attachment 188782
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=188782&action=review
> > > Source/WebCore/ChangeLog:10 > > + In practice, this means that Attr nodes disappear when the last JS wrapper is GC'd. > > What about XPath? It creates Attr nodes without wrappers.
That ChangeLog comment was probably a little too general. Attr nodes are still like any other nodes, in that you stash them in a RefPtr and go about your business. AFAICT the XPath code doesn't rely on Element retaining instantiated Attr nodes forever. A better comment might be: In practice, this means that Attr nodes are not kept alive indefinitely by their "owner" Element.
Andreas Kling
Comment 7
2013-02-18 14:40:19 PST
Created
attachment 188944
[details]
Proposed patch - Bit more fleshy ChangeLog. - Removed detaching of Attr nodes in ~Element() since Element won't be destroyed as long as Attr nodes are attached. - Added a comment about Attr::ownerElement() being named that way because of DOM API.
Adam Barth
Comment 8
2013-02-19 10:41:20 PST
Comment on
attachment 188944
[details]
Proposed patch Would you be willing to update V8GCController::opaqueRootForGC appropriately for this change?
Adam Barth
Comment 9
2013-02-19 10:44:06 PST
Comment on
attachment 188944
[details]
Proposed patch Doesn't this mess up the DOM semantics? Support JavaScript has a reference to the Attr and no other references to Nodes. Now a GC will delete the wrapper from the Attr's ownerElement, which will be observable.
Adam Barth
Comment 10
2013-02-19 10:45:46 PST
s/Support/Suppose/
Adam Barth
Comment 11
2013-02-19 10:47:17 PST
Worse, won't GC now delete all the nodes in the tree except the nodes including-and-below the ownerElement? That's observable because attr.ownerElement.parentNode will be null incorrectly.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug