RESOLVED FIXED 190282
A Document / Window should lose its browsing context as soon as its iframe is removed from the document
https://bugs.webkit.org/show_bug.cgi?id=190282
Summary A Document / Window should lose its browsing context as soon as its iframe is...
Chris Dumez
Reported 2018-10-04 10:42:02 PDT
A Document / Window should loose its browsing context (aka Frame) as soon as its iframe is removed from the document. Currently, in WebKit, a Document / Window's Frame only get nulled out when the frame gets destroyed, we happens later usually after a GC happens. This is not consistent with the specification or other browsers (tested Chrome and Firefox).
Attachments
WIP Patch (24.79 KB, patch)
2018-10-04 12:16 PDT, Chris Dumez
no flags
Patch (32.20 KB, patch)
2018-10-04 12:25 PDT, Chris Dumez
no flags
Patch (32.39 KB, patch)
2018-10-04 12:28 PDT, Chris Dumez
no flags
Patch (32.55 KB, patch)
2018-10-04 13:28 PDT, Chris Dumez
no flags
Patch (32.46 KB, patch)
2018-10-04 14:17 PDT, Chris Dumez
no flags
Patch (31.01 KB, patch)
2018-10-04 16:40 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2018-10-04 12:16:57 PDT
Created attachment 351611 [details] WIP Patch
Chris Dumez
Comment 2 2018-10-04 12:25:31 PDT
Chris Dumez
Comment 3 2018-10-04 12:28:21 PDT
Alexey Proskuryakov
Comment 4 2018-10-04 13:02:40 PDT
Is there any provision in specs for reparenting?
Chris Dumez
Comment 5 2018-10-04 13:07:17 PDT
(In reply to Alexey Proskuryakov from comment #4) > Is there any provision in specs for reparenting? No sure what you mean. If you remove an iframe from a document and add it back to the document, then it will do a fresh load and you'll get a brand new document / window, as per HTML spec.
Chris Dumez
Comment 6 2018-10-04 13:07:57 PDT
(In reply to Chris Dumez from comment #5) > (In reply to Alexey Proskuryakov from comment #4) > > Is there any provision in specs for reparenting? > > No sure what you mean. If you remove an iframe from a document and add it > back to the document, then it will do a fresh load and you'll get a brand > new document / window, as per HTML spec. Once a window / document loose their frame, they do not normally get reattached later, expect in the PageCache case.
Chris Dumez
Comment 7 2018-10-04 13:28:38 PDT
Chris Dumez
Comment 8 2018-10-04 14:17:17 PDT
Ryosuke Niwa
Comment 9 2018-10-04 16:21:06 PDT
Comment on attachment 351630 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=351630&action=review > LayoutTests/fast/dom/Window/resources/dom-access-from-closure-iframe-child.html:2 > + p = parent; // Save parent as the window will be detached when accessFrame() is called. Can we do const parent = window.parent instead? > LayoutTests/fast/dom/Window/resources/dom-access-from-closure-window-child.html:2 > + o = opener; // Save opener as the window will be detached when accessFrame() is called. Ditto. > LayoutTests/fast/parser/resources/set-parent-to-javascript-url.html:2 > +p = parent; Ditto.
Chris Dumez
Comment 10 2018-10-04 16:40:01 PDT
WebKit Commit Bot
Comment 11 2018-10-04 17:19:56 PDT
Comment on attachment 351642 [details] Patch Clearing flags on attachment: 351642 Committed r236862: <https://trac.webkit.org/changeset/236862>
WebKit Commit Bot
Comment 12 2018-10-04 17:19:58 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2018-10-04 17:20:35 PDT
Note You need to log in before you can comment on or make changes to this bug.