Crashes under scanSelectionForTelephoneNumbers in Range::text() on some sites
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jul 2014 03:12:19 +0000 (03:12 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jul 2014 03:12:19 +0000 (03:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135281
<rdar://problem/17803347>

Reviewed by Ryosuke Niwa.

* editing/Editor.cpp:
(WebCore::Editor::scanSelectionForTelephoneNumbers):
toNormalizedRange is not guaranteed to return a non-null range.
If it returns null, pass the empty markedRanges down to the client as our new set.

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

Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp

index 95dc82ea5757a3f114c1c45761340fea7aa68f7c..330a5bff93edb9a2bdaaadd23fc61cb3b351b6a6 100644 (file)
@@ -1,3 +1,16 @@
+2014-07-24  Tim Horton  <timothy_horton@apple.com>
+
+        Crashes under scanSelectionForTelephoneNumbers in Range::text() on some sites
+        https://bugs.webkit.org/show_bug.cgi?id=135281
+        <rdar://problem/17803347>
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::scanSelectionForTelephoneNumbers):
+        toNormalizedRange is not guaranteed to return a non-null range.
+        If it returns null, pass the empty markedRanges down to the client as our new set.
+
 2014-07-24  Dan Bernstein  <mitz@apple.com>
 
         WebCore part of <rdar://problem/17593701> Assertion failure in WebPage::reload (!m_pendingNavigationID) when reloading after a same-document back navigation
index fea89b8c885d9d36cf93b7d65f84f626bfdadbb4..0e996c1b7a43595cd8b54448cf8d1f6bdaad733b 100644 (file)
@@ -3393,6 +3393,11 @@ void Editor::scanSelectionForTelephoneNumbers()
     extendedSelection.setEnd(end);
     RefPtr<Range> extendedRange = extendedSelection.toNormalizedRange();
 
+    if (!extendedRange) {
+        client()->selectedTelephoneNumberRangesChanged(markedRanges);
+        return;
+    }
+
     scanRangeForTelephoneNumbers(*extendedRange, extendedRange->text(), markedRanges);
 
     // Only consider ranges with a detected telephone number if they overlap with the actual selection range.