Title: [246890] trunk/Source/WebCore
Revision
246890
Author
bfulg...@apple.com
Date
2019-06-27 11:11:59 -0700 (Thu, 27 Jun 2019)

Log Message

Correct document lifecycle while processing commands
https://bugs.webkit.org/show_bug.cgi?id=199146
<rdar://problem/52047462>

Reviewed by Darin Adler.

Protect the document while commands are being processed since script may run
during the style resolution. We should protect against this.

* dom/Document.cpp:
(WebCore::command):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246889 => 246890)


--- trunk/Source/WebCore/ChangeLog	2019-06-27 17:59:17 UTC (rev 246889)
+++ trunk/Source/WebCore/ChangeLog	2019-06-27 18:11:59 UTC (rev 246890)
@@ -1,3 +1,17 @@
+2019-06-27  Brent Fulgham  <bfulg...@apple.com>
+
+        Correct document lifecycle while processing commands
+        https://bugs.webkit.org/show_bug.cgi?id=199146
+        <rdar://problem/52047462>
+
+        Reviewed by Darin Adler.
+
+        Protect the document while commands are being processed since script may run
+        during the style resolution. We should protect against this.
+
+        * dom/Document.cpp:
+        (WebCore::command):
+
 2019-06-27  Jon Davis  <j...@apple.com>
 
         Add status for Web Bluetooth Scanning standards specification.

Modified: trunk/Source/WebCore/dom/Document.cpp (246889 => 246890)


--- trunk/Source/WebCore/dom/Document.cpp	2019-06-27 17:59:17 UTC (rev 246889)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-06-27 18:11:59 UTC (rev 246890)
@@ -5364,12 +5364,15 @@
 
 static Editor::Command command(Document* document, const String& commandName, bool userInterface = false)
 {
-    RefPtr<Frame> frame = document->frame();
+    auto protectedDocument = makeRef(*document);
+
+    document->updateStyleIfNeeded();
+
+    auto frame = makeRefPtr(document->frame());
+
     if (!frame || frame->document() != document)
         return Editor::Command();
 
-    document->updateStyleIfNeeded();
-
     return frame->editor().command(commandName,
         userInterface ? CommandFromDOMWithUserInterface : CommandFromDOM);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to