CrashTracer: com.apple.WebKit.WebContent at JavaScriptCore: WTF::StringImpl::contains...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2017 03:47:43 +0000 (03:47 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2017 03:47:43 +0000 (03:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167106
<rdar://problem/24457632>

Reviewed by Tim Horton.

Speculative fix.

* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):

    Test before casting to Text.

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

Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/DataDetection.mm

index 79cc877..a4409d2 100644 (file)
@@ -1,3 +1,18 @@
+2017-01-16  Antti Koivisto  <antti@apple.com>
+
+        CrashTracer: com.apple.WebKit.WebContent at JavaScriptCore: WTF::StringImpl::containsOnlyWhitespace
+        https://bugs.webkit.org/show_bug.cgi?id=167106
+        <rdar://problem/24457632>
+
+        Reviewed by Tim Horton.
+
+        Speculative fix.
+
+        * editing/cocoa/DataDetection.mm:
+        (WebCore::DataDetection::detectContentInRange):
+
+            Test before casting to Text.
+
 2017-01-16  Javier Fernandez  <jfernandez@igalia.com>
 
         [css-grid] Implementing baseline positioning for grid containers
index a513d06..7c2a981 100644 (file)
@@ -577,7 +577,8 @@ NSArray *DataDetection::detectContentInRange(RefPtr<Range>& contextRange, DataDe
             auto* parentNode = range->startContainer().parentNode();
             if (!parentNode)
                 continue;
-
+            if (!is<Text>(range->startContainer()))
+                continue;
             auto& currentTextNode = downcast<Text>(range->startContainer());
             Document& document = currentTextNode.document();
             String textNodeData;