@poe-platform/safe-js 0.1.270 → 0.1.271

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.
@@ -11842,21 +11842,24 @@ function getPromisePrototype(budget) {
11842
11842
  const target = context?.thisValue;
11843
11843
  if (!isSandboxPromise(target))
11844
11844
  throw new TypeError("Promise.then requires a promise receiver.");
11845
- validatePromiseConstructorProperty(target, prototype);
11846
- observeSandboxPromise(target);
11847
- const chained = createSandboxPromise(
11848
- target.promise.then(
11849
- (value) => {
11850
- consumeSettledHostCall(target);
11851
- return runPromiseReaction(onFulfilled, value, "fulfilled", budget, chained, context);
11852
- },
11853
- (reason) => {
11854
- consumeSettledHostCall(target);
11855
- return runPromiseReaction(onRejected, reason, "rejected", budget, chained, context);
11856
- }
11857
- )
11858
- );
11859
- return chained;
11845
+ const finish = () => {
11846
+ observeSandboxPromise(target);
11847
+ const chained = createSandboxPromise(
11848
+ target.promise.then(
11849
+ (value) => {
11850
+ consumeSettledHostCall(target);
11851
+ return runPromiseReaction(onFulfilled, value, "fulfilled", budget, chained, context);
11852
+ },
11853
+ (reason) => {
11854
+ consumeSettledHostCall(target);
11855
+ return runPromiseReaction(onRejected, reason, "rejected", budget, chained, context);
11856
+ }
11857
+ )
11858
+ );
11859
+ return chained;
11860
+ };
11861
+ const validation = validatePromiseConstructorProperty(target, prototype, budget, context);
11862
+ return validation instanceof Promise ? validation.then(finish) : finish();
11860
11863
  },
11861
11864
  name: "then"
11862
11865
  }),
@@ -11937,7 +11940,7 @@ function getPromisePrototype(budget) {
11937
11940
  const then = descriptor === void 0 ? readPromiseReceiverProperty(target, "then", prototype, context) : readPropertyDescriptor(descriptor, target, context, true);
11938
11941
  return then instanceof Promise ? then.then(invoke) : invoke(then);
11939
11942
  };
11940
- const validation = validatePromiseConstructorProperty(target, prototype, context);
11943
+ const validation = validatePromiseConstructorProperty(target, prototype, budget, context);
11941
11944
  return validation instanceof Promise ? validation.then(finish) : finish();
11942
11945
  },
11943
11946
  name: "finally"
@@ -11955,12 +11958,13 @@ function readPromiseReceiverProperty(receiver, property, prototype, context) {
11955
11958
  const properties = isSandboxPromise(receiver) ? prototype : isSandboxClosure(receiver) ? receiver.properties : receiver;
11956
11959
  return typeof properties === "object" && properties !== null && Object.hasOwn(properties, property) ? properties[property] : void 0;
11957
11960
  }
11958
- function validatePromiseConstructorProperty(receiver, prototype, context) {
11961
+ function validatePromiseConstructorProperty(receiver, prototype, budget, context) {
11959
11962
  const validate = (constructor2) => {
11960
11963
  if (constructor2 !== void 0 && (typeof constructor2 !== "object" || constructor2 === null))
11961
11964
  throw new TypeError("Promise constructor property must be an object.");
11962
11965
  };
11963
- const constructor = readPromiseReceiverProperty(receiver, "constructor", prototype, context);
11966
+ const descriptor = getSandboxPropertyDescriptor(receiver, "constructor", budget);
11967
+ const constructor = descriptor === void 0 ? readPromiseReceiverProperty(receiver, "constructor", prototype, context) : readPropertyDescriptor(descriptor, receiver, context, true);
11964
11968
  return constructor instanceof Promise ? constructor.then(validate) : validate(constructor);
11965
11969
  }
11966
11970
  async function settleIterable(iterable, method, budget, constructor, context) {
@@ -40102,4 +40106,4 @@ export {
40102
40106
  FileSnapshotBackend,
40103
40107
  run
40104
40108
  };
40105
- //# sourceMappingURL=chunk-JJRD6D25.js.map
40109
+ //# sourceMappingURL=chunk-KAZ53U6F.js.map