Bug 725215 - Add magic shortcut to enable debugging features [r=cjones]

This commit is contained in:
Fabrice Desré 2012-02-08 12:43:49 -08:00
parent d33b13e30f
commit bdbdb8bd15

View File

@ -66,6 +66,8 @@ function addPermissions(urls) {
var shell = { var shell = {
// FIXME/bug 678695: this should be a system setting // FIXME/bug 678695: this should be a system setting
preferredScreenBrightness: 1.0, preferredScreenBrightness: 1.0,
isDebug: false,
get contentBrowser() { get contentBrowser() {
delete this.contentBrowser; delete this.contentBrowser;
@ -145,6 +147,7 @@ var shell = {
window.controllers.removeController(this); window.controllers.removeController(this);
window.removeEventListener('keypress', this); window.removeEventListener('keypress', this);
window.removeEventListener('MozApplicationManifest', this); window.removeEventListener('MozApplicationManifest', this);
window.removeEventListener('AppCommand', this);
}, },
supportsCommand: function shell_supportsCommand(cmd) { 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) { handleEvent: function shell_handleEvent(evt) {
switch (evt.type) { switch (evt.type) {
case 'keypress': case 'keypress':
@ -199,6 +214,9 @@ var shell = {
case 'Menu': case 'Menu':
this.sendEvent(content, 'menu'); this.sendEvent(content, 'menu');
break; break;
case 'Search':
this.toggleDebug();
break;
} }
break; break;
case 'load': case 'load':