@poe-platform/safe-js 0.1.443 → 0.1.445
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.
- package/dist/safe-js/chunks/{chunk-GL3SJA4W.js → chunk-EMOUVQDE.js} +137 -118
- package/dist/safe-js/chunks/chunk-EMOUVQDE.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-7SGYDXE2.js → chunk-UDJ5WEWH.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/scope.d.ts +1 -0
- package/dist/safe-js/snapshot/validation.d.ts +3 -1
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-GL3SJA4W.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-7SGYDXE2.js.map → chunk-UDJ5WEWH.js.map} +0 -0
|
@@ -6993,6 +6993,9 @@ import { types as types10 } from "node:util";
|
|
|
6993
6993
|
// packages/safe-js/src/interp/module-function-origin.ts
|
|
6994
6994
|
var moduleFunctionOrigins = /* @__PURE__ */ new WeakMap();
|
|
6995
6995
|
|
|
6996
|
+
// packages/safe-js/src/interp/host-function-metadata.ts
|
|
6997
|
+
var hostFunctionMetadata = /* @__PURE__ */ new WeakMap();
|
|
6998
|
+
|
|
6996
6999
|
// packages/safe-js/src/interp/running-state.ts
|
|
6997
7000
|
var runningObjects = /* @__PURE__ */ new WeakSet();
|
|
6998
7001
|
var lockedCollections = /* @__PURE__ */ new WeakSet();
|
|
@@ -8501,6 +8504,7 @@ var typedArrayPrototypes = /* @__PURE__ */ new WeakMap();
|
|
|
8501
8504
|
// packages/safe-js/src/interp/object-model.ts
|
|
8502
8505
|
var guestClosures = /* @__PURE__ */ new WeakSet();
|
|
8503
8506
|
var functionProperties = /* @__PURE__ */ new WeakMap();
|
|
8507
|
+
var hostFunctionPropertyTables = /* @__PURE__ */ new WeakSet();
|
|
8504
8508
|
var functionPropertyRevisions = /* @__PURE__ */ new WeakMap();
|
|
8505
8509
|
var trackedIntrinsicObjects = /* @__PURE__ */ new WeakSet();
|
|
8506
8510
|
var prototypes = /* @__PURE__ */ new WeakMap();
|
|
@@ -8545,16 +8549,21 @@ function intrinsicFunctionDataDescriptors(properties) {
|
|
|
8545
8549
|
}
|
|
8546
8550
|
return descriptors2;
|
|
8547
8551
|
}
|
|
8548
|
-
function materializeFunctionProperties(closure) {
|
|
8549
|
-
if (!isGuestClosure(closure)) throw new TypeError("Host function properties are read only.");
|
|
8552
|
+
function materializeFunctionProperties(closure, initialProperties) {
|
|
8550
8553
|
const existing = functionProperties.get(closure);
|
|
8551
8554
|
if (existing !== void 0) return existing;
|
|
8555
|
+
if (initialProperties !== void 0) {
|
|
8556
|
+
descriptorObjects.add(initialProperties);
|
|
8557
|
+
if (!isGuestClosure(closure)) hostFunctionPropertyTables.add(initialProperties);
|
|
8558
|
+
functionProperties.set(closure, initialProperties);
|
|
8559
|
+
return initialProperties;
|
|
8560
|
+
}
|
|
8552
8561
|
const properties = /* @__PURE__ */ Object.create(null);
|
|
8553
8562
|
Object.defineProperties(properties, {
|
|
8554
8563
|
length: { value: closure.length ?? 0, configurable: true },
|
|
8555
8564
|
name: { value: closure.name ?? "", configurable: true }
|
|
8556
8565
|
});
|
|
8557
|
-
if (closure.construct !== void 0 && closure.boundTarget === void 0) {
|
|
8566
|
+
if (isGuestClosure(closure) && closure.construct !== void 0 && closure.boundTarget === void 0) {
|
|
8558
8567
|
const prototype = /* @__PURE__ */ Object.create(null);
|
|
8559
8568
|
Object.defineProperty(prototype, "constructor", {
|
|
8560
8569
|
value: closure,
|
|
@@ -8566,6 +8575,7 @@ function materializeFunctionProperties(closure) {
|
|
|
8566
8575
|
}
|
|
8567
8576
|
const tracked = trackPropertyTable(properties);
|
|
8568
8577
|
descriptorObjects.add(tracked);
|
|
8578
|
+
if (!isGuestClosure(closure)) hostFunctionPropertyTables.add(tracked);
|
|
8569
8579
|
functionProperties.set(closure, tracked);
|
|
8570
8580
|
return tracked;
|
|
8571
8581
|
}
|
|
@@ -8778,7 +8788,7 @@ function getSandboxPrototype(value, budget) {
|
|
|
8778
8788
|
const prototype = errorPrototypes.get(budget)?.get(errorType);
|
|
8779
8789
|
if (prototype !== void 0) return prototype;
|
|
8780
8790
|
}
|
|
8781
|
-
if (budget !== void 0 &&
|
|
8791
|
+
if (budget !== void 0 && isSandboxClosure(value) && runResources.getStore()?.functionSourceText !== false)
|
|
8782
8792
|
return functionPrototypes.get(budget) ?? null;
|
|
8783
8793
|
if (budget !== void 0 && Array.isArray(value)) return arrayPrototypes.get(budget) ?? null;
|
|
8784
8794
|
if (budget !== void 0 && isSandboxDate(value)) return datePrototypes.get(budget) ?? null;
|
|
@@ -8799,16 +8809,13 @@ function hasNullObjectPrototype(value) {
|
|
|
8799
8809
|
return prototypes.get(value) === null && !Array.isArray(value) && !isSandboxClosure(value) && !isSandboxRegex(value);
|
|
8800
8810
|
}
|
|
8801
8811
|
function getSandboxPropertyDescriptor(value, key, budget) {
|
|
8802
|
-
const hostProperties = isSandboxClosure(value) ? value.properties : void 0;
|
|
8803
|
-
if (isSandboxClosure(value) && !isGuestClosure(value))
|
|
8804
|
-
return hostProperties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(hostProperties, key);
|
|
8805
8812
|
let current = value;
|
|
8806
8813
|
let depth = 0;
|
|
8807
8814
|
while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxGenerator(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
|
|
8808
8815
|
if (isNumericTypedArray(current) && typeof key !== "symbol" && isTypedArrayIndex(String(key)))
|
|
8809
8816
|
return Object.getOwnPropertyDescriptor(current, key);
|
|
8810
|
-
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) :
|
|
8811
|
-
if (properties === void 0 &&
|
|
8817
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isSandboxClosure(current) ? key === "prototype" && current.construct !== void 0 && current.boundTarget === void 0 ? materializeFunctionProperties(current) : getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
8818
|
+
if (properties === void 0 && isSandboxClosure(current) && (key === "name" || key === "length"))
|
|
8812
8819
|
return {
|
|
8813
8820
|
value: key === "name" ? current.name ?? "" : current.length ?? 0,
|
|
8814
8821
|
writable: false,
|
|
@@ -8839,12 +8846,9 @@ function getSandboxDataProperty(value, key, budget) {
|
|
|
8839
8846
|
if (descriptor !== void 0) return descriptor.value;
|
|
8840
8847
|
}
|
|
8841
8848
|
if (isSandboxMap(current) || isSandboxSet(current)) return Object.getOwnPropertyDescriptor(getCollectionProperties(current), key)?.value;
|
|
8842
|
-
if (
|
|
8849
|
+
if (isSandboxClosure(current)) {
|
|
8843
8850
|
const entry = getGuestFunctionProperty(current, key);
|
|
8844
8851
|
if (entry !== void 0 || Object.hasOwn(current.properties ?? {}, key)) return entry;
|
|
8845
|
-
} else if (isSandboxClosure(current)) {
|
|
8846
|
-
const properties = current.properties;
|
|
8847
|
-
return properties !== void 0 && Object.hasOwn(properties, key) ? properties[key] : void 0;
|
|
8848
8852
|
}
|
|
8849
8853
|
if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current))
|
|
8850
8854
|
return void 0;
|
|
@@ -8871,7 +8875,7 @@ function setSandboxPrototype(value, prototype, budget, throwOnFailure = true) {
|
|
|
8871
8875
|
if (prototype === null) storePrototype(value, null);
|
|
8872
8876
|
return true;
|
|
8873
8877
|
}
|
|
8874
|
-
if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) :
|
|
8878
|
+
if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8875
8879
|
if (!throwOnFailure) return false;
|
|
8876
8880
|
throw new TypeError("Cannot change the prototype of a non-extensible object.");
|
|
8877
8881
|
}
|
|
@@ -8891,7 +8895,7 @@ function isPrototypeRecord(value) {
|
|
|
8891
8895
|
if (isSandboxDataView(value)) return true;
|
|
8892
8896
|
if (isSandboxArrayBuffer(value)) return true;
|
|
8893
8897
|
if (isNumericTypedArray(value)) return true;
|
|
8894
|
-
if (
|
|
8898
|
+
if (isSandboxClosure(value)) return true;
|
|
8895
8899
|
if (isGuestHostObject(value)) return false;
|
|
8896
8900
|
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxPromise(value) || isSandboxRegex(value) || isSandboxSet(value))
|
|
8897
8901
|
return false;
|
|
@@ -9390,6 +9394,7 @@ var Scope = class _Scope {
|
|
|
9390
9394
|
#replacedBindings = /* @__PURE__ */ new Set();
|
|
9391
9395
|
#restoredBindings;
|
|
9392
9396
|
#frameHydrated = false;
|
|
9397
|
+
#bindingDataRoots;
|
|
9393
9398
|
child(bindings = {}, options = {}) {
|
|
9394
9399
|
return new _Scope(bindings, this, void 0, {
|
|
9395
9400
|
chargeData: true,
|
|
@@ -9488,17 +9493,27 @@ var Scope = class _Scope {
|
|
|
9488
9493
|
if (this.importMeta !== void 0) values.push(this.importMeta);
|
|
9489
9494
|
if (this.privateNames !== void 0) values.push(...this.privateNames.values());
|
|
9490
9495
|
}
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
const
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9496
|
+
if (this.#bindingDataRoots === void 0) {
|
|
9497
|
+
const roots = [];
|
|
9498
|
+
const bindings = this.options.chargeData === false ? this.#replacedBindings : this.#bindings.values();
|
|
9499
|
+
for (const binding of bindings) {
|
|
9500
|
+
const value = binding.value;
|
|
9501
|
+
if (!isChargedBindingValue(value)) continue;
|
|
9502
|
+
if (binding.accounting === void 0) {
|
|
9503
|
+
const root = Object.freeze({});
|
|
9504
|
+
scopeDataRoots.set(root, { value });
|
|
9505
|
+
binding.accounting = { value, root };
|
|
9506
|
+
}
|
|
9507
|
+
roots.push(binding.accounting.root);
|
|
9508
|
+
}
|
|
9509
|
+
this.#bindingDataRoots = [];
|
|
9510
|
+
if (roots.length > 0) {
|
|
9511
|
+
const group = Object.freeze({});
|
|
9512
|
+
scopeDataRoots.set(group, { values: roots });
|
|
9513
|
+
this.#bindingDataRoots.push(group);
|
|
9499
9514
|
}
|
|
9500
|
-
values.push(binding.accounting.root);
|
|
9501
9515
|
}
|
|
9516
|
+
values.push(...this.#bindingDataRoots);
|
|
9502
9517
|
return values;
|
|
9503
9518
|
}
|
|
9504
9519
|
declare(name, kind, value) {
|
|
@@ -9509,8 +9524,11 @@ var Scope = class _Scope {
|
|
|
9509
9524
|
if (existing !== void 0 && existing.kind !== kind) {
|
|
9510
9525
|
throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
9511
9526
|
}
|
|
9512
|
-
if (existing !== void 0) writeBindingValue(existing, value);
|
|
9513
|
-
else
|
|
9527
|
+
if (existing !== void 0) this.writeBindingValue(existing, value);
|
|
9528
|
+
else {
|
|
9529
|
+
this.#bindings.set(name, { kind, value });
|
|
9530
|
+
if (isChargedBindingValue(value)) this.#bindingDataRoots = void 0;
|
|
9531
|
+
}
|
|
9514
9532
|
}
|
|
9515
9533
|
declareAlias(name, target) {
|
|
9516
9534
|
if (this.#bindings.has(name)) throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
@@ -9572,7 +9590,7 @@ var Scope = class _Scope {
|
|
|
9572
9590
|
if (binding.kind === "const") {
|
|
9573
9591
|
throw new TypeError(`Cannot assign to const binding '${name}'.`);
|
|
9574
9592
|
}
|
|
9575
|
-
writeBindingValue(binding, value);
|
|
9593
|
+
scope.writeBindingValue(binding, value);
|
|
9576
9594
|
scope.trackReplacement(name, binding);
|
|
9577
9595
|
}
|
|
9578
9596
|
lookup(name) {
|
|
@@ -9684,6 +9702,7 @@ var Scope = class _Scope {
|
|
|
9684
9702
|
if (this.parent === void 0)
|
|
9685
9703
|
for (const [name, value] of restored) this.#restoredBindings.set(name, value);
|
|
9686
9704
|
this.#frameHydrated = true;
|
|
9705
|
+
this.#bindingDataRoots = void 0;
|
|
9687
9706
|
}
|
|
9688
9707
|
copyInitializedBindingsFrom(source, names) {
|
|
9689
9708
|
for (const name of names) {
|
|
@@ -9695,8 +9714,15 @@ var Scope = class _Scope {
|
|
|
9695
9714
|
}
|
|
9696
9715
|
const targetBinding = targetScope.#bindings.get(name);
|
|
9697
9716
|
targetBinding.kind = sourceBinding.kind;
|
|
9698
|
-
writeBindingValue(targetBinding, sourceBinding.value);
|
|
9717
|
+
targetScope.writeBindingValue(targetBinding, sourceBinding.value);
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
writeBindingValue(binding, value) {
|
|
9721
|
+
if (!Object.is(binding.value, value)) {
|
|
9722
|
+
if (binding.accounting !== void 0 || isChargedBindingValue(value)) this.#bindingDataRoots = void 0;
|
|
9723
|
+
binding.accounting = void 0;
|
|
9699
9724
|
}
|
|
9725
|
+
binding.value = value;
|
|
9700
9726
|
}
|
|
9701
9727
|
resolveScope(name) {
|
|
9702
9728
|
if (this.#bindings.has(name) || this.objectEnvironment !== void 0 && getSandboxPropertyDescriptor(this.objectEnvironment, name) !== void 0) {
|
|
@@ -9707,9 +9733,12 @@ var Scope = class _Scope {
|
|
|
9707
9733
|
trackReplacement(name, binding) {
|
|
9708
9734
|
if (this.options.chargeData !== false || binding.kind === "const") return;
|
|
9709
9735
|
const value = binding.value;
|
|
9710
|
-
if (typeof value === "object" && value !== null && getIntrinsicIdentity(value) === JSON.stringify([name]))
|
|
9711
|
-
this.#replacedBindings.delete(binding);
|
|
9712
|
-
else this.#replacedBindings.
|
|
9736
|
+
if (typeof value === "object" && value !== null && getIntrinsicIdentity(value) === JSON.stringify([name])) {
|
|
9737
|
+
if (this.#replacedBindings.delete(binding)) this.#bindingDataRoots = void 0;
|
|
9738
|
+
} else if (!this.#replacedBindings.has(binding)) {
|
|
9739
|
+
this.#replacedBindings.add(binding);
|
|
9740
|
+
this.#bindingDataRoots = void 0;
|
|
9741
|
+
}
|
|
9713
9742
|
}
|
|
9714
9743
|
requireInitializedBinding(name) {
|
|
9715
9744
|
const scope = this.resolveScope(name);
|
|
@@ -9726,9 +9755,8 @@ var Scope = class _Scope {
|
|
|
9726
9755
|
};
|
|
9727
9756
|
}
|
|
9728
9757
|
};
|
|
9729
|
-
function
|
|
9730
|
-
|
|
9731
|
-
binding.value = value;
|
|
9758
|
+
function isChargedBindingValue(value) {
|
|
9759
|
+
return value !== uninitialized && value != null && typeof value !== "number" && typeof value !== "boolean";
|
|
9732
9760
|
}
|
|
9733
9761
|
function defineSnapshotBinding(target, name, value) {
|
|
9734
9762
|
Object.defineProperty(target, name, {
|
|
@@ -11863,14 +11891,10 @@ function getFunctionMember(target, property, options) {
|
|
|
11863
11891
|
let current = target;
|
|
11864
11892
|
let depth = 0;
|
|
11865
11893
|
while (current !== null) {
|
|
11866
|
-
if (
|
|
11894
|
+
if (isSandboxClosure(current)) {
|
|
11867
11895
|
const value = getGuestFunctionProperty(current, String(property));
|
|
11868
11896
|
if (value !== void 0 || Object.hasOwn(current.properties ?? {}, String(property)))
|
|
11869
11897
|
return value;
|
|
11870
|
-
} else if (isSandboxClosure(current)) {
|
|
11871
|
-
if (current.properties !== void 0 && Object.hasOwn(current.properties, String(property)))
|
|
11872
|
-
return current.properties[String(property)];
|
|
11873
|
-
if (property === "length") return current.length;
|
|
11874
11898
|
} else if (Object.hasOwn(current, String(property))) {
|
|
11875
11899
|
return current[String(property)];
|
|
11876
11900
|
}
|
|
@@ -14068,11 +14092,8 @@ function hasOwnSandboxProperty(value, key, enumerable) {
|
|
|
14068
14092
|
requireReceiver(value);
|
|
14069
14093
|
if (isGuestHostObject(value)) return typeof key === "symbol" ? false : hasHostObjectMember(value, String(key), enumerable);
|
|
14070
14094
|
let properties;
|
|
14071
|
-
if (
|
|
14072
|
-
else if (
|
|
14073
|
-
if (key === "length" || key === "name") return !enumerable;
|
|
14074
|
-
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
14075
|
-
} else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
14095
|
+
if (isSandboxClosure(value)) properties = materializeFunctionProperties(value);
|
|
14096
|
+
else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
14076
14097
|
else if (isSandboxPromise(value)) properties = getPromiseProperties(value);
|
|
14077
14098
|
else if (isSandboxGenerator(value)) properties = getGeneratorProperties(value);
|
|
14078
14099
|
else if (isSandboxRegex(value)) properties = getRegexProperties(value);
|
|
@@ -17588,8 +17609,8 @@ async function evaluateForInStatement(node, context) {
|
|
|
17588
17609
|
return normalEmptyResult();
|
|
17589
17610
|
}
|
|
17590
17611
|
function forInObject(value) {
|
|
17591
|
-
if (
|
|
17592
|
-
if (value === null || value === void 0
|
|
17612
|
+
if (isSandboxClosure(value)) return value;
|
|
17613
|
+
if (value === null || value === void 0) {
|
|
17593
17614
|
return void 0;
|
|
17594
17615
|
}
|
|
17595
17616
|
if (typeof value === "string" || Array.isArray(value) || isNumericTypedArray(value) || isPlainForInObject(value)) {
|
|
@@ -19038,7 +19059,7 @@ function toString(value) {
|
|
|
19038
19059
|
}
|
|
19039
19060
|
function isIndexableSandboxValue(value) {
|
|
19040
19061
|
if (isSandboxDate(value)) return true;
|
|
19041
|
-
return Array.isArray(value) || isPlainSandboxObject(value) ||
|
|
19062
|
+
return Array.isArray(value) || isPlainSandboxObject(value) || isSandboxClosure(value);
|
|
19042
19063
|
}
|
|
19043
19064
|
function appendArrayValues2(target, values) {
|
|
19044
19065
|
for (const value of values) {
|
|
@@ -19088,7 +19109,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
19088
19109
|
if (descriptor2 !== void 0 && !("value" in descriptor2))
|
|
19089
19110
|
return writePropertyDescriptor(descriptor2, target, value, context);
|
|
19090
19111
|
}
|
|
19091
|
-
if (
|
|
19112
|
+
if (isSandboxClosure(target)) target = materializeFunctionProperties(target);
|
|
19092
19113
|
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
19093
19114
|
if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
|
|
19094
19115
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
@@ -19158,7 +19179,7 @@ function setSuperProperty(base, receiver, key, value, context) {
|
|
|
19158
19179
|
}
|
|
19159
19180
|
function deleteSandboxProperty(target, property) {
|
|
19160
19181
|
if (isGuestHostObject(target)) return deleteHostObjectMember(target, String(property));
|
|
19161
|
-
if (
|
|
19182
|
+
if (isSandboxClosure(target)) target = materializeFunctionProperties(target);
|
|
19162
19183
|
if (isSandboxRegex(target)) target = getRegexProperties(target);
|
|
19163
19184
|
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
19164
19185
|
if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
|
|
@@ -19390,11 +19411,6 @@ async function evaluateObjectSpread(node, context) {
|
|
|
19390
19411
|
}
|
|
19391
19412
|
return { ok: true, value: entries2 };
|
|
19392
19413
|
}
|
|
19393
|
-
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)) {
|
|
19394
|
-
throw new TypeError(
|
|
19395
|
-
`Cannot spread ${describeObjectSpreadValue(value.value)} into object literal.`
|
|
19396
|
-
);
|
|
19397
|
-
}
|
|
19398
19414
|
const keys = ownEnumerableSandboxKeys(value.value, true);
|
|
19399
19415
|
context.budget.allocateArrayLength(keys.length);
|
|
19400
19416
|
const entries = [];
|
|
@@ -19409,21 +19425,6 @@ async function evaluateObjectSpread(node, context) {
|
|
|
19409
19425
|
release();
|
|
19410
19426
|
}
|
|
19411
19427
|
}
|
|
19412
|
-
function describeObjectSpreadValue(value) {
|
|
19413
|
-
if (value === null) {
|
|
19414
|
-
return "null";
|
|
19415
|
-
}
|
|
19416
|
-
if (value === void 0) {
|
|
19417
|
-
return "undefined";
|
|
19418
|
-
}
|
|
19419
|
-
if (isSandboxClosure(value)) {
|
|
19420
|
-
return "function";
|
|
19421
|
-
}
|
|
19422
|
-
if (isSandboxPromise(value)) {
|
|
19423
|
-
return "promise";
|
|
19424
|
-
}
|
|
19425
|
-
return typeof value;
|
|
19426
|
-
}
|
|
19427
19428
|
function defineSandboxProperty(target, key, value) {
|
|
19428
19429
|
Object.defineProperty(target, key, {
|
|
19429
19430
|
configurable: true,
|
|
@@ -20139,14 +20140,14 @@ function createObjectArrayGlobals(options) {
|
|
|
20139
20140
|
call: ([value]) => {
|
|
20140
20141
|
if (isGuestHostObject(value))
|
|
20141
20142
|
throw new TypeError("Live host objects cannot be made non-extensible.");
|
|
20142
|
-
Object.preventExtensions(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20143
|
+
Object.preventExtensions(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
20143
20144
|
return value;
|
|
20144
20145
|
},
|
|
20145
20146
|
name: "preventExtensions"
|
|
20146
20147
|
}),
|
|
20147
20148
|
isExtensible: createSandboxClosure({
|
|
20148
20149
|
sandbox: true,
|
|
20149
|
-
call: ([value]) => Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20150
|
+
call: ([value]) => Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
20150
20151
|
name: "isExtensible"
|
|
20151
20152
|
}),
|
|
20152
20153
|
seal: createSandboxClosure({
|
|
@@ -20154,14 +20155,14 @@ function createObjectArrayGlobals(options) {
|
|
|
20154
20155
|
call: ([value]) => {
|
|
20155
20156
|
if (isGuestHostObject(value))
|
|
20156
20157
|
throw new TypeError("Live host objects cannot be sealed.");
|
|
20157
|
-
Object.seal(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20158
|
+
Object.seal(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
20158
20159
|
return value;
|
|
20159
20160
|
},
|
|
20160
20161
|
name: "seal"
|
|
20161
20162
|
}),
|
|
20162
20163
|
isSealed: createSandboxClosure({
|
|
20163
20164
|
sandbox: true,
|
|
20164
|
-
call: ([value]) => Object.isSealed(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20165
|
+
call: ([value]) => Object.isSealed(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
20165
20166
|
name: "isSealed"
|
|
20166
20167
|
}),
|
|
20167
20168
|
freeze: createSandboxClosure({
|
|
@@ -20170,7 +20171,7 @@ function createObjectArrayGlobals(options) {
|
|
|
20170
20171
|
if (isGuestHostObject(value))
|
|
20171
20172
|
throw new TypeError("Live host objects cannot be frozen.");
|
|
20172
20173
|
if (typeof value === "object" && value !== null) {
|
|
20173
|
-
Object.freeze(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20174
|
+
Object.freeze(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
20174
20175
|
}
|
|
20175
20176
|
return value;
|
|
20176
20177
|
},
|
|
@@ -20178,7 +20179,7 @@ function createObjectArrayGlobals(options) {
|
|
|
20178
20179
|
}),
|
|
20179
20180
|
isFrozen: createSandboxClosure({
|
|
20180
20181
|
sandbox: true,
|
|
20181
|
-
call: ([value]) => Object.isFrozen(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) :
|
|
20182
|
+
call: ([value]) => Object.isFrozen(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
20182
20183
|
name: "isFrozen"
|
|
20183
20184
|
}),
|
|
20184
20185
|
assign: createSandboxClosure({
|
|
@@ -20561,7 +20562,7 @@ function reflectionProperties(value) {
|
|
|
20561
20562
|
value = createSandboxBox(value);
|
|
20562
20563
|
return objectProperties(value);
|
|
20563
20564
|
}
|
|
20564
|
-
function objectProperties(value,
|
|
20565
|
+
function objectProperties(value, _mutable = false) {
|
|
20565
20566
|
if (isSandboxGenerator(value)) return getGeneratorProperties(value);
|
|
20566
20567
|
if (isSandboxPromise(value)) return getPromiseProperties(value);
|
|
20567
20568
|
if (isSandboxMap(value) || isSandboxSet(value)) return getCollectionProperties(value);
|
|
@@ -20571,11 +20572,7 @@ function objectProperties(value, mutable = false) {
|
|
|
20571
20572
|
}
|
|
20572
20573
|
if (isGuestHostObject(value))
|
|
20573
20574
|
throw new TypeError("Live host object descriptors are not supported.");
|
|
20574
|
-
if (
|
|
20575
|
-
if (isSandboxClosure(value)) {
|
|
20576
|
-
if (mutable) throw new TypeError("Host function properties are read only.");
|
|
20577
|
-
return value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
20578
|
-
}
|
|
20575
|
+
if (isSandboxClosure(value)) return materializeFunctionProperties(value);
|
|
20579
20576
|
if (!isAssignableSandboxTarget(value))
|
|
20580
20577
|
throw new TypeError("Expected a sandbox object or function.");
|
|
20581
20578
|
return value;
|
|
@@ -22070,7 +22067,7 @@ function serializeDumpValue(value, path, state) {
|
|
|
22070
22067
|
}
|
|
22071
22068
|
return { kind: "ref", id };
|
|
22072
22069
|
}
|
|
22073
|
-
if (hasGuestObjectState(value) && !isSandboxDataView(value) && !isNumericTypedArray(value) && !(state.trustedRunReplay && (isSandboxDate(value) || isSandboxPromise(value) || isPromiseResolvingFunction(value)))) {
|
|
22070
|
+
if (hasGuestObjectState(value) && !isSandboxDataView(value) && !isNumericTypedArray(value) && !(state.trustedRunReplay && (isSandboxClosure(value) && !isGuestClosure(value) || isSandboxDate(value) || isSandboxPromise(value) || isPromiseResolvingFunction(value)))) {
|
|
22074
22071
|
throw new TypeError("Guest function properties and prototype links cannot be serialized.");
|
|
22075
22072
|
}
|
|
22076
22073
|
if (isSandboxDataView(value) || isSandboxArrayBuffer(value) || isSandboxRegExpIterator(value) || isSandboxRegex(value) && hasCustomRegexProperties(value) || isSandboxBox(value) || isSandboxDate(value) || isNumericTypedArray(value)) return serializeHeapReference(value, path, state);
|
|
@@ -22738,7 +22735,6 @@ function createConsoleJsonGlobals(options) {
|
|
|
22738
22735
|
console: options.hostCalls === void 0 ? {
|
|
22739
22736
|
error: createSandboxClosure({
|
|
22740
22737
|
sandbox: true,
|
|
22741
|
-
properties: {},
|
|
22742
22738
|
call: async (args, context) => {
|
|
22743
22739
|
const operation = options.budget.acquireCompileOwner(
|
|
22744
22740
|
false,
|
|
@@ -22757,7 +22753,6 @@ function createConsoleJsonGlobals(options) {
|
|
|
22757
22753
|
}),
|
|
22758
22754
|
log: createSandboxClosure({
|
|
22759
22755
|
sandbox: true,
|
|
22760
|
-
properties: {},
|
|
22761
22756
|
call: async (args, context) => {
|
|
22762
22757
|
const operation = options.budget.acquireCompileOwner(
|
|
22763
22758
|
false,
|
|
@@ -22793,6 +22788,10 @@ function createConsoleJsonGlobals(options) {
|
|
|
22793
22788
|
}
|
|
22794
22789
|
)
|
|
22795
22790
|
};
|
|
22791
|
+
for (const method of Object.values(globals.console)) {
|
|
22792
|
+
const properties = materializeFunctionProperties(method);
|
|
22793
|
+
hostFunctionMetadata.set(properties, new Map(Object.entries(Object.getOwnPropertyDescriptors(properties))));
|
|
22794
|
+
}
|
|
22796
22795
|
const jsonMethods = Object.entries(globals.JSON);
|
|
22797
22796
|
for (const [name] of jsonMethods) {
|
|
22798
22797
|
Object.defineProperty(globals.JSON, name, { enumerable: false });
|
|
@@ -26794,7 +26793,7 @@ function validateSnapshotData(value) {
|
|
|
26794
26793
|
dataPropertiesOnly: true
|
|
26795
26794
|
});
|
|
26796
26795
|
}
|
|
26797
|
-
function validateDumpEnvelope(snapshot) {
|
|
26796
|
+
function validateDumpEnvelope(snapshot, options = {}) {
|
|
26798
26797
|
const limits = defaultLimits();
|
|
26799
26798
|
const root = requireRecord(snapshot, "$");
|
|
26800
26799
|
if (root.version !== 1 && root.version !== DUMP_FORMAT_VERSION) {
|
|
@@ -26807,7 +26806,22 @@ function validateDumpEnvelope(snapshot) {
|
|
|
26807
26806
|
const reason = requireNonEmptyString(replayError.value, "$.replayError", limits);
|
|
26808
26807
|
fail("invalidState", "$.replayError", `snapshot is not replayable: ${reason}`);
|
|
26809
26808
|
}
|
|
26809
|
+
const semanticsDescriptor = Object.getOwnPropertyDescriptor(root, "executionSemantics");
|
|
26810
|
+
if (semanticsDescriptor !== void 0 && !("value" in semanticsDescriptor))
|
|
26811
|
+
fail("invalidType", "$.executionSemantics", "must be a data property");
|
|
26812
|
+
const semantics = semanticsDescriptor?.value;
|
|
26813
|
+
if (options.resume === true && semantics !== EXECUTION_SEMANTICS && semantics !== "jobs-v6" && semantics !== "jobs-v7" && (semantics !== void 0 || ["promiseReplay", "replay", "initialInputs"].some((key) => {
|
|
26814
|
+
const descriptor = Object.getOwnPropertyDescriptor(root, key);
|
|
26815
|
+
return descriptor !== void 0 && (!("value" in descriptor) || descriptor.value !== void 0);
|
|
26816
|
+
}))) {
|
|
26817
|
+
fail(
|
|
26818
|
+
"unsupportedVersion",
|
|
26819
|
+
"$.executionSemantics",
|
|
26820
|
+
"incompatible execution semantics; resume with the SafeJS version that created this snapshot. Migration requires explicit reconciliation, not changing its version marker."
|
|
26821
|
+
);
|
|
26822
|
+
}
|
|
26810
26823
|
const state = {
|
|
26824
|
+
allowHostFunctionState: inMemoryRunSnapshots.has(root),
|
|
26811
26825
|
allowFunctions: true,
|
|
26812
26826
|
allowUndefined: true,
|
|
26813
26827
|
entries: 0,
|
|
@@ -27305,7 +27319,7 @@ function validateArgumentsProperties(record4, path) {
|
|
|
27305
27319
|
}
|
|
27306
27320
|
}
|
|
27307
27321
|
function validateGenericValue(value, path, depth, state) {
|
|
27308
|
-
if (typeof value === "object" && value !== null && hasGuestObjectState(value)) {
|
|
27322
|
+
if (typeof value === "object" && value !== null && hasGuestObjectState(value) && !(state.allowHostFunctionState && isSandboxClosure(value) && !isGuestClosure(value))) {
|
|
27309
27323
|
fail("invalidState", path, "guest function properties, prototype links and custom descriptors cannot be restored");
|
|
27310
27324
|
}
|
|
27311
27325
|
if (state.dataPropertiesOnly && types9.isProxy(value)) {
|
|
@@ -29204,18 +29218,14 @@ function createSandboxClosure(input) {
|
|
|
29204
29218
|
value: input.cancellationSignal
|
|
29205
29219
|
});
|
|
29206
29220
|
}
|
|
29207
|
-
if (input.guest === true)
|
|
29208
|
-
|
|
29209
|
-
|
|
29210
|
-
|
|
29211
|
-
|
|
29212
|
-
|
|
29213
|
-
|
|
29214
|
-
|
|
29215
|
-
value: Object.freeze(
|
|
29216
|
-
typeof input.properties === "function" ? input.properties(closure) : input.properties
|
|
29217
|
-
)
|
|
29218
|
-
});
|
|
29221
|
+
if (input.guest === true) registerGuestClosure(closure);
|
|
29222
|
+
Object.defineProperty(closure, "properties", {
|
|
29223
|
+
get: () => getGuestFunctionProperties(closure)
|
|
29224
|
+
});
|
|
29225
|
+
if (input.guest !== true && input.properties !== void 0) {
|
|
29226
|
+
const properties = typeof input.properties === "function" ? input.properties(closure) : input.properties;
|
|
29227
|
+
const target = materializeFunctionProperties(closure, properties);
|
|
29228
|
+
if (!Object.isExtensible(properties)) Object.preventExtensions(target);
|
|
29219
29229
|
}
|
|
29220
29230
|
if (input.retainedValues !== void 0) {
|
|
29221
29231
|
Object.defineProperty(closure, sandboxRetainedValues, {
|
|
@@ -29235,12 +29245,11 @@ function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
|
29235
29245
|
}
|
|
29236
29246
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
29237
29247
|
let entries;
|
|
29238
|
-
if (
|
|
29248
|
+
if (isSandboxClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
29239
29249
|
else if (isSandboxRegex(value)) entries = Object.entries(getRegexProperties(value));
|
|
29240
29250
|
else if (isSandboxPromise(value)) entries = Object.entries(getPromiseProperties(value));
|
|
29241
29251
|
else if (isSandboxGenerator(value)) entries = Object.entries(getGeneratorProperties(value));
|
|
29242
29252
|
else if (isSandboxMap(value) || isSandboxSet(value)) entries = Object.entries(getCollectionProperties(value));
|
|
29243
|
-
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
29244
29253
|
else entries = Object.entries(Object(value));
|
|
29245
29254
|
return excludedKeys === void 0 ? entries : entries.filter(([key]) => !excludedKeys.has(key));
|
|
29246
29255
|
}
|
|
@@ -29261,12 +29270,11 @@ function ownEnumerableSandboxKeys(value, includeSymbols = false) {
|
|
|
29261
29270
|
}
|
|
29262
29271
|
if (isGuestHostObject(value)) return getHostObjectKeys(value);
|
|
29263
29272
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
29264
|
-
if (
|
|
29273
|
+
if (isSandboxClosure(value)) return Object.keys(value.properties ?? {});
|
|
29265
29274
|
if (isSandboxPromise(value)) return Object.keys(getPromiseProperties(value));
|
|
29266
29275
|
if (isSandboxGenerator(value)) return Object.keys(getGeneratorProperties(value));
|
|
29267
29276
|
if (isSandboxRegex(value)) return Object.keys(getRegexProperties(value));
|
|
29268
29277
|
if (isSandboxMap(value) || isSandboxSet(value)) return Object.keys(getCollectionProperties(value));
|
|
29269
|
-
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
29270
29278
|
return Object.keys(Object(value));
|
|
29271
29279
|
}
|
|
29272
29280
|
function createSandboxPromise(promise, metadata = {}) {
|
|
@@ -29546,7 +29554,8 @@ function measureSandboxData(values, options = {}) {
|
|
|
29546
29554
|
const bindingRoot = scopeDataRoots.get(value);
|
|
29547
29555
|
if (bindingRoot !== void 0) {
|
|
29548
29556
|
seen.add(value);
|
|
29549
|
-
visit(bindingRoot.value, depth);
|
|
29557
|
+
if ("value" in bindingRoot) visit(bindingRoot.value, depth);
|
|
29558
|
+
else for (const entry of bindingRoot.values) visit(entry, depth);
|
|
29550
29559
|
return;
|
|
29551
29560
|
}
|
|
29552
29561
|
assertSandboxDataDepth(depth);
|
|
@@ -29811,12 +29820,15 @@ function measureSandboxData(values, options = {}) {
|
|
|
29811
29820
|
const proxyDescriptors = proxyKeys?.map((key) => Object.getOwnPropertyDescriptor(value, key));
|
|
29812
29821
|
const includeNonEnumerable = isSandboxDate(value) || isSandboxArrayBuffer(value) || isSandboxDataView(value) || sandboxErrorTypes.has(value) || hasManagedDescriptors(value);
|
|
29813
29822
|
const keys = proxyKeys ?? (includeNonEnumerable ? Object.getOwnPropertyNames(value) : Object.keys(value));
|
|
29823
|
+
const metadata = hostFunctionMetadata.get(value);
|
|
29814
29824
|
const retained = [];
|
|
29815
29825
|
for (let index = 0; index < keys.length; index++) {
|
|
29816
29826
|
const key = keys[index];
|
|
29817
29827
|
const descriptor = proxyDescriptors === void 0 ? Object.getOwnPropertyDescriptor(value, key) : proxyDescriptors[index];
|
|
29818
29828
|
if (descriptor === void 0) continue;
|
|
29819
29829
|
if (!descriptor.enumerable && !includeNonEnumerable) continue;
|
|
29830
|
+
const initial = metadata?.get(key);
|
|
29831
|
+
if (initial !== void 0 && "value" in descriptor && Object.is(initial.value, descriptor.value) && initial.enumerable === descriptor.enumerable && initial.configurable === descriptor.configurable && initial.writable === descriptor.writable) continue;
|
|
29820
29832
|
usage += 1 + key.length;
|
|
29821
29833
|
if ("value" in descriptor) retained.push(descriptor.value);
|
|
29822
29834
|
else for (const closure of retainedAccessorClosures(descriptor)) retained.push(closure);
|
|
@@ -30686,7 +30698,7 @@ function encodeReplayData(value, options = {}) {
|
|
|
30686
30698
|
if (context.failed) throw new TypeError("Cannot extend an incomplete graph.");
|
|
30687
30699
|
const { nodes, seen, symbols, float32Buffers } = context;
|
|
30688
30700
|
const initialNodeCount = nodes.length;
|
|
30689
|
-
const encode = (entry, depth, path) => {
|
|
30701
|
+
const encode = (entry, depth, path, capabilityProperties = false) => {
|
|
30690
30702
|
if (depth > MAX_DATA_DEPTH) throw new TypeError("Replay data exceeds the nesting limit.");
|
|
30691
30703
|
if (entry === null || typeof entry === "boolean" || typeof entry === "string") return entry;
|
|
30692
30704
|
if (entry === void 0) return { tag: "undefined" };
|
|
@@ -30713,7 +30725,7 @@ function encodeReplayData(value, options = {}) {
|
|
|
30713
30725
|
const id2 = options.identifyPromise?.(entry, path);
|
|
30714
30726
|
if (typeof id2 === "string" && id2.length > 0) return { tag: "promise-capability", id: id2 };
|
|
30715
30727
|
}
|
|
30716
|
-
if (typeof entry === "object" && entry !== null && hasGuestObjectState(entry) && !isSandboxModuleNamespace(entry)) {
|
|
30728
|
+
if (typeof entry === "object" && entry !== null && hasGuestObjectState(entry) && !isSandboxModuleNamespace(entry) && !(!hasExplicitSandboxPrototype(entry) && (capabilityProperties || hostFunctionPropertyTables.has(entry) || isSandboxClosure(entry) && !isGuestClosure(entry)))) {
|
|
30717
30729
|
throw new MissingReplayCapabilityError("Guest function properties and prototype links cannot be serialized.");
|
|
30718
30730
|
}
|
|
30719
30731
|
let capabilityId;
|
|
@@ -30741,7 +30753,7 @@ function encodeReplayData(value, options = {}) {
|
|
|
30741
30753
|
nodes[id] = {
|
|
30742
30754
|
kind: "capability",
|
|
30743
30755
|
id: capabilityId,
|
|
30744
|
-
properties:
|
|
30756
|
+
properties: encode(entry.properties, depth + 1, [...path, "properties"], true)
|
|
30745
30757
|
};
|
|
30746
30758
|
} else if (isRawJson(entry)) {
|
|
30747
30759
|
nodes[id] = { kind: "raw-json", text: entry.rawJSON };
|
|
@@ -31004,6 +31016,8 @@ function decodeReplayData(input, options = {}, parent) {
|
|
|
31004
31016
|
return properties;
|
|
31005
31017
|
}
|
|
31006
31018
|
});
|
|
31019
|
+
const metadata = capability.properties === void 0 ? void 0 : hostFunctionMetadata.get(capability.properties);
|
|
31020
|
+
if (copy.properties !== void 0 && metadata !== void 0) hostFunctionMetadata.set(copy.properties, metadata);
|
|
31007
31021
|
options.onCapabilityRestored?.(capability, copy);
|
|
31008
31022
|
const moduleFunction = moduleFunctionOrigins.get(capability);
|
|
31009
31023
|
if (moduleFunction !== void 0) moduleFunctionOrigins.set(copy, moduleFunction);
|
|
@@ -33083,7 +33097,8 @@ function wrapCallerInjectedBindings(bindings, options) {
|
|
|
33083
33097
|
function wrapCallerInjectedFunction(name, value, options, state) {
|
|
33084
33098
|
const existing = state.seen.get(value) ?? options.hostCalls?.nativeClosures.get(value);
|
|
33085
33099
|
if (existing !== void 0) return existing;
|
|
33086
|
-
const
|
|
33100
|
+
const nativeName = name === "default" ? Object.getOwnPropertyDescriptor(value, "name")?.value : void 0;
|
|
33101
|
+
const bindingName = typeof nativeName === "string" && nativeName.length > 0 ? nativeName : name;
|
|
33087
33102
|
const callable = value;
|
|
33088
33103
|
return createSandboxClosure({
|
|
33089
33104
|
...isAsyncFunction(callable) && !options.realm?.awaitResult(callable) ? { async: true } : {},
|
|
@@ -34054,6 +34069,7 @@ function readStringProperty(value, key) {
|
|
|
34054
34069
|
}
|
|
34055
34070
|
function copyFunctionProperties(callable, stackFrames, options, state, path) {
|
|
34056
34071
|
const properties = {};
|
|
34072
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
34057
34073
|
for (const key of Object.getOwnPropertyNames(callable)) {
|
|
34058
34074
|
const descriptor = Object.getOwnPropertyDescriptor(callable, key);
|
|
34059
34075
|
if (descriptor === void 0) {
|
|
@@ -34062,6 +34078,11 @@ function copyFunctionProperties(callable, stackFrames, options, state, path) {
|
|
|
34062
34078
|
if ("get" in descriptor || "set" in descriptor) {
|
|
34063
34079
|
continue;
|
|
34064
34080
|
}
|
|
34081
|
+
if (key === "name" && typeof descriptor.value === "string" || key === "length" && typeof descriptor.value === "number") {
|
|
34082
|
+
Object.defineProperty(properties, key, descriptor);
|
|
34083
|
+
metadata.set(key, descriptor);
|
|
34084
|
+
continue;
|
|
34085
|
+
}
|
|
34065
34086
|
if (typeof descriptor.value !== "function") {
|
|
34066
34087
|
continue;
|
|
34067
34088
|
}
|
|
@@ -34073,7 +34094,8 @@ function copyFunctionProperties(callable, stackFrames, options, state, path) {
|
|
|
34073
34094
|
joinPath2(path, key)
|
|
34074
34095
|
);
|
|
34075
34096
|
}
|
|
34076
|
-
|
|
34097
|
+
if (metadata.size > 0) hostFunctionMetadata.set(properties, metadata);
|
|
34098
|
+
return Reflect.ownKeys(properties).length > 0 ? properties : void 0;
|
|
34077
34099
|
}
|
|
34078
34100
|
function isPlainObject4(value) {
|
|
34079
34101
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -34323,20 +34345,13 @@ var SnapshotMismatchError = class extends Error {
|
|
|
34323
34345
|
function restore(snapshot, options, owner) {
|
|
34324
34346
|
assertSnapshotInactive(snapshot);
|
|
34325
34347
|
try {
|
|
34326
|
-
validateDumpEnvelope(snapshot);
|
|
34348
|
+
validateDumpEnvelope(snapshot, { resume: true });
|
|
34327
34349
|
} catch (error) {
|
|
34328
34350
|
if (!(error instanceof SnapshotValidationError) || error.code !== "invalidState" || !inMemoryRunSnapshots.has(snapshot)) throw error;
|
|
34329
34351
|
snapshot = JSON.parse(serializeSafeJSSnapshot(snapshot));
|
|
34330
|
-
validateDumpEnvelope(snapshot);
|
|
34352
|
+
validateDumpEnvelope(snapshot, { resume: true });
|
|
34331
34353
|
}
|
|
34332
34354
|
validateSnapshotMigration(snapshot.migration, snapshot.sourceHash, owner);
|
|
34333
|
-
if (snapshot.executionSemantics !== EXECUTION_SEMANTICS && snapshot.executionSemantics !== "jobs-v6" && snapshot.executionSemantics !== "jobs-v7" && (snapshot.executionSemantics !== void 0 || snapshot.promiseReplay !== void 0 || snapshot.replay !== void 0 || snapshot.initialInputs !== void 0)) {
|
|
34334
|
-
throw new SnapshotValidationError(
|
|
34335
|
-
"unsupportedVersion",
|
|
34336
|
-
"$.executionSemantics",
|
|
34337
|
-
"incompatible execution semantics; resume with the SafeJS version that created this snapshot. Migration requires explicit reconciliation, not changing its version marker."
|
|
34338
|
-
);
|
|
34339
|
-
}
|
|
34340
34355
|
const currentSourceHash = hashSource(
|
|
34341
34356
|
options.source,
|
|
34342
34357
|
owner,
|
|
@@ -46858,6 +46873,10 @@ function prepareReplayInputs(current, saved, preparePromise, onCapabilityRestore
|
|
|
46858
46873
|
value = [...value.values][index];
|
|
46859
46874
|
continue;
|
|
46860
46875
|
}
|
|
46876
|
+
if (key === "properties" && isSandboxClosure(value)) {
|
|
46877
|
+
value = value.properties;
|
|
46878
|
+
continue;
|
|
46879
|
+
}
|
|
46861
46880
|
if (value === null || typeof value !== "object") return void 0;
|
|
46862
46881
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
46863
46882
|
if (descriptor === void 0 || !("value" in descriptor)) return void 0;
|
|
@@ -47594,4 +47613,4 @@ export {
|
|
|
47594
47613
|
FileSnapshotBackend,
|
|
47595
47614
|
run
|
|
47596
47615
|
};
|
|
47597
|
-
//# sourceMappingURL=chunk-
|
|
47616
|
+
//# sourceMappingURL=chunk-EMOUVQDE.js.map
|