Title: [116607] trunk/Source/WebKit/chromium
- Revision
- 116607
- Author
- [email protected]
- Date
- 2012-05-09 22:08:42 -0700 (Wed, 09 May 2012)
Log Message
Fix a crash in ContextMenuClientImpl::getCustomMenuFromDefaultItems
https://bugs.webkit.org/show_bug.cgi?id=85866
Reviewed by Ryosuke Niwa.
DocumentMarkerController::markersInRange crashes if the input range is NULL.
This change adds a NULL check before getCustomMenuFromDefaultItems() calls this
function to avoid this crash.
* src/ContextMenuClientImpl.cpp:
(WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Added a NULL check.
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (116606 => 116607)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-10 04:34:08 UTC (rev 116606)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-10 05:08:42 UTC (rev 116607)
@@ -1,3 +1,17 @@
+2012-05-09 Hironori Bono <[email protected]>
+
+ Fix a crash in ContextMenuClientImpl::getCustomMenuFromDefaultItems
+ https://bugs.webkit.org/show_bug.cgi?id=85866
+
+ Reviewed by Ryosuke Niwa.
+
+ DocumentMarkerController::markersInRange crashes if the input range is NULL.
+ This change adds a NULL check before getCustomMenuFromDefaultItems() calls this
+ function to avoid this crash.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Added a NULL check.
+
2012-05-09 Sheriff Bot <[email protected]>
Unreviewed, rolling out r116602.
Modified: trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp (116606 => 116607)
--- trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp 2012-05-10 04:34:08 UTC (rev 116606)
+++ trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp 2012-05-10 05:08:42 UTC (rev 116607)
@@ -279,18 +279,20 @@
// a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it.
if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) {
RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange();
- Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling);
- if (!markers.isEmpty()) {
- Vector<String> suggestions;
- for (size_t i = 0; i < markers.size(); ++i) {
- if (!markers[i]->description().isEmpty()) {
- Vector<String> descriptions;
- markers[i]->description().split('\n', descriptions);
- suggestions.append(descriptions);
+ if (range.get()) {
+ Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling);
+ if (!markers.isEmpty()) {
+ Vector<String> suggestions;
+ for (size_t i = 0; i < markers.size(); ++i) {
+ if (!markers[i]->description().isEmpty()) {
+ Vector<String> descriptions;
+ markers[i]->description().split('\n', descriptions);
+ suggestions.append(descriptions);
+ }
}
+ data.dictionarySuggestions = suggestions;
+ data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
}
- data.dictionarySuggestions = suggestions;
- data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
}
} else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
data.isSpellCheckingEnabled = true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes