From bdbdb8bd156daa735d4a69683b8d88528a1a9412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Wed, 8 Feb 2012 12:43:49 -0800 Subject: [PATCH] Bug 725215 - Add magic shortcut to enable debugging features [r=cjones] --- b2g/chrome/content/shell.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index c922a3f6862..4facc01217b 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -66,6 +66,8 @@ function addPermissions(urls) { var shell = { // FIXME/bug 678695: this should be a system setting preferredScreenBrightness: 1.0, + + isDebug: false, get contentBrowser() { delete this.contentBrowser; @@ -145,6 +147,7 @@ var shell = { window.controllers.removeController(this); window.removeEventListener('keypress', this); window.removeEventListener('MozApplicationManifest', this); + window.removeEventListener('AppCommand', this); }, supportsCommand: function shell_supportsCommand(cmd) { @@ -172,6 +175,18 @@ var shell = { } }, + toggleDebug: function shell_toggleDebug() { + this.isDebug = !this.isDebug; + + if (this.isDebug) { + Services.prefs.setBoolPref("layers.acceleration.draw-fps", true); + Services.prefs.setBoolPref("nglayout.debug.paint_flashing", true); + } else { + Services.prefs.setBoolPref("layers.acceleration.draw-fps", false); + Services.prefs.setBoolPref("nglayout.debug.paint_flashing", false); + } + }, + handleEvent: function shell_handleEvent(evt) { switch (evt.type) { case 'keypress': @@ -199,6 +214,9 @@ var shell = { case 'Menu': this.sendEvent(content, 'menu'); break; + case 'Search': + this.toggleDebug(); + break; } break; case 'load':