@poe-platform/safe-js 0.1.166 → 0.1.168

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.
@@ -7536,9 +7536,9 @@ function setSandboxPrototype(value, prototype, budget) {
7536
7536
  if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
7537
7537
  throw new TypeError("Object.prototype has an immutable null prototype.");
7538
7538
  }
7539
- if (!isPrototypeRecord(value) || prototype !== null && !isPrototypeRecord(prototype)) {
7539
+ if (!Array.isArray(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isPrototypeRecord(prototype)) {
7540
7540
  throw new TypeError(
7541
- "Prototype links require ordinary sandbox objects or guest functions."
7541
+ "Prototype links require ordinary sandbox objects, arrays, or guest functions."
7542
7542
  );
7543
7543
  }
7544
7544
  if (prototypes.has(value) && getSandboxPrototype(value, budget) === prototype) return;
@@ -9371,6 +9371,7 @@ function getSandboxIterator(value, budget, context) {
9371
9371
  if (isSandboxSet(value)) {
9372
9372
  return collectionIterator(value.values);
9373
9373
  }
9374
+ if (Array.isArray(value) && hasExplicitSandboxPrototype(value)) return void 0;
9374
9375
  if (Array.isArray(value) && context?.getProperty !== void 0) {
9375
9376
  let index = 0;
9376
9377
  return {
@@ -10934,6 +10935,36 @@ function createObjectArrayGlobals(options) {
10934
10935
  },
10935
10936
  name: "fromEntries"
10936
10937
  }),
10938
+ preventExtensions: createSandboxClosure({
10939
+ sandbox: true,
10940
+ call: ([value]) => {
10941
+ if (isGuestHostObject(value))
10942
+ throw new TypeError("Live host objects cannot be made non-extensible.");
10943
+ Object.preventExtensions(isGuestClosure(value) ? materializeFunctionProperties(value) : value);
10944
+ return value;
10945
+ },
10946
+ name: "preventExtensions"
10947
+ }),
10948
+ isExtensible: createSandboxClosure({
10949
+ sandbox: true,
10950
+ call: ([value]) => Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : value),
10951
+ name: "isExtensible"
10952
+ }),
10953
+ seal: createSandboxClosure({
10954
+ sandbox: true,
10955
+ call: ([value]) => {
10956
+ if (isGuestHostObject(value))
10957
+ throw new TypeError("Live host objects cannot be sealed.");
10958
+ Object.seal(isGuestClosure(value) ? materializeFunctionProperties(value) : value);
10959
+ return value;
10960
+ },
10961
+ name: "seal"
10962
+ }),
10963
+ isSealed: createSandboxClosure({
10964
+ sandbox: true,
10965
+ call: ([value]) => Object.isSealed(isGuestClosure(value) ? materializeFunctionProperties(value) : value),
10966
+ name: "isSealed"
10967
+ }),
10937
10968
  freeze: createSandboxClosure({
10938
10969
  sandbox: true,
10939
10970
  call: ([value]) => {
@@ -11913,19 +11944,25 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
11913
11944
  options.budget.setRetainedValues(retained, () => [result]);
11914
11945
  try {
11915
11946
  for (const entry of [value, ...args]) {
11916
- if (!Array.isArray(entry)) {
11947
+ let spread = false;
11948
+ if (entry !== null && (typeof entry === "object" || typeof entry === "function")) {
11949
+ const flag = options.context?.getProperty !== void 0 ? await options.context.getProperty(entry, Symbol.isConcatSpreadable) : getSandboxDataProperty(entry, Symbol.isConcatSpreadable, options.budget);
11950
+ spread = flag === void 0 ? Array.isArray(entry) : Boolean(flag);
11951
+ }
11952
+ if (!spread) {
11917
11953
  options.budget.allocateArrayLength(result.length + 1);
11918
11954
  result.push(entry);
11919
11955
  continue;
11920
11956
  }
11921
11957
  const start = result.length;
11922
- const length = entry.length;
11958
+ const source = await arrayLikeView(entry, options);
11959
+ const length = source.length;
11923
11960
  options.budget.allocateArrayLength(start + length);
11924
11961
  result.length += length;
11925
11962
  for (let index = 0; index < length; index++) {
11926
11963
  options.budget.visitNode();
11927
- if (index in entry)
11928
- result[start + index] = await readArrayElement(entry, index, options);
11964
+ if (index in source)
11965
+ result[start + index] = await readArrayElement(source, index, options);
11929
11966
  }
11930
11967
  }
11931
11968
  return budgetProducedValue(result, options.budget);
@@ -15713,6 +15750,8 @@ async function evaluateMemberCallExpression(node, context) {
15713
15750
  return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context, member.superReceiver.value), context, member.superReceiver.value);
15714
15751
  if (typeof member.property === "symbol")
15715
15752
  return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context), context, member.object);
15753
+ if (Array.isArray(member.object) && hasExplicitSandboxPrototype(member.object))
15754
+ return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context), context, member.object);
15716
15755
  if ((typeof member.object === "string" || typeof member.object === "number" || typeof member.object === "boolean" || typeof member.object === "symbol") && getBoxedPrototype(member.object, context.budget) !== void 0) {
15717
15756
  if (isDefaultBoxedMethod(member.object, member.property, context.budget)) {
15718
15757
  if (typeof member.object === "string" && isStringMethodName(member.property))
@@ -16081,7 +16120,7 @@ function hasSandboxProperty(value, key, context) {
16081
16120
  while (typeof current === "object" && current !== null) {
16082
16121
  if (isGuestHostObject(current)) return typeof key === "symbol" ? false : hasHostObjectMember(current, String(key));
16083
16122
  if (hasOwnSandboxProperty(current, key, false)) return true;
16084
- if (!(isGuestClosure(current) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current))) {
16123
+ if (!((isGuestClosure(current) || Array.isArray(current)) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current))) {
16085
16124
  return getPropertyValue(current, key, context) !== void 0;
16086
16125
  }
16087
16126
  current = getSandboxPrototype(current, context.budget);
@@ -16294,6 +16333,7 @@ function getMemberValue(target, property, context) {
16294
16333
  return void 0;
16295
16334
  }
16296
16335
  function getArrayMemberValue(target, property, context) {
16336
+ if (hasExplicitSandboxPrototype(target)) return void 0;
16297
16337
  if (property === "raw" && taggedTemplateRawArrays.has(target)) {
16298
16338
  return taggedTemplateRawArrays.get(target);
16299
16339
  }
@@ -35933,4 +35973,4 @@ export {
35933
35973
  FileSnapshotBackend,
35934
35974
  run
35935
35975
  };
35936
- //# sourceMappingURL=chunk-LVK2NO45.js.map
35976
+ //# sourceMappingURL=chunk-6QBK7Y47.js.map