@steve31415/baselib 3.48.2 → 3.48.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,13 +46,25 @@ export declare function codeIdOf(files: Record<string, string>): Promise<string>
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function diskCode(): Promise<string | null>;
|
|
48
48
|
/**
|
|
49
|
-
* Record the code Chrome just loaded. Call from runtime.onInstalled
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
* Record the code Chrome just loaded. Call from runtime.onInstalled ONLY: that
|
|
50
|
+
* is when Chrome registers the worker script afresh from disk (install,
|
|
51
|
+
* chrome.runtime.reload(), a click on reload). Not from runtime.onStartup: a
|
|
52
|
+
* browser restart re-reads an unpacked extension's manifest and content
|
|
53
|
+
* scripts from disk but keeps running the worker script it registered
|
|
54
|
+
* earlier, even when the file on disk changed (measured 2026-11-02: Lurch's
|
|
55
|
+
* card said 2.6 after a restart while its worker still ran 2.5's code). And
|
|
56
|
+
* never on a worker restart after eviction, which also runs the registered
|
|
57
|
+
* script whatever the disk holds now.
|
|
53
58
|
*/
|
|
54
59
|
export declare function recordLoadedCode(): Promise<string>;
|
|
55
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* The code this extension runs: the record from its last load. 'unverified'
|
|
62
|
+
* when there is no record, or when the record predates the manifest Chrome now
|
|
63
|
+
* shows (a browser restart picked up a new manifest while the worker may still
|
|
64
|
+
* be the old script) — never re-read from disk, which would label an old
|
|
65
|
+
* worker as the new code. 'unverified' differs from every deployed id, so the
|
|
66
|
+
* extension reloads itself into the deployed code once it is on disk.
|
|
67
|
+
*/
|
|
56
68
|
export declare function loadedCode(): Promise<string>;
|
|
57
69
|
/** Mark the extension busy for BUSY_LEASE_MS (an open overlay calls this through the worker every ~10 s). */
|
|
58
70
|
export declare function extendBusyLease(now?: number): Promise<void>;
|
|
@@ -105,10 +105,15 @@ export async function diskCode() {
|
|
|
105
105
|
return id;
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Record the code Chrome just loaded. Call from runtime.onInstalled
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
108
|
+
* Record the code Chrome just loaded. Call from runtime.onInstalled ONLY: that
|
|
109
|
+
* is when Chrome registers the worker script afresh from disk (install,
|
|
110
|
+
* chrome.runtime.reload(), a click on reload). Not from runtime.onStartup: a
|
|
111
|
+
* browser restart re-reads an unpacked extension's manifest and content
|
|
112
|
+
* scripts from disk but keeps running the worker script it registered
|
|
113
|
+
* earlier, even when the file on disk changed (measured 2026-11-02: Lurch's
|
|
114
|
+
* card said 2.6 after a restart while its worker still ran 2.5's code). And
|
|
115
|
+
* never on a worker restart after eviction, which also runs the registered
|
|
116
|
+
* script whatever the disk holds now.
|
|
112
117
|
*/
|
|
113
118
|
export async function recordLoadedCode() {
|
|
114
119
|
const code = (await diskCode()) ?? 'unverified';
|
|
@@ -116,13 +121,20 @@ export async function recordLoadedCode() {
|
|
|
116
121
|
await chrome.storage.local.set({ [LOADED_KEY]: record });
|
|
117
122
|
return code;
|
|
118
123
|
}
|
|
119
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* The code this extension runs: the record from its last load. 'unverified'
|
|
126
|
+
* when there is no record, or when the record predates the manifest Chrome now
|
|
127
|
+
* shows (a browser restart picked up a new manifest while the worker may still
|
|
128
|
+
* be the old script) — never re-read from disk, which would label an old
|
|
129
|
+
* worker as the new code. 'unverified' differs from every deployed id, so the
|
|
130
|
+
* extension reloads itself into the deployed code once it is on disk.
|
|
131
|
+
*/
|
|
120
132
|
export async function loadedCode() {
|
|
121
133
|
const { [LOADED_KEY]: stored } = await chrome.storage.local.get(LOADED_KEY);
|
|
122
134
|
const record = stored;
|
|
123
135
|
if (record && typeof record.code === 'string' && record.version === chrome.runtime.getManifest().version)
|
|
124
136
|
return record.code;
|
|
125
|
-
return
|
|
137
|
+
return 'unverified';
|
|
126
138
|
}
|
|
127
139
|
/** Mark the extension busy for BUSY_LEASE_MS (an open overlay calls this through the worker every ~10 s). */
|
|
128
140
|
export async function extendBusyLease(now = Date.now()) {
|
package/package.json
CHANGED