@poe-platform/safe-js 0.1.91 → 0.1.92

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.
@@ -7000,6 +7000,27 @@ function getSandboxPrototype(value, budget) {
7000
7000
  function hasExplicitSandboxPrototype(value) {
7001
7001
  return prototypes.has(value);
7002
7002
  }
7003
+ function getSandboxDataProperty(value, key, budget) {
7004
+ let current = value;
7005
+ let depth = 0;
7006
+ while (typeof current === "object" && current !== null) {
7007
+ if (isGuestHostObject(current)) return getHostObjectMember(current, String(key));
7008
+ if (isGuestClosure(current)) return getGuestFunctionProperty(current, String(key));
7009
+ if (isSandboxClosure(current)) {
7010
+ const properties = current.properties;
7011
+ return properties !== void 0 && Object.hasOwn(properties, String(key)) ? properties[String(key)] : void 0;
7012
+ }
7013
+ if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxGenerator(current))
7014
+ return void 0;
7015
+ if (Object.hasOwn(current, String(key))) return current[String(key)];
7016
+ current = getSandboxPrototype(current, budget);
7017
+ if (current !== null) {
7018
+ budget?.visitNode();
7019
+ assertSandboxDataDepth(++depth);
7020
+ }
7021
+ }
7022
+ return void 0;
7023
+ }
7003
7024
  function setSandboxPrototype(value, prototype, budget) {
7004
7025
  if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
7005
7026
  throw new TypeError("Object.prototype has an immutable null prototype.");
@@ -8940,8 +8961,8 @@ async function bindArrayPattern(pattern, value, context, evaluateNode2) {
8940
8961
  return { ok: true };
8941
8962
  }
8942
8963
  async function bindObjectPattern(pattern, value, context, evaluateNode2) {
8943
- if (typeof value !== "object" && !Array.isArray(value) || value === null) {
8944
- throw new TypeError("Object catch bindings require a non-null object value.");
8964
+ if (value === null || value === void 0) {
8965
+ throw new TypeError("Object catch bindings require a non-nullish value.");
8945
8966
  }
8946
8967
  const excludedKeys = /* @__PURE__ */ new Set();
8947
8968
  for (const property of pattern.properties) {
@@ -8960,7 +8981,7 @@ async function bindObjectPattern(pattern, value, context, evaluateNode2) {
8960
8981
  excludedKeys.add(String(key.value));
8961
8982
  const binding = await bindPattern(
8962
8983
  property.value,
8963
- getObjectPatternValue(value, key.value),
8984
+ context.getProperty === void 0 ? getSandboxDataProperty(value, key.value, context.budget) : context.getProperty(value, key.value),
8964
8985
  context,
8965
8986
  evaluateNode2
8966
8987
  );
@@ -9004,15 +9025,9 @@ function getStaticPropertyKey(property) {
9004
9025
  throw new TypeError(`Unsupported catch binding property key '${property.type}'.`);
9005
9026
  }
9006
9027
  }
9007
- function getObjectPatternValue(value, key) {
9008
- return value[key];
9009
- }
9010
9028
  function copyObjectRest(value, excludedKeys) {
9011
9029
  const rest = /* @__PURE__ */ Object.create(null);
9012
- for (const [key, entryValue] of Object.entries(value)) {
9013
- if (excludedKeys.has(key)) {
9014
- continue;
9015
- }
9030
+ for (const [key, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
9016
9031
  rest[key] = entryValue;
9017
9032
  }
9018
9033
  return rest;
@@ -10217,18 +10232,21 @@ function createSandboxClosure(input) {
10217
10232
  }
10218
10233
  return Object.freeze(closure);
10219
10234
  }
10220
- function ownEnumerableSandboxEntries(value) {
10235
+ function ownEnumerableSandboxEntries(value, excludedKeys) {
10221
10236
  if (isGuestHostObject(value)) {
10222
- const entries = [];
10237
+ const entries2 = [];
10223
10238
  for (const key of getHostObjectKeys(value)) {
10224
- if (hasHostObjectMember(value, key, true)) entries.push([key, getHostObjectMember(value, key)]);
10239
+ if (excludedKeys?.has(key)) continue;
10240
+ if (hasHostObjectMember(value, key, true)) entries2.push([key, getHostObjectMember(value, key)]);
10225
10241
  }
10226
- return entries;
10242
+ return entries2;
10227
10243
  }
10228
10244
  if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
10229
- if (isGuestClosure(value)) return Object.entries(value.properties ?? {});
10230
- if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
10231
- return Object.entries(Object(value));
10245
+ let entries;
10246
+ if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
10247
+ else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
10248
+ else entries = Object.entries(Object(value));
10249
+ return excludedKeys === void 0 ? entries : entries.filter(([key]) => !excludedKeys.has(key));
10232
10250
  }
10233
10251
  function createSandboxPromise(promise, metadata = {}) {
10234
10252
  const original = metadata.trackReplay === false ? promise : promiseReplayContext.getStore()?.track(promise) ?? promise;
@@ -27370,7 +27388,8 @@ async function evaluateThrowStatement2(node, context) {
27370
27388
  async function evaluateTryStatement2(node, context) {
27371
27389
  return evaluateTryStatement(node, {
27372
27390
  ...context,
27373
- toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context))
27391
+ toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context)),
27392
+ getProperty: (value, key) => getPropertyValue(value, key, context)
27374
27393
  }, evaluateNode);
27375
27394
  }
27376
27395
  async function evaluateUnaryExpression(node, context) {
@@ -32897,4 +32916,4 @@ export {
32897
32916
  FileSnapshotBackend,
32898
32917
  run
32899
32918
  };
32900
- //# sourceMappingURL=chunk-JZXAWFPL.js.map
32919
+ //# sourceMappingURL=chunk-MVOTTS35.js.map