[BlackBerry] Null check calls associated with retrieving the caret rect.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2012 21:38:45 +0000 (21:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2012 21:38:45 +0000 (21:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103281

Patch by Nima Ghanavatian <nghanavatian@rim.com> on 2012-11-26
Reviewed by Rob Buis.

Some of these calls can return null, which could lead to a crash.

Internally reviewed by Gen Mak.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::requestSpellingCheckingOptions):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

index 8950d4e..ac81c74 100644 (file)
@@ -1,3 +1,17 @@
+2012-11-26  Nima Ghanavatian  <nghanavatian@rim.com>
+
+        [BlackBerry] Null check calls associated with retrieving the caret rect.
+        https://bugs.webkit.org/show_bug.cgi?id=103281
+
+        Reviewed by Rob Buis.
+
+        Some of these calls can return null, which could lead to a crash.
+
+        Internally reviewed by Gen Mak.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::requestSpellingCheckingOptions):
+
 2012-11-26  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
 
         [BlackBerry] Should not autofill username and password when there're more than one password inputs on the same page
 2012-11-26  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
 
         [BlackBerry] Should not autofill username and password when there're more than one password inputs on the same page
index 115b2fb..7d0ae6b 100644 (file)
@@ -743,6 +743,9 @@ void InputHandler::requestSpellingCheckingOptions(imf_sp_text_t& spellCheckingOp
     if (m_webPage->focusedOrMainFrame()->selection()->selectionType() != VisibleSelection::CaretSelection)
         return;
 
     if (m_webPage->focusedOrMainFrame()->selection()->selectionType() != VisibleSelection::CaretSelection)
         return;
 
+    if (!m_currentFocusElement || !m_currentFocusElement->document() || !m_currentFocusElement->document()->frame())
+        return;
+
     // imf_sp_text_t should be generated in pixel viewport coordinates.
     WebCore::IntRect caretRect = m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds();
     caretRect = m_webPage->focusedOrMainFrame()->view()->contentsToRootView(caretRect);
     // imf_sp_text_t should be generated in pixel viewport coordinates.
     WebCore::IntRect caretRect = m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds();
     caretRect = m_webPage->focusedOrMainFrame()->view()->contentsToRootView(caretRect);