Bug 915962 - Part 3: Do not crash when pressing the space bar without having an element focused; r=roc

This commit is contained in:
Ehsan Akhgari 2015-04-21 14:06:54 -04:00
Родитель 345ba44baa
Коммит 3b10fd3fcb
2 изменённых файлов: 17 добавлений и 2 удалений

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

@ -478,7 +478,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
}
// If the focus is in an editable region, don't scroll.
if (focusedContent->IsEditable()) {
if (focusedContent && focusedContent->IsEditable()) {
return NS_OK;
}

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

@ -67,7 +67,22 @@ function startTest() {
win.close();
cwu.restoreNormalRefresh();
SimpleTest.finish();
win = window.open("file_bug915962.html", "_blank",
"width=600,height=600,scrollbars=yes");
cwu = SpecialPowers.getDOMWindowUtils(win);
SimpleTest.waitForFocus(function() {
is(win.scrollY, 0, "Sanity check");
synthesizeKey(" ", {}, win);
step();
isnot(win.scrollY, 0, "Page is scrolled down without crashing");
win.close();
cwu.restoreNormalRefresh();
SimpleTest.finish();
}, win);
}
</script>
</pre>