зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265599 - Fix gcli toolbox button status when toolbox goes on and off. r=jwalker
This commit is contained in:
Родитель
234d71531a
Коммит
8cbb062041
|
@ -584,11 +584,11 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
|
||||
let hasToolbox = gDevToolsBrowser.hasToolboxOpened(win);
|
||||
|
||||
let broadcaster = win.document.getElementById("menu_devToolbox");
|
||||
let menu = win.document.getElementById("menu_devToolbox");
|
||||
if (hasToolbox) {
|
||||
broadcaster.setAttribute("checked", "true");
|
||||
menu.setAttribute("checked", "true");
|
||||
} else {
|
||||
broadcaster.removeAttribute("checked");
|
||||
menu.removeAttribute("checked");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ loader.lazyGetter(this, "toolboxStrings", function () {
|
|||
loader.lazyRequireGetter(this, "gcliInit", "devtools/shared/gcli/commands/index");
|
||||
loader.lazyRequireGetter(this, "util", "gcli/util/util");
|
||||
loader.lazyRequireGetter(this, "ConsoleServiceListener", "devtools/shared/webconsole/utils", true);
|
||||
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
|
||||
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
|
||||
|
||||
/**
|
||||
|
@ -240,6 +241,9 @@ function DeveloperToolbar(aChromeWindow)
|
|||
this._warningsCount = {};
|
||||
this._errorListeners = {};
|
||||
|
||||
this._onToolboxReady = this._onToolboxReady.bind(this);
|
||||
this._onToolboxDestroyed = this._onToolboxDestroyed.bind(this);
|
||||
|
||||
EventEmitter.decorate(this);
|
||||
}
|
||||
exports.DeveloperToolbar = DeveloperToolbar;
|
||||
|
@ -496,6 +500,9 @@ DeveloperToolbar.prototype.show = function(focus) {
|
|||
tabbrowser.addEventListener("load", this, true);
|
||||
tabbrowser.addEventListener("beforeunload", this, true);
|
||||
|
||||
gDevTools.on("toolbox-ready", this._onToolboxReady);
|
||||
gDevTools.on("toolbox-destroyed", this._onToolboxDestroyed);
|
||||
|
||||
this._initErrorsCount(tabbrowser.selectedTab);
|
||||
|
||||
this._element.hidden = false;
|
||||
|
@ -634,6 +641,9 @@ DeveloperToolbar.prototype.destroy = function() {
|
|||
tabbrowser.removeEventListener("load", this, true);
|
||||
tabbrowser.removeEventListener("beforeunload", this, true);
|
||||
|
||||
gDevTools.off("toolbox-ready", this._onToolboxReady);
|
||||
gDevTools.off("toolbox-destroyed", this._onToolboxDestroyed);
|
||||
|
||||
Array.prototype.forEach.call(tabbrowser.tabs, this._stopErrorsCount, this);
|
||||
|
||||
this.focusManager.removeMonitoredElement(this.outputPanel._frame);
|
||||
|
@ -708,6 +718,16 @@ DeveloperToolbar.prototype.handleEvent = function(ev) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update toolbox toggle button when toolbox goes on and off
|
||||
*/
|
||||
DeveloperToolbar.prototype._onToolboxReady = function() {
|
||||
this._errorCounterButton.setAttribute("checked", "true");
|
||||
}
|
||||
DeveloperToolbar.prototype._onToolboxDestroyed = function() {
|
||||
this._errorCounterButton.setAttribute("checked", "false");
|
||||
}
|
||||
|
||||
/**
|
||||
* Count a page error received for the currently selected tab. This
|
||||
* method counts the JavaScript exceptions received and CSS errors/warnings.
|
||||
|
|
Загрузка…
Ссылка в новой задаче