зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1766951 - Avoid setting userTypedValue when restoring tabs, r=Gijs,farre
This userTypedValue being set was preventing the UrlbarInput from updating the page proxy state to "valid", and showing the firefox badge correctly, as the browser thinks the user typed the URL into the urlbar, rather than it reflecting the currently loaded page. This patch removes that set which was introduced as a wallpaper fix in bug 439675 as it should no longer be required for its original purpose since bug 599909. See bug 1766951 comment 6 for more details about the reasoning behind removing this assignment. Differential Revision: https://phabricator.services.mozilla.com/D145389
This commit is contained in:
Родитель
f6d92d7332
Коммит
b5f81092ed
|
@ -6289,27 +6289,6 @@ var SessionStoreInternal = {
|
|||
// Notify the tabbrowser that the tab chrome has been restored.
|
||||
let tabData = TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
||||
|
||||
// wall-paper fix for bug 439675: make sure that the URL to be loaded
|
||||
// is always visible in the address bar if no other value is present
|
||||
let activePageData = tabData.entries[tabData.index - 1] || null;
|
||||
let uri = activePageData ? activePageData.url || null : null;
|
||||
// NB: we won't set initial URIs (about:home, about:newtab, etc.) here
|
||||
// because their load will not normally trigger a location bar clearing
|
||||
// when they finish loading (to avoid race conditions where we then
|
||||
// clear user input instead), so we shouldn't set them here either.
|
||||
// They also don't fall under the issues in bug 439675 where user input
|
||||
// needs to be preserved if the load doesn't succeed.
|
||||
// We also don't do this for remoteness updates, where it should not
|
||||
// be necessary.
|
||||
if (
|
||||
!browser.userTypedValue &&
|
||||
uri &&
|
||||
!data.isRemotenessUpdate &&
|
||||
!win.gInitialPages.includes(uri)
|
||||
) {
|
||||
browser.userTypedValue = uri;
|
||||
}
|
||||
|
||||
// Update tab label and icon again after the tab history was updated.
|
||||
this.updateTabLabelAndIcon(tab, tabData);
|
||||
|
||||
|
|
|
@ -362,3 +362,4 @@ skip-if =
|
|||
os == "mac" && fission # Bug 1711008; high frequency intermittent
|
||||
[browser_bfcache_telemetry.js]
|
||||
[browser_userTyped_restored_after_discard.js]
|
||||
[browser_restore_pageProxyState.js]
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const BACKUP_STATE = SessionStore.getBrowserState();
|
||||
registerCleanupFunction(() => promiseBrowserState(BACKUP_STATE));
|
||||
|
||||
// The pageproxystate of the restored tab controls whether the identity
|
||||
// information in the URL bar will display correctly. See bug 1766951 for more
|
||||
// context.
|
||||
async function test_pageProxyState(url1, url2) {
|
||||
info(`urls: "${url1}", "${url2}"`);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.sessionstore.restore_on_demand", true],
|
||||
["browser.sessionstore.restore_tabs_lazily", true],
|
||||
],
|
||||
});
|
||||
|
||||
await promiseBrowserState({
|
||||
windows: [
|
||||
{
|
||||
tabs: [
|
||||
{
|
||||
entries: [
|
||||
{
|
||||
url: url1,
|
||||
triggeringPrincipal_base64,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
entries: [
|
||||
{
|
||||
url: url2,
|
||||
triggeringPrincipal_base64,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
selected: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// The first tab isn't lazy and should be initialized.
|
||||
ok(gBrowser.tabs[0].linkedPanel, "first tab is not lazy");
|
||||
is(gBrowser.selectedTab, gBrowser.tabs[0], "first tab is selected");
|
||||
is(gBrowser.userTypedValue, null, "no user typed value");
|
||||
is(
|
||||
gURLBar.getAttribute("pageproxystate"),
|
||||
"valid",
|
||||
"has valid page proxy state"
|
||||
);
|
||||
|
||||
// The second tab is lazy until selected.
|
||||
ok(!gBrowser.tabs[1].linkedPanel, "second tab should be lazy");
|
||||
gBrowser.selectedTab = gBrowser.tabs[1];
|
||||
await promiseTabRestored(gBrowser.tabs[1]);
|
||||
is(gBrowser.userTypedValue, null, "no user typed value");
|
||||
is(
|
||||
gURLBar.getAttribute("pageproxystate"),
|
||||
"valid",
|
||||
"has valid page proxy state"
|
||||
);
|
||||
}
|
||||
|
||||
add_task(async function test_system() {
|
||||
await test_pageProxyState("about:support", "about:addons");
|
||||
});
|
||||
|
||||
add_task(async function test_http() {
|
||||
await test_pageProxyState(
|
||||
"https://example.com/document-builder.sjs?html=tab1",
|
||||
"https://example.com/document-builder.sjs?html=tab2"
|
||||
);
|
||||
});
|
Загрузка…
Ссылка в новой задаче