





















@@ -28,9 +28,6 @@ type SessionStoreSnapshotCacheEntry = {
2828snapshot: SessionStoreSnapshot;
2929mtimeMs?: number;
3030sizeBytes?: number;
31-generation: number;
32-createdAt: number;
33-entryCount: number;
3431};
35323633type SerializedSessionStoreCacheEntry = {
@@ -60,7 +57,6 @@ const SESSION_STORE_STRING_INTERN_STATS = {
6057skippedSmall: 0,
6158skippedFull: 0,
6259};
63-let sessionStoreSnapshotGeneration = 0;
6460let sessionStoreSerializedCacheBytes = 0;
65616662function parseNonNegativeInteger(value: string | undefined): number | null {
@@ -196,12 +192,17 @@ function cloneJsonLikeValue<T>(value: T): T {
196192}
197193const cloned: Record<string, unknown> = {};
198194for (const [key, child] of Object.entries(value as Record<string, unknown>)) {
199-Object.defineProperty(cloned, key, {
200-value: cloneJsonLikeValue(child),
201-enumerable: true,
202-configurable: true,
203-writable: true,
204-});
195+const clonedChild = cloneJsonLikeValue(child);
196+if (key === "__proto__") {
197+Object.defineProperty(cloned, key, {
198+value: clonedChild,
199+enumerable: true,
200+configurable: true,
201+writable: true,
202+});
203+} else {
204+cloned[key] = clonedChild;
205+}
205206}
206207return cloned as T;
207208}
@@ -213,7 +214,7 @@ export function cloneSessionStoreSnapshot(
213214const cloned =
214215serialized === undefined
215216 ? cloneJsonLikeValue(store)
216- : cloneSessionStoreRecord(store, serialized);
217+ : (JSON.parse(serialized) as Record<string, SessionEntry>);
217218internSessionStoreLargeStrings(cloned);
218219return deepFreeze(cloned);
219220}
@@ -326,9 +327,6 @@ export function writeSessionStoreSnapshotCache(params: {
326327 snapshot,
327328mtimeMs: params.mtimeMs,
328329sizeBytes: params.sizeBytes,
329-generation: (sessionStoreSnapshotGeneration += 1),
330-createdAt: Date.now(),
331-entryCount: Object.keys(snapshot).length,
332330});
333331return snapshot;
334332}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。