Skip to content

Commit 88efff9

Browse files
committed
chore: followup bug 1034036 - Part 4: move away from keeping state on the living objects
1 parent ef53e76 commit 88efff9

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

addon/chrome/content/click/click.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ var TabmixTabClickOptions = {
201201
Tabmix.duplicateTab(aTab);
202202
break;
203203
case 4:
204-
if (aTab.linkedBrowser.__SS_restoreState != 2)
204+
if (aTab._restoreState != 2) {
205205
gBrowser.reloadTab(aTab);
206+
}
206207
break;
207208
case 5:
208209
gBrowser.protectTab(aTab);

addon/chrome/content/minit/tablib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ Tabmix.tablib = {
17741774
return;
17751775

17761776
if (aBrowser.getAttribute("remote") == "true" &&
1777-
aBrowser.__SS_restoreState == 2 &&
1777+
aTab._restoreState == 2 &&
17781778
this.labels.indexOf(aTab.label) > -1) {
17791779
return;
17801780
}
@@ -1946,7 +1946,7 @@ Tabmix.tablib = {
19461946
let l = tabs.length;
19471947
for (let i = 0; i < l; i++) {
19481948
let tab = tabs[i];
1949-
if (tab != skipTab && tab.linkedBrowser.__SS_restoreState != 2) {
1949+
if (tab != skipTab && tab._restoreState != 2) {
19501950
try {
19511951
tab.linkedBrowser.reload();
19521952
} catch {}

addon/chrome/content/places/places.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ var TMP_Places = {
380380
this.bookmarksOnDemand = restoreOnDemand;
381381

382382
tabs.forEach(tab => {
383-
if (tab.linkedBrowser.__SS_restoreState) {
383+
if (tab._restoreState) {
384384
TabmixSvc.SessionStore._resetTabRestoringState(tab);
385385
}
386386
});
@@ -411,7 +411,7 @@ var TMP_Places = {
411411
restoringTabs: [],
412412

413413
resetRestoreState(tab) {
414-
if (tab.linkedBrowser.__SS_restoreState) {
414+
if (tab._restoreState) {
415415
TabmixSvc.SessionStore._resetTabRestoringState(tab);
416416
}
417417
this.updateRestoringTabsList(tab);

addon/chrome/content/session/session.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3300,8 +3300,9 @@ TabmixSessionManager = {
33003300
if (overwrite) {
33013301
for (let i = 0; i < gBrowser.tabs.length; i++) {
33023302
let tab = gBrowser.tabs[i];
3303-
if (gBrowser.browsers[i].__SS_restoreState)
3303+
if (tab._restoreState) {
33043304
TabmixSvc.SessionStore._resetTabRestoringState(tab);
3305+
}
33053306
}
33063307
}
33073308
TabmixSvc.SessionStore.restoreTabs(window, tabs, tabsData, 0);

addon/chrome/content/tab/tabBindings.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,15 @@
165165
const {height, y} = this.getBoundingClientRect();
166166
return height + y;
167167
}
168-
}
168+
},
169+
'_restoreState': {
170+
get() {
171+
if (this.hasAttribute("pending") || this.hasAttribute("tabmix_pending")) {
172+
return TabmixSvc.sm.TAB_STATE_NEEDS_RESTORE;
173+
}
174+
return SessionStore.getInternalObjectState(this.linkedBrowser);
175+
}
176+
},
169177
});
170178

171179
/**

addon/modules/TabmixSvc.jsm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,12 @@ TabmixChromeUtils.defineLazyGetter(TabmixSvc, "SessionStore", function() {
442442
return this.SessionStoreGlobal.SessionStoreInternal;
443443
});
444444

445+
TabmixChromeUtils.defineLazyGetter(TabmixSvc.sm, "TAB_STATE_NEEDS_RESTORE", () => {
446+
return TabmixSvc.SessionStoreGlobal.TAB_STATE_NEEDS_RESTORE;
447+
});
448+
449+
TabmixChromeUtils.defineLazyGetter(TabmixSvc.sm, "TAB_STATE_RESTORING", () => {
450+
return TabmixSvc.SessionStoreGlobal.TAB_STATE_RESTORING;
451+
});
452+
445453
TabmixSvc.loadDefaultPreferences();

types/tabmix.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ declare namespace TabmixModules {
139139
SessionStoreGlobal: any;
140140
skipSingleWindowModeCheck: boolean;
141141
sm: {
142+
TAB_STATE_NEEDS_RESTORE: number;
143+
TAB_STATE_RESTORING: number;
142144
crashed: boolean;
143145
lastSessionPath: string | null;
144146
settingPreference: boolean;

0 commit comments

Comments
 (0)