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 320510 9af43b01f02285d768296deca106dd54741bc01b
parent 320509 fa64968dc3a1f412cacf9a961dc5efdd2e9f26de
child 320511 9653ade83c4b632af7f5fe480c8b5c00b19e8a0b
push id30901
push userkwierso@gmail.com
push dateThu, 03 Nov 2016 00:16:45 +0000
treeherdermozilla-central@ac55a6776435 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1276901
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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);