Bug 762349 - Allow Sleep button to bubble from browser frames. r=jlebar

This commit is contained in:
Vivien Nicolas 2012-06-11 12:58:46 -07:00
parent 4e02d84f2d
commit f29bd73fe9
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
// Event whitelisted for bubbling. // Event whitelisted for bubbling.
let whitelistedEvents = [ let whitelistedEvents = [
Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE, // Back button. Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE, // Back button.
Ci.nsIDOMKeyEvent.DOM_VK_SLEEP, // Power button.
Ci.nsIDOMKeyEvent.DOM_VK_CONTEXT_MENU, Ci.nsIDOMKeyEvent.DOM_VK_CONTEXT_MENU,
Ci.nsIDOMKeyEvent.DOM_VK_F5, // Search button. Ci.nsIDOMKeyEvent.DOM_VK_F5, // Search button.
Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP, // Volume up. Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP, // Volume up.

View File

@ -9,6 +9,7 @@ let Ci = Components.interfaces;
let whitelistedEvents = [ let whitelistedEvents = [
Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE, // Back button. Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE, // Back button.
Ci.nsIDOMKeyEvent.DOM_VK_SLEEP, // Power button
Ci.nsIDOMKeyEvent.DOM_VK_CONTEXT_MENU, Ci.nsIDOMKeyEvent.DOM_VK_CONTEXT_MENU,
Ci.nsIDOMKeyEvent.DOM_VK_F5, // Search button. Ci.nsIDOMKeyEvent.DOM_VK_F5, // Search button.
Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP, // Volume up. Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP, // Volume up.
@ -27,7 +28,7 @@ iframe.src = browserElementTestHelpers.focusPage;
document.body.appendChild(iframe); document.body.appendChild(iframe);
// Number of expected events at which point we will consider the test as done. // Number of expected events at which point we will consider the test as done.
var nbEvents = 15; var nbEvents = whitelistedEvents.length * 3;
function eventHandler(e) { function eventHandler(e) {
ok(((e.type == 'keydown' || e.type == 'keypress' || e.type == 'keyup') && ok(((e.type == 'keydown' || e.type == 'keypress' || e.type == 'keyup') &&
@ -70,6 +71,7 @@ function runTest() {
synthesizeKey("VK_PAGE_UP", {}); // keypress is ignored because .preventDefault() will be called. synthesizeKey("VK_PAGE_UP", {}); // keypress is ignored because .preventDefault() will be called.
synthesizeKey("VK_PAGE_DOWN", {}); // keypress is ignored because .preventDefault() will be called. synthesizeKey("VK_PAGE_DOWN", {}); // keypress is ignored because .preventDefault() will be called.
synthesizeKey("VK_CONTEXT_MENU", {}); synthesizeKey("VK_CONTEXT_MENU", {});
synthesizeKey("VK_SLEEP", {});
} }
SimpleTest.waitForFocus(function() { SimpleTest.waitForFocus(function() {