mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-06 21:37:50 +00:00
feat: Take into account tab entry index may not exist, b=no-bug, c=no-component
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user