Title: [249968] branches/safari-608-branch/Source/WebCore
Revision
249968
Author
[email protected]
Date
2019-09-17 11:17:15 -0700 (Tue, 17 Sep 2019)

Log Message

Cherry-pick r249854. rdar://problem/55427477

    Crash under WebCore::firstPositionInNode()
    https://bugs.webkit.org/show_bug.cgi?id=201764
    <rdar://problem/54823754>

    Reviewed by Wenson Hsieh and Geoff Garen.

    Make sure to keep a Ref<> to the textNode when we call insertNodeAtTabSpanPosition()
    or insertNodeAt().

    Test: editing/firstPositionInNode-crash.html

    * editing/InsertTextCommand.cpp:
    (WebCore::InsertTextCommand::positionInsideTextNode):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (249967 => 249968)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-17 18:11:10 UTC (rev 249967)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-17 18:17:15 UTC (rev 249968)
@@ -1,3 +1,39 @@
+2019-09-17  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r249854. rdar://problem/55427477
+
+    Crash under WebCore::firstPositionInNode()
+    https://bugs.webkit.org/show_bug.cgi?id=201764
+    <rdar://problem/54823754>
+    
+    Reviewed by Wenson Hsieh and Geoff Garen.
+    
+    Make sure to keep a Ref<> to the textNode when we call insertNodeAtTabSpanPosition()
+    or insertNodeAt().
+    
+    Test: editing/firstPositionInNode-crash.html
+    
+    * editing/InsertTextCommand.cpp:
+    (WebCore::InsertTextCommand::positionInsideTextNode):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249854 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-13  Chris Dumez  <[email protected]>
+
+            Crash under WebCore::firstPositionInNode()
+            https://bugs.webkit.org/show_bug.cgi?id=201764
+            <rdar://problem/54823754>
+
+            Reviewed by Wenson Hsieh and Geoff Garen.
+
+            Make sure to keep a Ref<> to the textNode when we call insertNodeAtTabSpanPosition()
+            or insertNodeAt().
+
+            Test: editing/firstPositionInNode-crash.html
+
+            * editing/InsertTextCommand.cpp:
+            (WebCore::InsertTextCommand::positionInsideTextNode):
+
 2019-09-09  Ryosuke Niwa  <[email protected]>
 
         REGRESSION (iOS 13): Bulleted list copied from Notes to Mail results in Times New Roman

Modified: branches/safari-608-branch/Source/WebCore/editing/InsertTextCommand.cpp (249967 => 249968)


--- branches/safari-608-branch/Source/WebCore/editing/InsertTextCommand.cpp	2019-09-17 18:11:10 UTC (rev 249967)
+++ branches/safari-608-branch/Source/WebCore/editing/InsertTextCommand.cpp	2019-09-17 18:17:15 UTC (rev 249968)
@@ -59,9 +59,8 @@
     Position pos = p;
     if (isTabSpanTextNode(pos.anchorNode())) {
         auto textNode = document().createEditingTextNode(emptyString());
-        auto* textNodePtr = textNode.ptr();
-        insertNodeAtTabSpanPosition(WTFMove(textNode), pos);
-        return firstPositionInNode(textNodePtr);
+        insertNodeAtTabSpanPosition(textNode.copyRef(), pos);
+        return firstPositionInNode(textNode.ptr());
     }
 
     // Prepare for text input by looking at the specified position.
@@ -68,9 +67,8 @@
     // It may be necessary to insert a text node to receive characters.
     if (!pos.containerNode()->isTextNode()) {
         auto textNode = document().createEditingTextNode(emptyString());
-        auto* textNodePtr = textNode.ptr();
-        insertNodeAt(WTFMove(textNode), pos);
-        return firstPositionInNode(textNodePtr);
+        insertNodeAt(textNode.copyRef(), pos);
+        return firstPositionInNode(textNode.ptr());
     }
 
     return pos;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to