RESOLVED FIXED 221175
StaticRange should keep its start and end containers alive
https://bugs.webkit.org/show_bug.cgi?id=221175
Summary StaticRange should keep its start and end containers alive
Ryosuke Niwa
Reported 2021-01-29 21:07:17 PST
StaticRange doesn't keep its start and end containers alive right now. As a result, some DOM nodes can get garbage collected prematurely.
Attachments
Fixes the bug (15.75 KB, patch)
2021-01-29 21:10 PST, Ryosuke Niwa
wenson_hsieh: review+
Ryosuke Niwa
Comment 1 2021-01-29 21:10:56 PST
Created attachment 418807 [details] Fixes the bug
Wenson Hsieh
Comment 2 2021-01-29 21:15:00 PST
Comment on attachment 418807 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=418807&action=review > Source/WebCore/ChangeLog:9 > + To do that, we sff them as opaque roots during the marking phase in visitAdditionalChildren. Nit - sff => add
Ryosuke Niwa
Comment 3 2021-01-30 00:52:16 PST
(In reply to Wenson Hsieh from comment #2) > Comment on attachment 418807 [details] > Fixes the bug > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418807&action=review > > > Source/WebCore/ChangeLog:9 > > + To do that, we sff them as opaque roots during the marking phase in visitAdditionalChildren. > > Nit - sff => add Fixed. Thanks for the review!
Ryosuke Niwa
Comment 4 2021-01-30 00:53:12 PST
Radar WebKit Bug Importer
Comment 5 2021-01-30 00:54:13 PST
Darin Adler
Comment 6 2021-02-01 17:04:43 PST
Should we add a test to make sure that we can’t create a reference cycle that causes leaks by having a static range as the value of a property on one of its endpoint nodes?
Ryosuke Niwa
Comment 7 2021-02-01 21:57:51 PST
(In reply to Darin Adler from comment #6) > Should we add a test to make sure that we can’t create a reference cycle > that causes leaks by having a static range as the value of a property on one > of its endpoint nodes? Maybe? I guess we can artificially introduce a leaking bug & verify the test works?
Darin Adler
Comment 8 2021-02-02 09:15:05 PST
We have tests for this, like LayoutTests/fast/dom/reference-cycle-leaks.html, but I don’t think we have one that covers StaticRange.
Ryosuke Niwa
Comment 9 2021-03-05 01:41:35 PST
(In reply to Darin Adler from comment #8) > We have tests for this, like > LayoutTests/fast/dom/reference-cycle-leaks.html, but I don’t think we have > one that covers StaticRange. Alright, filed https://bugs.webkit.org/show_bug.cgi?id=222786 to add those tests.
Note You need to log in before you can comment on or make changes to this bug.