Bug 1276901 - prevent null pointer dereference on |nativeKeyEvent|. r=dholbert
authorAndi-Bogdan Postelnicu <bogdan.postelnicu@softvision.ro>
Tue, 31 May 2016 15:41:12 +0300
changeset 347203 9af43b01f02285d768296deca106dd54741bc01b
parent 347202 fa64968dc3a1f412cacf9a961dc5efdd2e9f26de
child 347204 9653ade83c4b632af7f5fe480c8b5c00b19e8a0b
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1276901
milestone52.0a1
Bug 1276901 - prevent null pointer dereference on |nativeKeyEvent|. r=dholbert MozReview-Commit-ID: J3GtMQDU1Yq
layout/xul/nsMenuBarListener.cpp
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -206,17 +206,18 @@ nsMenuBarListener::KeyPress(nsIDOMEvent*
   InitAccessKey();
 
   if (mAccessKey)
   {
     // If accesskey handling was forwarded to a child process, wait for
     // the mozaccesskeynotfound event before handling accesskeys.
     WidgetKeyboardEvent* nativeKeyEvent =
       aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
-    if (nativeKeyEvent && nativeKeyEvent->mAccessKeyForwardedToChild) {
+    if (!nativeKeyEvent ||
+        (nativeKeyEvent && nativeKeyEvent->mAccessKeyForwardedToChild)) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
     uint32_t keyCode, charCode;
     keyEvent->GetKeyCode(&keyCode);
     keyEvent->GetCharCode(&charCode);