Bug 1397711 - Null-check widget of keyboard event before invoking its PostHandleKeyEvent. r=masayuki

MozReview-Commit-ID: KTniEBMvw9q

--HG--
extra : rebase_source : 3fa266b0097ee94f83c6567d5cebd66f41369d17
This commit is contained in:
Xidorn Quan 2017-09-07 22:07:34 +10:00
Родитель 9785ff665d
Коммит 32fe2f2b94
3 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -2894,7 +2894,9 @@ EventStateManager::PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
// dispatched to a content process (non-e10s or no content process
// running), we need to short-circuit here. Otherwise, we need to wait for
// the content process to handle the event.
aKeyboardEvent->mWidget->PostHandleKeyEvent(aKeyboardEvent);
if (aKeyboardEvent->mWidget) {
aKeyboardEvent->mWidget->PostHandleKeyEvent(aKeyboardEvent);
}
if (aKeyboardEvent->DefaultPrevented()) {
aStatus = nsEventStatus_eConsumeNoDefault;
return;

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<script>
let code = "x".charCodeAt(0);
let e = new KeyboardEvent("keypress", {
keyCode: code,
charCode: code,
bubbles: true
});
let utils = SpecialPowers.getDOMWindowUtils(window);
utils.dispatchDOMEventViaPresShell(document.documentElement, e, false);
</script>

Просмотреть файл

@ -16,3 +16,4 @@ load eventctor-nulldictionary.html
load eventctor-nullstorage.html
load recursive-DOMNodeInserted.html
load recursive-onload.html
load 1397711.html