@poe-platform/safe-js 0.1.267 → 0.1.269

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.
@@ -11737,10 +11737,14 @@ function createPromiseGlobals(options) {
11737
11737
  if (typeof constructor !== "object" || constructor === null) {
11738
11738
  throw new TypeError("Promise.resolve requires an object receiver.");
11739
11739
  }
11740
- if (isSandboxPromise(value) && getPromiseMember("constructor", options.budget) === constructor) {
11741
- return value;
11742
- }
11743
- return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
11740
+ const finish = (actualConstructor2) => {
11741
+ if (isSandboxPromise(value) && actualConstructor2 === constructor) return value;
11742
+ return isSandboxPromiseConstructor(constructor) ? createSandboxPromise(resolveSandboxValue(value, { budget: options.budget })) : settleConstructedPromise(constructor, value, "fulfilled", options.budget, context);
11743
+ };
11744
+ if (!isSandboxPromise(value)) return finish(void 0);
11745
+ const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
11746
+ const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
11747
+ return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
11744
11748
  },
11745
11749
  name: "resolve"
11746
11750
  }),
@@ -12106,7 +12110,12 @@ function resolveSandboxValueNow(value, options) {
12106
12110
  (reason) => Promise.reject(budgetIfNeeded(reason, options.budget))
12107
12111
  );
12108
12112
  }
12109
- if (isSandboxPromise(value)) {
12113
+ if (isSelfResolution(value, options.self)) {
12114
+ return Promise.reject(
12115
+ options.budget === void 0 ? new TypeError("Promise cannot resolve to itself.") : createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], options.budget)
12116
+ );
12117
+ }
12118
+ if (isSandboxPromise(value) && getSandboxPropertyDescriptor(value, "then", options.budget) === void 0) {
12110
12119
  if (options.budget !== void 0) {
12111
12120
  return resolvePromiseResult(value, options.budget, options.self);
12112
12121
  }
@@ -12260,7 +12269,9 @@ function resolvePromiseResult(result, budget, self) {
12260
12269
  createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], budget)
12261
12270
  );
12262
12271
  }
12263
- if (!isSandboxPromise(result)) return resolveSandboxValue(result, { budget, self });
12272
+ if (!isSandboxPromise(result) || getSandboxPropertyDescriptor(result, "then", budget) !== void 0) {
12273
+ return resolveSandboxValue(result, { budget, self });
12274
+ }
12264
12275
  const then = getPromiseMember("then", budget);
12265
12276
  if (!isSandboxClosure(then)) return Promise.resolve(result);
12266
12277
  return new Promise((resolve, reject) => {
@@ -12324,7 +12335,7 @@ function requiresPromiseResolution(value, budget) {
12324
12335
  return descriptor !== void 0 && (!("value" in descriptor) || isSandboxClosure(descriptor.value));
12325
12336
  }
12326
12337
  function getThenable(value, budget) {
12327
- if (typeof value !== "object" || value === null || isSandboxPromise(value)) {
12338
+ if (typeof value !== "object" || value === null) {
12328
12339
  return void 0;
12329
12340
  }
12330
12341
  const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
@@ -40089,4 +40100,4 @@ export {
40089
40100
  FileSnapshotBackend,
40090
40101
  run
40091
40102
  };
40092
- //# sourceMappingURL=chunk-GF6I2VQR.js.map
40103
+ //# sourceMappingURL=chunk-VIBISLKQ.js.map