@poe-platform/safe-js 0.1.274 → 0.1.275

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.
@@ -8012,7 +8012,7 @@ function setSandboxPrototype(value, prototype, budget) {
8012
8012
  if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
8013
8013
  throw new TypeError("Object.prototype has an immutable null prototype.");
8014
8014
  }
8015
- if (!Array.isArray(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
8015
+ if (!Array.isArray(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
8016
8016
  throw new TypeError(
8017
8017
  "Prototype links require supported sandbox objects."
8018
8018
  );
@@ -8021,7 +8021,7 @@ function setSandboxPrototype(value, prototype, budget) {
8021
8021
  if (prototype === null) prototypes.set(value, null);
8022
8022
  return;
8023
8023
  }
8024
- if (!Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
8024
+ if (!Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
8025
8025
  throw new TypeError("Cannot change the prototype of a non-extensible object.");
8026
8026
  }
8027
8027
  let depth = 0;
@@ -11759,7 +11759,7 @@ function createPromiseGlobals(options) {
11759
11759
  };
11760
11760
  if (!isSandboxPromise(value)) return finish(void 0);
11761
11761
  const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
11762
- const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
11762
+ const actualConstructor = descriptor === void 0 ? hasExplicitSandboxPrototype(value) ? void 0 : getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
11763
11763
  return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
11764
11764
  },
11765
11765
  guest: true,
@@ -12035,6 +12035,7 @@ function getPromisePrototype(budget) {
12035
12035
  return prototype;
12036
12036
  }
12037
12037
  function readPromiseReceiverProperty(receiver, property, prototype, context) {
12038
+ if (isSandboxPromise(receiver) && hasExplicitSandboxPrototype(receiver)) return void 0;
12038
12039
  if (!isSandboxPromise(receiver) && context?.getProperty !== void 0)
12039
12040
  return context.getProperty(receiver, property);
12040
12041
  const properties = isSandboxPromise(receiver) ? prototype : isSandboxClosure(receiver) ? receiver.properties : receiver;
@@ -12465,6 +12466,7 @@ function isSelfResolution(result, self) {
12465
12466
  }
12466
12467
  function hasCustomPromiseThen(value, budget) {
12467
12468
  const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
12469
+ if (descriptor === void 0 && isSandboxPromise(value) && hasExplicitSandboxPrototype(value)) return true;
12468
12470
  return descriptor !== void 0 && (!isSandboxClosure(descriptor.value) || !intrinsicPromiseThenMethods.has(descriptor.value));
12469
12471
  }
12470
12472
  function requiresPromiseResolution(value, budget) {
@@ -18191,7 +18193,7 @@ function getPropertyValue(target, property, context, receiver = target) {
18191
18193
  return getCollectionIteratorMember(target, property, context.budget);
18192
18194
  if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
18193
18195
  if (isSandboxClosure(target)) return getClosureMemberValue(target, property, context);
18194
- if (isSandboxPromise(target)) return getPromiseMember(property, context.budget);
18196
+ if (isSandboxPromise(target)) return hasExplicitSandboxPrototype(target) ? void 0 : getPromiseMember(property, context.budget);
18195
18197
  if (isSandboxRegex(target)) return hasExplicitSandboxPrototype(target) || getSandboxPrototype(target, context.budget) !== null ? void 0 : getRegexMember(target, property, context.budget, createCoercionContext(context));
18196
18198
  if (!isIndexableSandboxValue(target)) {
18197
18199
  throw new TypeError("Attempted to read a property from a non-object value.");
@@ -21498,6 +21500,7 @@ function serializeSafeJSSnapshot(snapshot) {
21498
21500
  }
21499
21501
  function createDumpFile(snapshot) {
21500
21502
  const state = {
21503
+ replayPromises: inMemoryRunSnapshots.has(snapshot),
21501
21504
  float32Buffers: /* @__PURE__ */ new WeakMap(),
21502
21505
  heap: {},
21503
21506
  ...indexHeapContainers(snapshot),
@@ -21554,7 +21557,7 @@ function serializeDumpValue(value, path, state) {
21554
21557
  }
21555
21558
  return { kind: "ref", id };
21556
21559
  }
21557
- if (hasGuestObjectState(value)) {
21560
+ if (hasGuestObjectState(value) && !(state.replayPromises && isSandboxPromise(value))) {
21558
21561
  throw new TypeError("Guest function properties and prototype links cannot be serialized.");
21559
21562
  }
21560
21563
  if (isSandboxRegExpIterator(value) || isSandboxRegex(value) && hasCustomRegexProperties(value) || isSandboxBox(value) || isSandboxDate(value) || isFloat32Array(value)) return serializeHeapReference(value, path, state);
@@ -25913,6 +25916,7 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
25913
25916
  value: copyFromSandbox(descriptor.value, state, `${path}.<property>`, options, depth + 1)
25914
25917
  });
25915
25918
  }
25919
+ if (hasNullObjectPrototype(value)) Object.setPrototypeOf(copy, null);
25916
25920
  if (!Object.isExtensible(properties)) Object.preventExtensions(copy);
25917
25921
  return copy;
25918
25922
  }
@@ -40237,4 +40241,4 @@ export {
40237
40241
  FileSnapshotBackend,
40238
40242
  run
40239
40243
  };
40240
- //# sourceMappingURL=chunk-4MTUBJBW.js.map
40244
+ //# sourceMappingURL=chunk-MPVIYBZC.js.map