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
parent 9a2b100be9
commit be10e8df64
2 changed files with 17 additions and 2 deletions

View File

@ -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;
}

View File

@ -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>