Title: [148710] trunk/Source/WebKit/blackberry
Revision
148710
Author
commit-qu...@webkit.org
Date
2013-04-18 15:45:32 -0700 (Thu, 18 Apr 2013)

Log Message

[BlackBerry] Invalidate spell checking requests in platform code
https://bugs.webkit.org/show_bug.cgi?id=114830

Patch by Nima Ghanavatian <nghanavat...@blackberry.com> on 2013-04-18
Reviewed by Rob Buis.

Internally reviewed by Mike Fenton.

Cache the value of the last requested sequence id at focus change.
All requests prior to this point will be rejected upon processing.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::InputHandler):
(BlackBerry::WebKit::InputHandler::requestCheckingOfString):
(BlackBerry::WebKit::InputHandler::stopPendingSpellCheckRequests):
* WebKitSupport/InputHandler.h:
(InputHandler):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (148709 => 148710)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-04-18 22:45:25 UTC (rev 148709)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-04-18 22:45:32 UTC (rev 148710)
@@ -1,3 +1,22 @@
+2013-04-18 Nima Ghanavatian <nghanavat...@blackberry.com>
+
+        [BlackBerry] Invalidate spell checking requests in platform code
+        https://bugs.webkit.org/show_bug.cgi?id=114830
+
+        Reviewed by Rob Buis.
+
+        Internally reviewed by Mike Fenton.
+
+        Cache the value of the last requested sequence id at focus change.
+        All requests prior to this point will be rejected upon processing.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::InputHandler):
+        (BlackBerry::WebKit::InputHandler::requestCheckingOfString):
+        (BlackBerry::WebKit::InputHandler::stopPendingSpellCheckRequests):
+        * WebKitSupport/InputHandler.h:
+        (InputHandler):
+
 2013-04-17  Geoffrey Garen  <gga...@apple.com>
 
         Renamed JSGlobalData to VM

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (148709 => 148710)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-04-18 22:45:25 UTC (rev 148709)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-04-18 22:45:32 UTC (rev 148710)
@@ -154,6 +154,7 @@
     , m_spellingHandler(new SpellingHandler(this))
     , m_spellCheckStatusConfirmed(false)
     , m_globalSpellCheckStatus(false)
+    , m_minimumSpellCheckingRequestSequence(-1)
 {
 }
 
@@ -608,6 +609,13 @@
         return;
     }
 
+    if (spellCheckRequest->data().sequence() <= m_minimumSpellCheckingRequestSequence) {
+        SpellingLog(Platform::LogLevelWarn, "InputHandler::requestCheckingOfString rejecting stale request with sequenceId=%d. Sentinal currently at %d."
+            , spellCheckRequest->data().sequence(), m_minimumSpellCheckingRequestSequence);
+        spellCheckRequest->didCancel();
+        return;
+    }
+
     unsigned requestLength = spellCheckRequest->data().text().length();
 
     // Check if the field should be spellchecked.
@@ -1171,9 +1179,9 @@
     m_spellingHandler->setSpellCheckActive(false);
     // Prevent response from propagating through
     m_processingTransactionId = 0;
-    // Clear the pending queue as well
-    if (m_request)
-        m_request->setCheckerAndSequence(getSpellChecker(), -1);
+    // Reject requests until lastRequestSequence. This helps us clear the queue of stale requests.
+    if (SpellChecker* spellChecker = getSpellChecker())
+        m_minimumSpellCheckingRequestSequence = spellChecker->lastRequestSequence();
 }
 
 void InputHandler::redrawSpellCheckDialogIfRequired(const bool shouldMoveDialog)

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (148709 => 148710)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-04-18 22:45:25 UTC (rev 148709)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-04-18 22:45:32 UTC (rev 148710)
@@ -264,6 +264,7 @@
     SpellingHandler* m_spellingHandler;
     bool m_spellCheckStatusConfirmed;
     bool m_globalSpellCheckStatus;
+    int m_minimumSpellCheckingRequestSequence;
 
     OwnPtr<WebCore::SuggestionBoxHandler> m_suggestionDropdownBoxHandler;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to