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 = {
// 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':