gh-14470: Prevent state override if url changed (gh-15070)

This commit is contained in:
mr. m
2026-08-23 16:40:30 +02:00
committed by GitHub
parent ed0a6fd447
commit 99dca42723
2 changed files with 23 additions and 3 deletions

View File

@@ -92,7 +92,11 @@
--in-content-accent-color-active: currentColor !important;
/* This is like the secondary button */
--in-content-button-background: transparent !important;
--in-content-button-background: color-mix(
in srgb,
currentColor,
transparent 90%
) !important;
--in-content-button-text-color: var(--zen-secondary-btn-color) !important;
--in-content-button-background-hover: color-mix(
in srgb,

View File

@@ -574,7 +574,7 @@ class nsZenSpacesSyncApplier {
// An unloaded tab has no live state to lose: retarget its lazy session
// state so the next activation loads the new canonical url directly
// instead of whatever the tab was created with.
this.#retargetUnloadedTab(win, tab, data);
this.#retargetUnloadedTab(win, tab, data, initial?.entry?.url);
}
const staticLabel =
@@ -621,10 +621,26 @@ class nsZenSpacesSyncApplier {
* @param {Window} win
* @param {MozTabbrowserTab} tab
* @param {object} data
* @param {?string} previousPinUrl - The pin url before this record applied.
*/
#retargetUnloadedTab(win, tab, data) {
#retargetUnloadedTab(win, tab, data, previousPinUrl) {
try {
const state = JSON.parse(win.SessionStore.getTabState(tab));
const entries = state.entries || [];
let currentUrl = null;
if (entries.length) {
const index = Math.min(
Math.max((state.index || entries.length) - 1, 0),
entries.length - 1
);
currentUrl = entries[index]?.url || null;
}
if (
currentUrl === data.url ||
(currentUrl && previousPinUrl && currentUrl !== previousPinUrl)
) {
return;
}
state.entries = [
{
url: data.url,