Title: [266131] branches/safari-610.2.2-branch
Revision
266131
Author
[email protected]
Date
2020-08-25 10:45:13 -0700 (Tue, 25 Aug 2020)

Log Message

Cherry-pick r265881. rdar://problem/67742375

    REGRESSION(r265092): delegatesFocus causes WebKit to crash
    https://bugs.webkit.org/show_bug.cgi?id=215622

    Reviewed by Youenn Fablet.

    Source/WebCore:

    The bug was caused by a missing nullptr check. Added it.

    Test: fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html

    * page/EventHandler.cpp:
    (WebCore::EventHandler::dispatchMouseEvent): Added a nullptr check.

    LayoutTests:

    Added a regression test.

    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt: Added.
    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-610.2.2-branch/LayoutTests/ChangeLog (266130 => 266131)


--- branches/safari-610.2.2-branch/LayoutTests/ChangeLog	2020-08-25 17:41:16 UTC (rev 266130)
+++ branches/safari-610.2.2-branch/LayoutTests/ChangeLog	2020-08-25 17:45:13 UTC (rev 266131)
@@ -1,3 +1,43 @@
+2020-08-25  Alan Coon  <[email protected]>
+
+        Cherry-pick r265881. rdar://problem/67742375
+
+    REGRESSION(r265092): delegatesFocus causes WebKit to crash
+    https://bugs.webkit.org/show_bug.cgi?id=215622
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    The bug was caused by a missing nullptr check. Added it.
+    
+    Test: fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchMouseEvent): Added a nullptr check.
+    
+    LayoutTests:
+    
+    Added a regression test.
+    
+    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt: Added.
+    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-18  Ryosuke Niwa  <[email protected]>
+
+            REGRESSION(r265092): delegatesFocus causes WebKit to crash
+            https://bugs.webkit.org/show_bug.cgi?id=215622
+
+            Reviewed by Youenn Fablet.
+
+            Added a regression test.
+
+            * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt: Added.
+            * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html: Added.
+
 2020-08-17  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Remove support for NPAPI plugins

Added: branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt (0 => 266131)


--- branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt	                        (rev 0)
+++ branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt	2020-08-25 17:45:13 UTC (rev 266131)
@@ -0,0 +1,3 @@
+This tests delegating focus in a shadow tree without a focusable element. WebKit should not crash.
+
+PASS - WebKit did not crash

Added: branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html (0 => 266131)


--- branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html	                        (rev 0)
+++ branches/safari-610.2.2-branch/LayoutTests/fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html	2020-08-25 17:45:13 UTC (rev 266131)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+</head>
+<body>
+<p>This tests delegating focus in a shadow tree without a focusable element. WebKit should not crash.</p>
+<script src=""
+<script>
+
+const host = document.createElement('div');
+document.body.appendChild(host);
+
+const shadowRoot = host.attachShadow({mode: 'closed', delegatesFocus: true});
+shadowRoot.innerHTML = `hello`;
+host.addEventListener('click', complete);
+
+async function runTest() {
+    const hostRect = host.getBoundingClientRect();
+    await UIHelper.activateAt(hostRect.x + 5, hostRect.y + 5);
+    await UIHelper.ensurePresentationUpdate();
+    await new Promise(requestAnimationFrame);
+}
+
+function complete() {
+    host.outerHTML = 'PASS - WebKit did not crash';
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    UIHelper.wait(runTest());
+}
+
+</script>
+</body>
+</html>

Modified: branches/safari-610.2.2-branch/Source/WebCore/ChangeLog (266130 => 266131)


--- branches/safari-610.2.2-branch/Source/WebCore/ChangeLog	2020-08-25 17:41:16 UTC (rev 266130)
+++ branches/safari-610.2.2-branch/Source/WebCore/ChangeLog	2020-08-25 17:45:13 UTC (rev 266131)
@@ -1,3 +1,45 @@
+2020-08-25  Alan Coon  <[email protected]>
+
+        Cherry-pick r265881. rdar://problem/67742375
+
+    REGRESSION(r265092): delegatesFocus causes WebKit to crash
+    https://bugs.webkit.org/show_bug.cgi?id=215622
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    The bug was caused by a missing nullptr check. Added it.
+    
+    Test: fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html
+    
+    * page/EventHandler.cpp:
+    (WebCore::EventHandler::dispatchMouseEvent): Added a nullptr check.
+    
+    LayoutTests:
+    
+    Added a regression test.
+    
+    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation-expected.txt: Added.
+    * fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-18  Ryosuke Niwa  <[email protected]>
+
+            REGRESSION(r265092): delegatesFocus causes WebKit to crash
+            https://bugs.webkit.org/show_bug.cgi?id=215622
+
+            Reviewed by Youenn Fablet.
+
+            The bug was caused by a missing nullptr check. Added it.
+
+            Test: fast/shadow-dom/delegates-focus-unsuccessfully-by-activation.html
+
+            * page/EventHandler.cpp:
+            (WebCore::EventHandler::dispatchMouseEvent): Added a nullptr check.
+
 2020-08-17  Yusuke Suzuki  <[email protected]>
 
         JSDOMConstructorNotConstructable should be a constructor

Modified: branches/safari-610.2.2-branch/Source/WebCore/page/EventHandler.cpp (266130 => 266131)


--- branches/safari-610.2.2-branch/Source/WebCore/page/EventHandler.cpp	2020-08-25 17:41:16 UTC (rev 266130)
+++ branches/safari-610.2.2-branch/Source/WebCore/page/EventHandler.cpp	2020-08-25 17:45:13 UTC (rev 266131)
@@ -2761,7 +2761,7 @@
     if (page && !page->focusController().setFocusedElement(element.get(), m_frame))
         return false;
 
-    if (m_mouseDownDelegatedFocus)
+    if (element && m_mouseDownDelegatedFocus)
         element->revealFocusedElement(SelectionRestorationMode::SetDefault);
 
     return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to