Bug 1241707 - [e10s] Web Console should restore focus to proper place when closed. r=jryans,r=bgrins

MozReview-Commit-ID: JlcJPGygm5F
This commit is contained in:
Lin Clark 2016-02-16 14:37:45 -08:00
Родитель e92404de69
Коммит 0365aa63c5
3 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -12,6 +12,7 @@ var WebConsoleUtils = require("devtools/shared/webconsole/utils").Utils;
var Heritage = require("sdk/core/heritage");
var {TargetFactory} = require("devtools/client/framework/target");
var {Tools} = require("devtools/client/definitions");
const { Task } = require("resource://gre/modules/Task.jsm");
var promise = require("promise");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
@ -587,10 +588,9 @@ WebConsole.prototype = {
}
}
let onDestroy = function WC_onDestroyUI() {
let onDestroy = Task.async(function*() {
try {
let tabWindow = this.target.isLocalTab ? this.target.window : null;
tabWindow && tabWindow.focus();
yield this.target.activeTab.focus()
}
catch (ex) {
// Tab focus can fail if the tab or target is closed.
@ -599,7 +599,7 @@ WebConsole.prototype = {
let id = WebConsoleUtils.supportsString(this.hudId);
Services.obs.notifyObservers(id, "web-console-destroyed", null);
this._destroyer.resolve(null);
}.bind(this);
}.bind(this));
if (this.ui) {
this.ui.destroy().then(onDestroy);

Просмотреть файл

@ -1399,6 +1399,16 @@ TabActor.prototype = {
return { type: "detached" };
},
/**
* Bring the tab's window to front.
*/
onFocus: function() {
if (this.window) {
this.window.focus();
}
return {};
},
/**
* Reload the page in this tab.
*/
@ -1900,6 +1910,7 @@ TabActor.prototype = {
TabActor.prototype.requestTypes = {
"attach": TabActor.prototype.onAttach,
"detach": TabActor.prototype.onDetach,
"focus": TabActor.prototype.onFocus,
"reload": TabActor.prototype.onReload,
"navigateTo": TabActor.prototype.onNavigateTo,
"reconfigure": TabActor.prototype.onReconfigure,

Просмотреть файл

@ -1315,6 +1315,13 @@ TabClient.prototype = {
telemetry: "TABDETACH"
}),
/**
* Bring the window to the front.
*/
focus: DebuggerClient.requester({
type: "focus"
}, {}),
/**
* Reload the page in this tab.
*