fix: Make sure to update cache when swaping docshells, b=bug #11831, c=no-component

This commit is contained in:
mr. m
2026-01-09 16:52:22 +01:00
parent 6bce6f4874
commit f77249e8e9
5 changed files with 70 additions and 62 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs
index 82721356d191055bec0d4b0ca49e481221988801..ffa95005b96ea384433f18dace63faa35d2d21bf 100644
index 82721356d191055bec0d4b0ca49e481221988801..238d6ae1a4261e098d1e986e3c3df813d9d625f3 100644
--- a/browser/components/sessionstore/TabState.sys.mjs
+++ b/browser/components/sessionstore/TabState.sys.mjs
@@ -85,7 +85,24 @@ class _TabState {
@@ -27,12 +27,3 @@ index 82721356d191055bec0d4b0ca49e481221988801..ffa95005b96ea384433f18dace63faa3
tabData.userContextId = tab.userContextId || 0;
@@ -98,7 +115,7 @@ class _TabState {
// Copy data from the tab state cache only if the tab has fully finished
// restoring. We don't want to overwrite data contained in __SS_data.
- this.copyFromCache(browser.permanentKey, tabData, options);
+ this.copyFromCache(tab.permanentKey, tabData, options);
// After copyFromCache() was called we check for properties that are kept
// in the cache only while the tab is pending or restoring. Once that

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabgroup.js b/browser/components/tabbrowser/content/tabgroup.js
index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee3c507b39 100644
index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..9a38d7dc10403c1ee721b6abf33d525a4aa1f821 100644
--- a/browser/components/tabbrowser/content/tabgroup.js
+++ b/browser/components/tabbrowser/content/tabgroup.js
@@ -14,11 +14,11 @@
@@ -78,7 +78,20 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
this.#updateLabelAriaAttributes();
@@ -143,6 +162,8 @@
@@ -132,17 +151,21 @@
let tabGroupCreateDetail = this.#wasCreatedByAdoption
? { isAdoptingGroup: true }
: {};
+ if (!this.hasAttribute('drag-image')) {
this.dispatchEvent(
new CustomEvent("TabGroupCreate", {
bubbles: true,
detail: tabGroupCreateDetail,
})
);
+ }
// Reset `wasCreatedByAdoption` to default of false so that we only
// claim that a tab group was created by adoption the first time it
// mounts after getting created by `Tabbrowser.adoptTabGroup`.
this.#wasCreatedByAdoption = false;
}
@@ -87,7 +100,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
resetDefaultGroupName = () => {
this.#defaultGroupName = "";
@@ -211,7 +232,10 @@
@@ -211,7 +234,10 @@
}
});
}
@@ -99,7 +112,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
}
get color() {
@@ -305,6 +329,9 @@
@@ -305,6 +331,9 @@
}
set collapsed(val) {
@@ -109,7 +122,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
if (!!val == this.collapsed) {
return;
}
@@ -391,7 +418,6 @@
@@ -391,7 +420,6 @@
tabGroupName,
})
.then(result => {
@@ -117,7 +130,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
});
}
@@ -466,13 +492,65 @@
@@ -466,13 +494,65 @@
* @returns {MozTabbrowserTab[]}
*/
get tabs() {
@@ -188,7 +201,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
}
/**
@@ -560,7 +638,6 @@
@@ -560,7 +640,6 @@
);
} else {
if (tabOrSplitView.pinned) {
@@ -196,7 +209,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
}
let tabToMove =
this.ownerGlobal === tabOrSplitView.ownerGlobal
@@ -625,7 +702,7 @@
@@ -625,7 +704,7 @@
*/
on_click(event) {
let isToggleElement =
@@ -205,7 +218,7 @@ index 9abf115062e7c86196d7cb6b8ac82a9bb63b5a65..150b0266c979bcfec84e0c1975f91bee
event.target === this.#overflowCountLabel;
if (isToggleElement && event.button === 0) {
event.preventDefault();
@@ -696,5 +773,6 @@
@@ -696,5 +775,6 @@
}
}