Skip to content

Commit

Permalink
Bug 769672 - GCLI shouldn't grab focus on startup; r=dcamp
Browse files Browse the repository at this point in the history
  • Loading branch information
joewalker committed Jul 5, 2012
1 parent b4e9265 commit 10210f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ var gBrowserInit = {

// Show the toolbar if it was previously visible
if (gPrefService.getBoolPref("devtools.toolbar.visible")) {
DeveloperToolbar.show();
DeveloperToolbar.show(false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion browser/devtools/commandline/test/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let DeveloperToolbarTest = {
ok(false, "DeveloperToolbar.visible at start of openDeveloperToolbar");
}
else {
DeveloperToolbar.show(aCallback);
DeveloperToolbar.show(true, aCallback);
}
},

Expand Down
13 changes: 8 additions & 5 deletions browser/devtools/shared/DeveloperToolbar.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ DeveloperToolbar.prototype.toggle = function DT_toggle()
if (this.visible) {
this.hide();
} else {
this.show();
this.show(true);
}
};

Expand All @@ -123,7 +123,7 @@ DeveloperToolbar.introShownThisSession = false;
* @param aCallback show events can be asynchronous. If supplied aCallback will
* be called when the DeveloperToolbar is visible
*/
DeveloperToolbar.prototype.show = function DT_show(aCallback)
DeveloperToolbar.prototype.show = function DT_show(aFocus, aCallback)
{
if (this._lastState != NOTIFICATIONS.HIDE) {
return;
Expand All @@ -138,7 +138,7 @@ DeveloperToolbar.prototype.show = function DT_show(aCallback)
let checkLoad = function() {
if (this.tooltipPanel && this.tooltipPanel.loaded &&
this.outputPanel && this.outputPanel.loaded) {
this._onload();
this._onload(aFocus);
}
}.bind(this);

Expand All @@ -151,7 +151,7 @@ DeveloperToolbar.prototype.show = function DT_show(aCallback)
* Initializing GCLI can only be done when we've got content windows to write
* to, so this needs to be done asynchronously.
*/
DeveloperToolbar.prototype._onload = function DT_onload()
DeveloperToolbar.prototype._onload = function DT_onload(aFocus)
{
this._doc.getElementById("Tools:DevToolbar").setAttribute("checked", "true");

Expand Down Expand Up @@ -193,7 +193,10 @@ DeveloperToolbar.prototype._onload = function DT_onload()
this._initErrorsCount(this._chromeWindow.getBrowser().selectedTab);

this._element.hidden = false;
this._input.focus();

if (aFocus) {
this._input.focus();
}

this._notify(NOTIFICATIONS.SHOW);
if (this._pendingShowCallback) {
Expand Down
2 changes: 1 addition & 1 deletion browser/devtools/shared/test/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let DeveloperToolbarTest = {
ok(false, "DeveloperToolbar.visible at start of openDeveloperToolbar");
}
else {
DeveloperToolbar.show(aCallback);
DeveloperToolbar.show(true, aCallback);
}
},

Expand Down

0 comments on commit 10210f0

Please sign in to comment.