Title: [264878] trunk
Revision
264878
Author
[email protected]
Date
2020-07-24 19:59:04 -0700 (Fri, 24 Jul 2020)

Log Message

Fix assertion when highlighting in detached frames and make loads complete
https://bugs.webkit.org/show_bug.cgi?id=214770

Patch by Alex Christensen <[email protected]> on 2020-07-24
Reviewed by Geoffrey Garen.

Source/WebCore:

There's an assertion added in r53218 I think should be an early return.
It can be triggered by an interesting test I found while looking into rdar://problem/65467702
I also needed to balance the call to incrementLoadEventDelayCount in an early return in order to get the test to finish loading.

Test: fast/editing/frame-selection-is-not-caret.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::caretBlinkTimerFired):
* loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::loadSubframe):

LayoutTests:

* fast/editing/frame-selection-is-not-caret-expected.txt: Added.
* fast/editing/frame-selection-is-not-caret.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264877 => 264878)


--- trunk/LayoutTests/ChangeLog	2020-07-25 02:14:25 UTC (rev 264877)
+++ trunk/LayoutTests/ChangeLog	2020-07-25 02:59:04 UTC (rev 264878)
@@ -1,3 +1,13 @@
+2020-07-24  Alex Christensen  <[email protected]>
+
+        Fix assertion when highlighting in detached frames and make loads complete
+        https://bugs.webkit.org/show_bug.cgi?id=214770
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/editing/frame-selection-is-not-caret-expected.txt: Added.
+        * fast/editing/frame-selection-is-not-caret.html: Added.
+
 2020-07-24  Michael Saboff  <[email protected]>
 
         Fixed exception check handling below ScheduledAction::executeFunctionInContext()

Added: trunk/LayoutTests/fast/editing/frame-selection-is-not-caret-expected.txt (0 => 264878)


--- trunk/LayoutTests/fast/editing/frame-selection-is-not-caret-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/editing/frame-selection-is-not-caret-expected.txt	2020-07-25 02:59:04 UTC (rev 264878)
@@ -0,0 +1 @@
+ undefined Test passes if it does not assert.

Added: trunk/LayoutTests/fast/editing/frame-selection-is-not-caret.html (0 => 264878)


--- trunk/LayoutTests/fast/editing/frame-selection-is-not-caret.html	                        (rev 0)
+++ trunk/LayoutTests/fast/editing/frame-selection-is-not-caret.html	2020-07-25 02:59:04 UTC (rev 264878)
@@ -0,0 +1,19 @@
+<script>
+if (window.testRunner) { testRunner.dumpAsText(); }    
+function onBodyLoad() {
+    var observer = new MutationObserver(()=>{ container.replaceWith(undefined) });
+    observer.observe(selectElement, { attributes: true });
+    selectElement.setAttribute("attribute", "observe this attribute change");
+    textAreaElement.setSelectionRange(1, 0);
+    window.getSelection().modify("extend", "backward", "lineboundary");
+    sourceElement.appendChild(document.createElement("frame"));
+}
+</script>
+<body _onload_=onBodyLoad()>
+    <textarea id="textAreaElement" draggable="true"></textarea>
+    <div id="container">
+        <source id="sourceElement"></source>
+        <select id="selectElement"></select>
+    </div>
+    Test passes if it does not assert.
+</body>

Modified: trunk/Source/WebCore/ChangeLog (264877 => 264878)


--- trunk/Source/WebCore/ChangeLog	2020-07-25 02:14:25 UTC (rev 264877)
+++ trunk/Source/WebCore/ChangeLog	2020-07-25 02:59:04 UTC (rev 264878)
@@ -1,3 +1,21 @@
+2020-07-24  Alex Christensen  <[email protected]>
+
+        Fix assertion when highlighting in detached frames and make loads complete
+        https://bugs.webkit.org/show_bug.cgi?id=214770
+
+        Reviewed by Geoffrey Garen.
+
+        There's an assertion added in r53218 I think should be an early return.
+        It can be triggered by an interesting test I found while looking into rdar://problem/65467702
+        I also needed to balance the call to incrementLoadEventDelayCount in an early return in order to get the test to finish loading.
+
+        Test: fast/editing/frame-selection-is-not-caret.html
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::caretBlinkTimerFired):
+        * loader/SubframeLoader.cpp:
+        (WebCore::FrameLoader::SubframeLoader::loadSubframe):
+
 2020-07-24  Michael Saboff  <[email protected]>
 
         Fixed exception check handling below ScheduledAction::executeFunctionInContext()

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (264877 => 264878)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2020-07-25 02:14:25 UTC (rev 264877)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2020-07-25 02:59:04 UTC (rev 264878)
@@ -2230,8 +2230,9 @@
 void FrameSelection::caretBlinkTimerFired()
 {
 #if ENABLE(TEXT_CARET)
+    if (!isCaret())
+        return;
     ASSERT(caretIsVisible());
-    ASSERT(isCaret());
     bool caretPaint = m_caretPaint;
     if (isCaretBlinkingSuspended() && caretPaint)
         return;

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (264877 => 264878)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-07-25 02:14:25 UTC (rev 264877)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-07-25 02:59:04 UTC (rev 264878)
@@ -332,6 +332,7 @@
     auto frame = m_frame.loader().client().createFrame(name, ownerElement);
     if (!frame)  {
         m_frame.loader().checkCallImplicitClose();
+        document->decrementLoadEventDelayCount();
         return nullptr;
     }
     ReferrerPolicy policy = ownerElement.referrerPolicy();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to