feat: Take into account tab entry index may not exist, b=no-bug, c=no-component

This commit is contained in:
mr. m
2026-01-02 00:18:51 +01:00
parent 560c92cc0e
commit 9e6998bc1a

View File

@@ -822,8 +822,11 @@ class nsZenWindowSync {
return lazy.TabStateFlusher.flush(aTab.linkedBrowser).finally(() => {
this.log(`Setting pinned initial state for tab ${aTab.id}`);
const state = this.#getTabState(aTab);
let activeIndex = 'index' in state ? state.index : state.entries.length - 1;
activeIndex = Math.min(activeIndex, state.entries.length - 1);
activeIndex = Math.max(activeIndex, 0);
const initialState = {
entry: state.entries[state.index - 1],
entry: state.entries[activeIndex],
image: state.image,
};
this.#runOnAllWindows(null, (win) => {