Title: [277202] trunk
Revision
277202
Author
commit-qu...@webkit.org
Date
2021-05-07 14:54:02 -0700 (Fri, 07 May 2021)

Log Message

Do not try to remove and already removed node while deleting selection
https://bugs.webkit.org/show_bug.cgi?id=224893

Patch by Carlos Garcia Campos <cgar...@igalia.com> on 2021-05-07
Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: editing/inserting/insert-text-force-repaint-on-load-crash.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode): Return early if the given node doesn't have a parent anymore.

Tools:

Add new API to allow tests to trigger a force repaint on load finished.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::frameDidChangeLocation):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::displayOnLoadFinish):
(WTR::TestRunner::shouldDisplayOnLoadFinish):

LayoutTests:

* editing/inserting/insert-text-force-repaint-on-load-crash-expected.txt: Added.
* editing/inserting/insert-text-force-repaint-on-load-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277201 => 277202)


--- trunk/LayoutTests/ChangeLog	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/LayoutTests/ChangeLog	2021-05-07 21:54:02 UTC (rev 277202)
@@ -1,3 +1,13 @@
+2021-05-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Do not try to remove and already removed node while deleting selection
+        https://bugs.webkit.org/show_bug.cgi?id=224893
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/inserting/insert-text-force-repaint-on-load-crash-expected.txt: Added.
+        * editing/inserting/insert-text-force-repaint-on-load-crash.html: Added.
+
 2021-05-07  Robert Jenner  <jen...@apple.com>
 
         REGRESSION: [ BigSurE Release wk 2] webrtc/video-replace-muted-track.html is a flaky text failure

Added: trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash-expected.txt (0 => 277202)


--- trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash-expected.txt	2021-05-07 21:54:02 UTC (rev 277202)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash.html (0 => 277202)


--- trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash.html	                        (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-text-force-repaint-on-load-crash.html	2021-05-07 21:54:02 UTC (rev 277202)
@@ -0,0 +1,27 @@
+<script>
+  _onload_ = () => {
+    let n0 = document.createElement('embed');
+    n0.src = '';
+    document.body.appendChild(n0);
+    document.documentElement.appendChild(document.createElement('input'));
+    document.documentElement.appendChild(document.createElement('span'));
+    document.execCommand('SelectAll');
+    document.designMode = 'on';
+    let animation = new Animation();
+    animation._onfinish_ = () => document.execCommand('InsertText');
+    setTimeout(() => {
+      animation.reverse();
+      document.execCommand('InsertText');
+      if (window.testRunner) {
+        document.body.innerHTML = 'PASS';
+        testRunner.notifyDone();
+      }
+    }, 0);
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        if (testRunner.displayOnLoadFinish)
+          testRunner.displayOnLoadFinish();
+        testRunner.waitUntilDone();
+    }
+  };
+</script>

Modified: trunk/Source/WebCore/ChangeLog (277201 => 277202)


--- trunk/Source/WebCore/ChangeLog	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Source/WebCore/ChangeLog	2021-05-07 21:54:02 UTC (rev 277202)
@@ -1,3 +1,15 @@
+2021-05-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Do not try to remove and already removed node while deleting selection
+        https://bugs.webkit.org/show_bug.cgi?id=224893
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: editing/inserting/insert-text-force-repaint-on-load-crash.html
+
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::removeNode): Return early if the given node doesn't have a parent anymore.
+
 2021-05-07  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [macOS] Set the -isSourceEditable property when presenting webpage translation popup

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (277201 => 277202)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2021-05-07 21:54:02 UTC (rev 277202)
@@ -511,6 +511,9 @@
 
 void DeleteSelectionCommand::removeNode(Node& node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
 {
+    if (!node.parentNode())
+        return;
+
     Ref<Node> protectedNode = node;
     if (m_startRoot != m_endRoot && !(node.isDescendantOf(m_startRoot.get()) && node.isDescendantOf(m_endRoot.get()))) {
         // If a node is not in both the start and end editable roots, remove it only if its inside an editable region.

Modified: trunk/Tools/ChangeLog (277201 => 277202)


--- trunk/Tools/ChangeLog	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Tools/ChangeLog	2021-05-07 21:54:02 UTC (rev 277202)
@@ -1,3 +1,19 @@
+2021-05-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Do not try to remove and already removed node while deleting selection
+        https://bugs.webkit.org/show_bug.cgi?id=224893
+
+        Reviewed by Ryosuke Niwa.
+
+        Add new API to allow tests to trigger a force repaint on load finished.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::frameDidChangeLocation):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::displayOnLoadFinish):
+        (WTR::TestRunner::shouldDisplayOnLoadFinish):
+
 2021-05-07  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Make AccessibilityReduceMotion test case work on iOS

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (277201 => 277202)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2021-05-07 21:54:02 UTC (rev 277202)
@@ -113,6 +113,7 @@
     undefined repaintSweepHorizontally();
     undefined display();
     undefined displayAndTrackRepaints();
+    undefined displayOnLoadFinish();
 
     // Failed load condition testing
     undefined forceImmediateCompletion();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (277201 => 277202)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2021-05-07 21:54:02 UTC (rev 277202)
@@ -1860,6 +1860,11 @@
 
     injectedBundle.setTopLoadingFrame(nullptr);
 
+    if (injectedBundle.testRunner()->shouldDisplayOnLoadFinish()) {
+        if (auto page = InjectedBundle::singleton().page())
+            WKBundlePageForceRepaint(page->page());
+    }
+
     if (injectedBundle.testRunner()->shouldWaitUntilDone())
         return;
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (277201 => 277202)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2021-05-07 21:42:28 UTC (rev 277201)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2021-05-07 21:54:02 UTC (rev 277202)
@@ -128,6 +128,8 @@
     void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; }
     void display();
     void displayAndTrackRepaints();
+    void displayOnLoadFinish() { m_displayOnLoadFinish = true; }
+    bool shouldDisplayOnLoadFinish() { return m_displayOnLoadFinish; }
 
     // UserContent testing.
     void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
@@ -575,6 +577,7 @@
     bool m_disallowIncreaseForApplicationCacheQuota { false };
     bool m_testRepaint { false };
     bool m_testRepaintSweepHorizontally { false };
+    bool m_displayOnLoadFinish { false };
     bool m_isPrinting { false };
     bool m_willSendRequestReturnsNull { false };
     bool m_willSendRequestReturnsNullOnRedirect { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to