@poe-platform/safe-js 0.1.269 → 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
  }),
@@ -11874,7 +11877,8 @@ function getPromisePrototype(budget) {
11874
11877
  newTarget: void 0
11875
11878
  });
11876
11879
  };
11877
- const then = readPromiseReceiverProperty(target, "then", prototype, context);
11880
+ const descriptor = getSandboxPropertyDescriptor(target, "then", budget);
11881
+ const then = descriptor === void 0 ? readPromiseReceiverProperty(target, "then", prototype, context) : readPropertyDescriptor(descriptor, target, context, true);
11878
11882
  return then instanceof Promise ? then.then(invoke) : invoke(then);
11879
11883
  },
11880
11884
  name: "catch"
@@ -11932,10 +11936,11 @@ function getPromisePrototype(budget) {
11932
11936
  });
11933
11937
  };
11934
11938
  const finish = () => {
11935
- const then = readPromiseReceiverProperty(target, "then", prototype, context);
11939
+ const descriptor = getSandboxPropertyDescriptor(target, "then", budget);
11940
+ const then = descriptor === void 0 ? readPromiseReceiverProperty(target, "then", prototype, context) : readPropertyDescriptor(descriptor, target, context, true);
11936
11941
  return then instanceof Promise ? then.then(invoke) : invoke(then);
11937
11942
  };
11938
- const validation = validatePromiseConstructorProperty(target, prototype, context);
11943
+ const validation = validatePromiseConstructorProperty(target, prototype, budget, context);
11939
11944
  return validation instanceof Promise ? validation.then(finish) : finish();
11940
11945
  },
11941
11946
  name: "finally"
@@ -11953,12 +11958,13 @@ function readPromiseReceiverProperty(receiver, property, prototype, context) {
11953
11958
  const properties = isSandboxPromise(receiver) ? prototype : isSandboxClosure(receiver) ? receiver.properties : receiver;
11954
11959
  return typeof properties === "object" && properties !== null && Object.hasOwn(properties, property) ? properties[property] : void 0;
11955
11960
  }
11956
- function validatePromiseConstructorProperty(receiver, prototype, context) {
11961
+ function validatePromiseConstructorProperty(receiver, prototype, budget, context) {
11957
11962
  const validate = (constructor2) => {
11958
11963
  if (constructor2 !== void 0 && (typeof constructor2 !== "object" || constructor2 === null))
11959
11964
  throw new TypeError("Promise constructor property must be an object.");
11960
11965
  };
11961
- 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);
11962
11968
  return constructor instanceof Promise ? constructor.then(validate) : validate(constructor);
11963
11969
  }
11964
11970
  async function settleIterable(iterable, method, budget, constructor, context) {
@@ -40100,4 +40106,4 @@ export {
40100
40106
  FileSnapshotBackend,
40101
40107
  run
40102
40108
  };
40103
- //# sourceMappingURL=chunk-VIBISLKQ.js.map
40109
+ //# sourceMappingURL=chunk-KAZ53U6F.js.map