mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Bug 1510690 - Do focus the content window from the actor when the toolbox closes. r=nchevobbe
No RDP request should be done when the toolbox closes as there no guarantee that the request will complete. Instead, such cleanup should be done by the actors. Differential Revision: https://phabricator.services.mozilla.com/D38309
This commit is contained in:
1 parent
f847c5455b
commit
b446e32dd9
4 files changed
+24
-9
No files matched your search
@@ -763,6 +763,15 @@ Toolbox.prototype = {
|
||||
|
||||
await promise.all([splitConsolePromise, framesPromise]);
|
||||
|
||||
// Request the actor to restore the focus to the content page once the
|
||||
// target is detached. This typically happens when the console closes.
|
||||
// We restore the focus as it may have been stolen by the console input.
|
||||
await this.target.reconfigure({
|
||||
options: {
|
||||
restoreFocus: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Lazily connect to the profiler here and don't wait for it to complete,
|
||||
// used to intercept console.profile calls before the performance tools are open.
|
||||
const performanceFrontConnection = this.initPerformance();
|
||||
|
||||
@@ -13,12 +13,20 @@ add_task(async function() {
|
||||
info("Focus after console is opened");
|
||||
ok(isInputFocused(hud), "input node is focused after console is opened");
|
||||
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
this.onFocus = new Promise(resolve => {
|
||||
content.addEventListener("focus", resolve, { once: true });
|
||||
});
|
||||
});
|
||||
|
||||
info("Closing console");
|
||||
await closeConsole();
|
||||
|
||||
const isFocused = await ContentTask.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
{},
|
||||
function() {
|
||||
async function() {
|
||||
await this.onFocus;
|
||||
return Services.focus.focusedWindow == content;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -386,14 +386,6 @@ class WebConsole {
|
||||
this.ui.destroy();
|
||||
}
|
||||
|
||||
if (!this.isBrowserConsole) {
|
||||
try {
|
||||
await this.target.focus();
|
||||
} catch (ex) {
|
||||
// Tab focus can fail if the tab or target is closed.
|
||||
}
|
||||
}
|
||||
|
||||
if (this._parserService) {
|
||||
this._parserService.stop();
|
||||
this._parserService = null;
|
||||
|
||||
@@ -1135,6 +1135,9 @@ const browsingContextTargetPrototype = {
|
||||
options.serviceWorkersTestingEnabled
|
||||
);
|
||||
}
|
||||
if (typeof options.restoreFocus == "boolean") {
|
||||
this._restoreFocus = options.restoreFocus;
|
||||
}
|
||||
|
||||
// Reload if:
|
||||
// - there's an explicit `performReload` flag and it's true
|
||||
@@ -1157,6 +1160,9 @@ const browsingContextTargetPrototype = {
|
||||
this._setCacheDisabled(false);
|
||||
this._setServiceWorkersTestingEnabled(false);
|
||||
this._setPaintFlashingEnabled(false);
|
||||
if (this._restoreFocus) {
|
||||
this.window.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user