Title: [270983] trunk/Source/WebCore
Revision
270983
Author
[email protected]
Date
2020-12-18 11:34:39 -0800 (Fri, 18 Dec 2020)

Log Message

Crash in DOMSelection::getRangeAt()
https://bugs.webkit.org/show_bug.cgi?id=219804

Patch by Julian Gonzalez <[email protected]> on 2020-12-18
Reviewed by Darin Adler.

Add a check in HTMLTextFormControlElement::setSelectionRange()
that ensures we do not try to move the frame's selection
if the HTMLTextFormControlElement is no longer connected.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setSelectionRange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270982 => 270983)


--- trunk/Source/WebCore/ChangeLog	2020-12-18 19:32:51 UTC (rev 270982)
+++ trunk/Source/WebCore/ChangeLog	2020-12-18 19:34:39 UTC (rev 270983)
@@ -1,3 +1,17 @@
+2020-12-18  Julian Gonzalez  <[email protected]>
+
+        Crash in DOMSelection::getRangeAt()
+        https://bugs.webkit.org/show_bug.cgi?id=219804
+
+        Reviewed by Darin Adler.
+
+        Add a check in HTMLTextFormControlElement::setSelectionRange()
+        that ensures we do not try to move the frame's selection
+        if the HTMLTextFormControlElement is no longer connected.
+
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::setSelectionRange):
+
 2020-12-18  Megan Gardner  <[email protected]>
 
         Gate all of the code associated with app highlights

Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (270982 => 270983)


--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2020-12-18 19:32:51 UTC (rev 270982)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp	2020-12-18 19:34:39 UTC (rev 270983)
@@ -307,10 +307,16 @@
 
         // FIXME: Removing this synchronous layout requires fixing setSelectionWithoutUpdatingAppearance not needing up-to-date style.
         document().updateLayoutIgnorePendingStylesheets();
-        
+
         if (!isTextField())
             return;
 
+        // Double-check our connected state after the layout update.
+        if (!isConnected()) {
+            cacheSelection(start, end, direction);
+            return;
+        }
+
         // Double-check the state of innerTextElement after the layout.
         innerText = innerTextElement();
         auto* rendererTextControl = renderer();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to