Title: [194064] branches/safari-601-branch/Source/WebCore
Revision
194064
Author
[email protected]
Date
2015-12-14 15:07:19 -0800 (Mon, 14 Dec 2015)

Log Message

Merge r189942. rdar://problem/23886455

Modified Paths

Diff

Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (194063 => 194064)


--- branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-14 23:01:04 UTC (rev 194063)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog	2015-12-14 23:07:19 UTC (rev 194064)
@@ -1,3 +1,25 @@
+2015-12-14  Matthew Hanson  <[email protected]>
+
+        Merge r189942. rdar://problem/23886455
+
+    2015-09-17  Tim Horton  <[email protected]>
+
+            Block Objective-C exceptions in DictionaryLookup
+            https://bugs.webkit.org/show_bug.cgi?id=149256
+
+            Reviewed by Anders Carlsson.
+
+            * editing/mac/DictionaryLookup.mm:
+            (WebCore::DictionaryLookup::rangeForSelection):
+            (WebCore::DictionaryLookup::rangeAtHitTestResult):
+            (WebCore::expandSelectionByCharacters):
+            (WebCore::DictionaryLookup::stringForPDFSelection):
+            (WebCore::showPopupOrCreateAnimationController):
+            (WebCore::DictionaryLookup::hidePopup):
+            It is possible for Lookup to throw an exception if one of its
+            related services dies for some reason. This shouldn't take down
+            our UI process, so block the exceptions.
+
 2015-12-14  Babak Shafiei  <[email protected]>
 
         Merge r193999.

Modified: branches/safari-601-branch/Source/WebCore/editing/mac/DictionaryLookup.mm (194063 => 194064)


--- branches/safari-601-branch/Source/WebCore/editing/mac/DictionaryLookup.mm	2015-12-14 23:01:04 UTC (rev 194063)
+++ branches/safari-601-branch/Source/WebCore/editing/mac/DictionaryLookup.mm	2015-12-14 23:07:19 UTC (rev 194064)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(MAC)
 
+#import "BlockExceptions.h"
 #import "Document.h"
 #import "FocusController.h"
 #import "Frame.h"
@@ -97,9 +98,11 @@
 
     String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get());
 
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     // Since we already have the range we want, we just need to grab the returned options.
     if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass())
         [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options];
+    END_BLOCK_OBJC_EXCEPTIONS;
 
     return selectedRange.release();
 }
@@ -140,6 +143,8 @@
     if (!fullCharacterRange)
         return nullptr;
 
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
     NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0);
 
     String fullPlainTextString = plainText(fullCharacterRange.get());
@@ -153,10 +158,15 @@
         return nullptr;
 
     return TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return nullptr;
 }
 
 static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
     size_t originalLength = selection.string.length;
     [selection extendSelectionAtStart:numberOfCharactersToExpand];
     
@@ -164,10 +174,14 @@
     
     [selection extendSelectionAtEnd:numberOfCharactersToExpand];
     charactersAddedAfterEnd = selection.string.length - originalLength - charactersAddedBeforeStart;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
 NSString *dictionaryLookupForPDFSelection(PDFSelection *selection, NSDictionary **options)
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
     // Don't do anything if there is no character at the point.
     if (!selection || !selection.string.length)
         return @"";
@@ -199,6 +213,9 @@
     
     ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]);
     return selection.string;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return nil;
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to