WK2 iOS: crash when handling a synthetic keyboard event.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 20:50:47 +0000 (20:50 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 20:50:47 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132296
<rdar://problem/16469726>

Reviewed by Benjamin Poulain.

Adding a null check, since synthetic keyboard events do not
have a corresponding platform event. We already do this on OS X.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleEditingKeyboardEvent):

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 4ddd2f9..2405450 100644 (file)
@@ -1,3 +1,17 @@
+2014-04-28  Enrica Casucci  <enrica@apple.com>
+
+        WK2 iOS: crash when handling a synthetic keyboard event.
+        https://bugs.webkit.org/show_bug.cgi?id=132296
+        <rdar://problem/16469726>
+
+        Reviewed by Benjamin Poulain.
+
+        Adding a null check, since synthetic keyboard events do not
+        have a corresponding platform event. We already do this on OS X.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleEditingKeyboardEvent):
+
 2014-04-24  Andy Estes  <aestes@apple.com>
 
         [iOS] Implement WebQuickLookHandleClient for WebKit2
index 5fbae4c..e574db3 100644 (file)
@@ -154,9 +154,13 @@ bool WebPage::allowsUserScaling() const
 
 bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event)
 {
+    const PlatformKeyboardEvent* platformEvent = event->keyEvent();
+    if (!platformEvent)
+        return false;
+
     // FIXME: Interpret the event immediately upon receiving it in UI process, without sending to WebProcess first.
     bool eventWasHandled = false;
-    bool sendResult = WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::InterpretKeyEvent(editorState(), event->keyEvent()->type() == PlatformKeyboardEvent::Char),
+    bool sendResult = WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::InterpretKeyEvent(editorState(), platformEvent->type() == PlatformKeyboardEvent::Char),
                                                                                Messages::WebPageProxy::InterpretKeyEvent::Reply(eventWasHandled), m_pageID);
     if (!sendResult)
         return false;