Bug 1097814 - Fix home button in b2g desktop. r=fabrice
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 18 Nov 2014 04:13:00 +0100
changeset 216843 f1d347872c228919b7f8cb9a51722f8728d1eec8
parent 216842 a89cb5569eca9dabc9d73b6b7001aa897df5631a
child 216844 2513d21bbff2bfdca66e7fd6eab236e5aba25445
push id27866
push userkwierso@gmail.com
push dateFri, 21 Nov 2014 23:04:21 +0000
treeherdermozilla-central@b612d5a501f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs1097814
milestone36.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 1097814 - Fix home button in b2g desktop. r=fabrice
b2g/chrome/content/desktop.js
--- a/b2g/chrome/content/desktop.js
+++ b/b2g/chrome/content/desktop.js
@@ -25,21 +25,25 @@ function setupButtons() {
     // The toolbar only exists in b2g desktop build with
     // FXOS_SIMULATOR turned on.
     return;
   }
   // The touch event helper is enabled on shell.html document,
   // so that click events are delayed and it is better to
   // listen for touch events.
   homeButton.addEventListener('touchstart', function() {
-    shell.sendChromeEvent({type: 'home-button-press'});
+    let window = shell.contentBrowser.contentWindow;
+    let e = new window.KeyboardEvent('keydown', {key: 'Home'});
+    window.dispatchEvent(e);
     homeButton.classList.add('active');
   });
   homeButton.addEventListener('touchend', function() {
-    shell.sendChromeEvent({type: 'home-button-release'});
+    let window = shell.contentBrowser.contentWindow;
+    let e = new window.KeyboardEvent('keyup', {key: 'Home'});
+    window.dispatchEvent(e);
     homeButton.classList.remove('active');
   });
 
   Cu.import("resource://gre/modules/GlobalSimulatorScreen.jsm");
   let rotateButton = document.getElementById('rotate-button');
   rotateButton.addEventListener('touchstart', function () {
     rotateButton.classList.add('active');
   });