Title: [124227] trunk/Source/WebKit/blackberry
Revision
124227
Author
[email protected]
Date
2012-07-31 11:43:02 -0700 (Tue, 31 Jul 2012)

Log Message

[BlackBerry] Fix crash in InputHandler spell checking.
https://bugs.webkit.org/show_bug.cgi?id=92763

Reviewed by Antonio Gomes.

PR 185574.

Fix crash in getSpellChecker by guarding the calling paths
to ensure that m_currentFocusElement is valid.

Also add ASSERTs for previous crash.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed):
(BlackBerry::WebKit::InputHandler::spellCheckingRequestCancelled):
(BlackBerry::WebKit::InputHandler::getSpellChecker):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (124226 => 124227)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-31 18:31:41 UTC (rev 124226)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-31 18:43:02 UTC (rev 124227)
@@ -1,3 +1,22 @@
+2012-07-31  Mike Fenton  <[email protected]>
+
+        [BlackBerry] Fix crash in InputHandler spell checking.
+        https://bugs.webkit.org/show_bug.cgi?id=92763
+
+        Reviewed by Antonio Gomes.
+
+        PR 185574.
+
+        Fix crash in getSpellChecker by guarding the calling paths
+        to ensure that m_currentFocusElement is valid.
+
+        Also add ASSERTs for previous crash.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed):
+        (BlackBerry::WebKit::InputHandler::spellCheckingRequestCancelled):
+        (BlackBerry::WebKit::InputHandler::getSpellChecker):
+
 2012-07-31  Genevieve Mak  <[email protected]>
 
         Send an onContextMenu event to the page content

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (124226 => 124227)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-07-31 18:31:41 UTC (rev 124226)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-07-31 18:43:02 UTC (rev 124227)
@@ -577,7 +577,7 @@
 
 void InputHandler::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString)
 {
-    if (!spannableString) {
+    if (!spannableString || !isActiveTextEdit()) {
         spellCheckingRequestCancelled(transactionId, false /* isSequenceId */);
         return;
     }
@@ -625,6 +625,9 @@
 
 void InputHandler::spellCheckingRequestCancelled(int32_t id, bool isSequenceId)
 {
+    if (!isActiveTextEdit())
+        return;
+
     int32_t sequenceId = isSequenceId ? id : convertTransactionIdToSequenceId(id);
     SpellChecker* sp = getSpellChecker();
     if (!sp) {
@@ -636,6 +639,9 @@
 
 SpellChecker* InputHandler::getSpellChecker()
 {
+    ASSERT(m_currentFocusElement);
+    ASSERT(m_currentFocusElement->document());
+
     if (Frame* frame = m_currentFocusElement->document()->frame())
         if (Editor* editor = frame->editor())
             return editor->spellChecker();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to