forked from ZenBrowserMirrors/zen-desktop
feat: Prevent zen's session restore from being removed, b=(no-bug), c=common
This commit is contained in:
parent
03ca00748c
commit
663243264b
1 changed files with 1 additions and 53 deletions
|
@ -7,7 +7,6 @@
|
||||||
this.#waitAndCleanup();
|
this.#waitAndCleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#glanceTabs = {};
|
|
||||||
promiseInitialized = new Promise((resolve) => {
|
promiseInitialized = new Promise((resolve) => {
|
||||||
this._resolveInitialized = resolve;
|
this._resolveInitialized = resolve;
|
||||||
});
|
});
|
||||||
|
@ -34,67 +33,16 @@
|
||||||
if (tabData.zenPinnedEntry) {
|
if (tabData.zenPinnedEntry) {
|
||||||
tab.setAttribute('zen-pinned-entry', tabData.zenPinnedEntry);
|
tab.setAttribute('zen-pinned-entry', tabData.zenPinnedEntry);
|
||||||
}
|
}
|
||||||
if (tabData.zenGlanceId) {
|
|
||||||
// We just found the background used for glance. Find
|
|
||||||
// the current
|
|
||||||
if (tabData.zenIsGlance) {
|
|
||||||
if (this.#glanceTabs[tabData.zenGlanceId]) {
|
|
||||||
this.#glanceTabs[tabData.zenGlanceId].tab = tab;
|
|
||||||
} else {
|
|
||||||
this.#glanceTabs[tabData.zenGlanceId] = {
|
|
||||||
tab: tab,
|
|
||||||
background: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.#glanceTabs[tabData.zenGlanceId]) {
|
|
||||||
this.#glanceTabs[tabData.zenGlanceId].background = tab;
|
|
||||||
} else {
|
|
||||||
this.#glanceTabs[tabData.zenGlanceId] = {
|
|
||||||
tab: null,
|
|
||||||
background: tab,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async #resolveGlanceTabs() {
|
|
||||||
for (const [id, data] of Object.entries(this.#glanceTabs)) {
|
|
||||||
const { tab, background } = data;
|
|
||||||
// TODO(Restore glance tab): Finish this implementation
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!tab || !background) {
|
|
||||||
tab?.removeAttribute('glance-id');
|
|
||||||
background?.removeAttribute('glance-id');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
console.log(tab, background);
|
|
||||||
const browserRect = gBrowser.tabbox.getBoundingClientRect();
|
|
||||||
await gZenGlanceManager.openGlance(
|
|
||||||
{
|
|
||||||
url: undefined,
|
|
||||||
clientX: browserRect.width / 2,
|
|
||||||
clientY: browserRect.height / 2,
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
},
|
|
||||||
tab,
|
|
||||||
background
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async #waitAndCleanup() {
|
async #waitAndCleanup() {
|
||||||
await SessionStore.promiseAllWindowsRestored;
|
await SessionStore.promiseAllWindowsRestored;
|
||||||
await this.#resolveGlanceTabs();
|
await SessionStore.promiseInitialized;
|
||||||
this.#cleanup();
|
this.#cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#cleanup() {
|
#cleanup() {
|
||||||
this._resolveInitialized();
|
this._resolveInitialized();
|
||||||
delete window.gZenSessionStore;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue