Bug 1410591 - Focus the content area when restoring the selected tab. r=mikedeboer

This commit is contained in:
Dão Gottwald 2018-04-23 19:13:58 +02:00
parent 328eb34d1e
commit 1dd6ba95b7
3 changed files with 28 additions and 6 deletions

View File

@ -2505,9 +2505,6 @@ var SessionStoreInternal = {
// restore the tab's position
tabbrowser.moveTabTo(tab, pos);
// focus the tab's content area (bug 342432)
tab.linkedBrowser.focus();
// Notify of changes to closed objects.
this._notifyOfClosedObjectsChange();
@ -4019,6 +4016,11 @@ var SessionStoreInternal = {
reason: aOptions.restoreContentReason ||
RESTORE_TAB_CONTENT_REASON.SET_STATE,
requestTime: Services.telemetry.msSystemNow()});
// Focus the tab's content area.
if (aTab.selected) {
browser.focus();
}
},
/**

View File

@ -237,15 +237,16 @@ skip-if = os == "mac" || (os == "linux" && debug) # linux, Bug 1348583
[browser_911547.js]
[browser_1284886_suspend_tab.js]
skip-if = !e10s
[browser_send_async_message_oom.js]
[browser_async_window_flushing.js]
[browser_focus_after_restore.js]
[browser_forget_async_closings.js]
[browser_multiple_navigateAndRestore.js]
run-if = e10s
[browser_async_window_flushing.js]
[browser_forget_async_closings.js]
[browser_newtab_userTypedValue.js]
[browser_parentProcessRestoreHash.js]
run-if = e10s
tags = openUILinkIn
[browser_send_async_message_oom.js]
[browser_sessionStoreContainer.js]
[browser_windowStateContainer.js]
skip-if = os == "linux" && !debug

View File

@ -0,0 +1,19 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function test() {
gURLBar.focus();
is(document.activeElement, gURLBar.inputField, "urlbar is focused before restoring");
await promiseBrowserState({
windows: [{
tabs: [{
entries: [{
url: "http://example.org/", triggeringPrincipal_base64
}]
}],
selected: 1
}]
});
is(document.activeElement, gBrowser.selectedBrowser, "content area is focused after restoring");
});