MCPcopy
hub / github.com/zen-browser/desktop / ZenSessionStore

Class ZenSessionStore

src/zen/common/modules/ZenSessionStore.mjs:7–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import { nsZenPreloadedFeature } from "chrome://browser/content/zen-components/ZenCommonUtils.mjs";
6
7class ZenSessionStore extends nsZenPreloadedFeature {
8 init() {
9 this.#waitAndCleanup();
10 }
11
12 promiseInitialized = new Promise(resolve => {
13 this._resolveInitialized = resolve;
14 });
15
16 restoreInitialTabData(tab, tabData) {
17 if (tabData.zenWorkspace) {
18 tab.setAttribute("zen-workspace-id", tabData.zenWorkspace);
19 }
20 if (tabData.zenLiveFolderItemId) {
21 tab.setAttribute("zen-live-folder-item-id", tabData.zenLiveFolderItemId);
22 }
23 // Keep for now, for backward compatibility for window sync to work.
24 if (tabData.zenSyncId || tabData.zenPinnedId) {
25 tab.setAttribute("id", tabData.zenSyncId || tabData.zenPinnedId);
26 }
27 if (typeof tabData.zenStaticLabel === "string") {
28 tab.zenStaticLabel = tabData.zenStaticLabel;
29 }
30 if (tabData.zenHasStaticIcon && tabData.image) {
31 tab.zenStaticIcon = tabData.image;
32 }
33 if (tabData.zenEssential) {
34 tab.setAttribute("zen-essential", "true");
35 }
36 if (tabData.zenDefaultUserContextId) {
37 tab.setAttribute("zenDefaultUserContextId", "true");
38 }
39 if (tabData._zenPinnedInitialState) {
40 tab._zenPinnedInitialState = tabData._zenPinnedInitialState;
41 }
42 }
43
44 async #waitAndCleanup() {
45 await SessionStore.promiseInitialized;
46 this.#cleanup();
47 }
48
49 #cleanup() {
50 this._resolveInitialized();
51 }
52}
53
54window.gZenSessionStore = new ZenSessionStore();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected