Title: [252113] tags/Safari-609.1.10/Source/WebCore
Revision
252113
Author
alanc...@apple.com
Date
2019-11-05 16:36:02 -0800 (Tue, 05 Nov 2019)

Log Message

Cherry-pick r252013. rdar://problem/56832747

    Collect all documents before iterating in Page::forEachDocument
    https://bugs.webkit.org/show_bug.cgi?id=203811
    <rdar://problem/56832747>

    Patch by Alex Christensen <achristen...@webkit.org> on 2019-11-04
    Reviewed by Ryosuke Niwa.

    Some calls to forEachDocument, notably those introduced in r251930, can mutate the frames and documents as they are being iterated.
    This causes problems that can be avoided by iterating, keeping all Documents referenced, then iterating the referenced Documents.

    * page/Page.cpp:
    (WebCore::Page::forEachDocument):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252013 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: tags/Safari-609.1.10/Source/WebCore/ChangeLog (252112 => 252113)


--- tags/Safari-609.1.10/Source/WebCore/ChangeLog	2019-11-06 00:13:08 UTC (rev 252112)
+++ tags/Safari-609.1.10/Source/WebCore/ChangeLog	2019-11-06 00:36:02 UTC (rev 252113)
@@ -1,3 +1,36 @@
+2019-11-05  Kocsen Chung  <kocsen_ch...@apple.com>
+
+        Cherry-pick r252013. rdar://problem/56832747
+
+    Collect all documents before iterating in Page::forEachDocument
+    https://bugs.webkit.org/show_bug.cgi?id=203811
+    <rdar://problem/56832747>
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2019-11-04
+    Reviewed by Ryosuke Niwa.
+    
+    Some calls to forEachDocument, notably those introduced in r251930, can mutate the frames and documents as they are being iterated.
+    This causes problems that can be avoided by iterating, keeping all Documents referenced, then iterating the referenced Documents.
+    
+    * page/Page.cpp:
+    (WebCore::Page::forEachDocument):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-11-04  Alex Christensen  <achristen...@webkit.org>
+
+            Collect all documents before iterating in Page::forEachDocument
+            https://bugs.webkit.org/show_bug.cgi?id=203811
+            <rdar://problem/56832747>
+
+            Reviewed by Ryosuke Niwa.
+
+            Some calls to forEachDocument, notably those introduced in r251930, can mutate the frames and documents as they are being iterated.
+            This causes problems that can be avoided by iterating, keeping all Documents referenced, then iterating the referenced Documents.
+
+            * page/Page.cpp:
+            (WebCore::Page::forEachDocument):
+
 2019-11-04  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r251991. rdar://problem/56795440

Modified: tags/Safari-609.1.10/Source/WebCore/page/Page.cpp (252112 => 252113)


--- tags/Safari-609.1.10/Source/WebCore/page/Page.cpp	2019-11-06 00:13:08 UTC (rev 252112)
+++ tags/Safari-609.1.10/Source/WebCore/page/Page.cpp	2019-11-06 00:36:02 UTC (rev 252113)
@@ -2869,12 +2869,8 @@
 
 void Page::forEachDocument(const Function<void(Document&)>& functor)
 {
-    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
-        if (!frame->document())
-            continue;
-
-        functor(*frame->document());
-    }
+    for (auto& document : collectDocuments())
+        functor(document);
 }
 
 Vector<Ref<Document>> Page::collectDocuments()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to