Changeset 189942 in webkit
- Timestamp:
- Sep 17, 2015, 4:22:52 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
editing/mac/DictionaryLookup.mm (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r189941 r189942 1 2015-09-17 Tim Horton <timothy_horton@apple.com> 2 3 Block Objective-C exceptions in DictionaryLookup 4 https://bugs.webkit.org/show_bug.cgi?id=149256 5 6 Reviewed by Anders Carlsson. 7 8 * editing/mac/DictionaryLookup.mm: 9 (WebCore::DictionaryLookup::rangeForSelection): 10 (WebCore::DictionaryLookup::rangeAtHitTestResult): 11 (WebCore::expandSelectionByCharacters): 12 (WebCore::DictionaryLookup::stringForPDFSelection): 13 (WebCore::showPopupOrCreateAnimationController): 14 (WebCore::DictionaryLookup::hidePopup): 15 It is possible for Lookup to throw an exception if one of its 16 related services dies for some reason. This shouldn't take down 17 our UI process, so block the exceptions. 18 1 19 2015-09-17 Yusuke Suzuki <utatane.tea@gmail.com> 2 20 -
trunk/Source/WebCore/editing/mac/DictionaryLookup.mm
r189052 r189942 29 29 #if PLATFORM(MAC) 30 30 31 #import "BlockExceptions.h" 31 32 #import "Document.h" 32 33 #import "FocusController.h" … … 84 85 String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get()); 85 86 87 BEGIN_BLOCK_OBJC_EXCEPTIONS; 86 88 // Since we already have the range we want, we just need to grab the returned options. 87 89 if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass()) 88 90 [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options]; 91 END_BLOCK_OBJC_EXCEPTIONS; 89 92 90 93 return selectedRange.release(); … … 128 131 return nullptr; 129 132 133 BEGIN_BLOCK_OBJC_EXCEPTIONS; 134 130 135 NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0); 131 136 … … 141 146 142 147 return TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length); 148 149 END_BLOCK_OBJC_EXCEPTIONS; 150 return nullptr; 143 151 } 144 152 145 153 static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd) 146 154 { 155 BEGIN_BLOCK_OBJC_EXCEPTIONS; 156 147 157 size_t originalLength = selection.string.length; 148 158 [selection extendSelectionAtStart:numberOfCharactersToExpand]; … … 152 162 [selection extendSelectionAtEnd:numberOfCharactersToExpand]; 153 163 charactersAddedAfterEnd = selection.string.length - originalLength - charactersAddedBeforeStart; 164 165 END_BLOCK_OBJC_EXCEPTIONS; 154 166 } 155 167 156 168 NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, NSDictionary **options) 157 169 { 170 BEGIN_BLOCK_OBJC_EXCEPTIONS; 171 158 172 // Don't do anything if there is no character at the point. 159 173 if (!selection || !selection.string.length) … … 187 201 ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]); 188 202 return selection.string; 203 204 END_BLOCK_OBJC_EXCEPTIONS; 205 return nil; 189 206 } 190 207 191 208 static PlatformAnimationController showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, std::function<void(TextIndicator&)> textIndicatorInstallationCallback) 192 209 { 210 BEGIN_BLOCK_OBJC_EXCEPTIONS; 211 193 212 if (!getLULookupDefinitionModuleClass()) 194 213 return nil; … … 233 252 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()]; 234 253 return nil; 254 255 END_BLOCK_OBJC_EXCEPTIONS; 256 return nil; 235 257 } 236 258 … … 242 264 void DictionaryLookup::hidePopup() 243 265 { 266 BEGIN_BLOCK_OBJC_EXCEPTIONS; 267 244 268 if (!getLULookupDefinitionModuleClass()) 245 269 return; 246 270 [getLULookupDefinitionModuleClass() hideDefinition]; 271 272 END_BLOCK_OBJC_EXCEPTIONS; 247 273 } 248 274
Note:
See TracChangeset
for help on using the changeset viewer.