Changeset 194064 in webkit
- Timestamp:
- Dec 14, 2015, 3:07:19 PM (11 years ago)
- Location:
- branches/safari-601-branch/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
editing/mac/DictionaryLookup.mm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601-branch/Source/WebCore/ChangeLog
r194049 r194064 1 2015-12-14 Matthew Hanson <matthew_hanson@apple.com> 2 3 Merge r189942. rdar://problem/23886455 4 5 2015-09-17 Tim Horton <timothy_horton@apple.com> 6 7 Block Objective-C exceptions in DictionaryLookup 8 https://bugs.webkit.org/show_bug.cgi?id=149256 9 10 Reviewed by Anders Carlsson. 11 12 * editing/mac/DictionaryLookup.mm: 13 (WebCore::DictionaryLookup::rangeForSelection): 14 (WebCore::DictionaryLookup::rangeAtHitTestResult): 15 (WebCore::expandSelectionByCharacters): 16 (WebCore::DictionaryLookup::stringForPDFSelection): 17 (WebCore::showPopupOrCreateAnimationController): 18 (WebCore::DictionaryLookup::hidePopup): 19 It is possible for Lookup to throw an exception if one of its 20 related services dies for some reason. This shouldn't take down 21 our UI process, so block the exceptions. 22 1 23 2015-12-14 Babak Shafiei <bshafiei@apple.com> 2 24 -
branches/safari-601-branch/Source/WebCore/editing/mac/DictionaryLookup.mm
r183286 r194064 29 29 #if PLATFORM(MAC) 30 30 31 #import "BlockExceptions.h" 31 32 #import "Document.h" 32 33 #import "FocusController.h" … … 98 99 String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get()); 99 100 101 BEGIN_BLOCK_OBJC_EXCEPTIONS; 100 102 // Since we already have the range we want, we just need to grab the returned options. 101 103 if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass()) 102 104 [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options]; 105 END_BLOCK_OBJC_EXCEPTIONS; 103 106 104 107 return selectedRange.release(); … … 141 144 return nullptr; 142 145 146 BEGIN_BLOCK_OBJC_EXCEPTIONS; 147 143 148 NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0); 144 149 … … 154 159 155 160 return TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length); 161 162 END_BLOCK_OBJC_EXCEPTIONS; 163 return nullptr; 156 164 } 157 165 158 166 static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd) 159 167 { 168 BEGIN_BLOCK_OBJC_EXCEPTIONS; 169 160 170 size_t originalLength = selection.string.length; 161 171 [selection extendSelectionAtStart:numberOfCharactersToExpand]; … … 165 175 [selection extendSelectionAtEnd:numberOfCharactersToExpand]; 166 176 charactersAddedAfterEnd = selection.string.length - originalLength - charactersAddedBeforeStart; 177 178 END_BLOCK_OBJC_EXCEPTIONS; 167 179 } 168 180 169 181 NSString *dictionaryLookupForPDFSelection(PDFSelection *selection, NSDictionary **options) 170 182 { 183 BEGIN_BLOCK_OBJC_EXCEPTIONS; 184 171 185 // Don't do anything if there is no character at the point. 172 186 if (!selection || !selection.string.length) … … 200 214 ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]); 201 215 return selection.string; 216 217 END_BLOCK_OBJC_EXCEPTIONS; 218 return nil; 202 219 } 203 220
Note:
See TracChangeset
for help on using the changeset viewer.