Bug 1776853 - [devtools] Don't restore target configuration when it is destroyed because of switching mode. r=jdescottes.

Differential Revision: https://phabricator.services.mozilla.com/D152887
This commit is contained in:
Nicolas Chevobbe 2022-08-01 09:33:19 +00:00
parent 27454e1bd3
commit ee36d4491f
2 changed files with 11 additions and 6 deletions

View File

@ -52,8 +52,8 @@ add_task(async function() {
async function checkMessages(isFissionSupported) {
await pushPref("devtools.browsertoolbox.fission", isFissionSupported);
// Add the tab first so it creates the ContentProcess
await addTab(TEST_URI);
// Open the WebConsole on the tab to check changing mode won't focus the tab
await openNewTabAndConsole(TEST_URI);
// Open the Browser Console
const hud = await BrowserConsoleManager.toggleBrowserConsole();
@ -192,6 +192,11 @@ async function checkMessages(isFissionSupported) {
"Parent process Browser Console",
"Browser Console window title was updated"
);
ok(
hud.iframeWindow.document.hasFocus(),
"Browser Console is still focused"
);
}
info(

View File

@ -686,10 +686,10 @@ const windowGlobalTargetPrototype = {
if (this.docShell) {
this._unwatchDocShell(this.docShell);
// If this target is being destroyed as part of a target switch, we don't need to
// restore the configuration (this might cause the content page to be focused again
// and cause issues in tets).
if (!isTargetSwitching) {
// If this target is being destroyed as part of a target switch or a mode switch,
// we don't need to restore the configuration (this might cause the content page to
// be focused again, causing issues in tests and disturbing the user when switching modes).
if (!isTargetSwitching && !isModeSwitching) {
this._restoreTargetConfiguration();
}
}