@poe-platform/safe-js 0.1.167 → 0.1.169

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.
@@ -10249,9 +10249,8 @@ function getStringMember(value, property, budget) {
10249
10249
  const retainedReceiver = {};
10250
10250
  budget.setRetainedValues(retainedReceiver, () => [receiver]);
10251
10251
  try {
10252
- const string = await sandboxString(receiver, budget, context);
10253
10252
  return await callStringMethod(
10254
- string,
10253
+ receiver,
10255
10254
  property,
10256
10255
  args,
10257
10256
  budget,
@@ -10278,6 +10277,20 @@ function isStringMethodName(property) {
10278
10277
  function validateStringMethodArguments(_methodName, _args) {
10279
10278
  }
10280
10279
  function callStringMethod(value, methodName, args, budget, callClosure = async (closure, closureArgs) => await closure.call(closureArgs), parent, context) {
10280
+ if (value === null || value === void 0)
10281
+ throw new TypeError(`String#${methodName} requires a non-null receiver.`);
10282
+ const fallback = () => typeof value === "string" ? callStringMethodBody(value, methodName, args, budget, callClosure, parent, context) : Promise.resolve(sandboxString(value, budget, context)).then((string) => callStringMethodBody(string, methodName, args, budget, callClosure, parent, context));
10283
+ const symbol = methodName === "match" ? Symbol.match : methodName === "search" ? Symbol.search : methodName === "split" ? Symbol.split : void 0;
10284
+ const pattern = args[0];
10285
+ if (symbol === void 0 || pattern === null || pattern === void 0) return fallback();
10286
+ const applyHook = (hook) => {
10287
+ if (hook === null || hook === void 0) return fallback();
10288
+ if (!isSandboxClosure(hook)) throw new TypeError(`String#${methodName} symbol hook must be callable.`);
10289
+ return invokeBuiltinClosure(hook, methodName === "split" ? [value, args[1]] : [value], budget, context, pattern);
10290
+ };
10291
+ return context?.getProperty !== void 0 ? Promise.resolve(context.getProperty(pattern, symbol)).then(applyHook) : applyHook(getSandboxDataProperty(pattern, symbol, budget));
10292
+ }
10293
+ function callStringMethodBody(value, methodName, args, budget, callClosure = async (closure, closureArgs) => await closure.call(closureArgs), parent, context) {
10281
10294
  if (methodName === "concat" && args.some((argument) => argument !== null && typeof argument === "object")) {
10282
10295
  return callConcat(value, args, budget, context);
10283
10296
  }
@@ -10935,6 +10948,36 @@ function createObjectArrayGlobals(options) {
10935
10948
  },
10936
10949
  name: "fromEntries"
10937
10950
  }),
10951
+ preventExtensions: createSandboxClosure({
10952
+ sandbox: true,
10953
+ call: ([value]) => {
10954
+ if (isGuestHostObject(value))
10955
+ throw new TypeError("Live host objects cannot be made non-extensible.");
10956
+ Object.preventExtensions(isGuestClosure(value) ? materializeFunctionProperties(value) : value);
10957
+ return value;
10958
+ },
10959
+ name: "preventExtensions"
10960
+ }),
10961
+ isExtensible: createSandboxClosure({
10962
+ sandbox: true,
10963
+ call: ([value]) => Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : value),
10964
+ name: "isExtensible"
10965
+ }),
10966
+ seal: createSandboxClosure({
10967
+ sandbox: true,
10968
+ call: ([value]) => {
10969
+ if (isGuestHostObject(value))
10970
+ throw new TypeError("Live host objects cannot be sealed.");
10971
+ Object.seal(isGuestClosure(value) ? materializeFunctionProperties(value) : value);
10972
+ return value;
10973
+ },
10974
+ name: "seal"
10975
+ }),
10976
+ isSealed: createSandboxClosure({
10977
+ sandbox: true,
10978
+ call: ([value]) => Object.isSealed(isGuestClosure(value) ? materializeFunctionProperties(value) : value),
10979
+ name: "isSealed"
10980
+ }),
10938
10981
  freeze: createSandboxClosure({
10939
10982
  sandbox: true,
10940
10983
  call: ([value]) => {
@@ -11914,19 +11957,25 @@ async function callArrayMethodUnlocked(value, methodName, args, options, stack)
11914
11957
  options.budget.setRetainedValues(retained, () => [result]);
11915
11958
  try {
11916
11959
  for (const entry of [value, ...args]) {
11917
- if (!Array.isArray(entry)) {
11960
+ let spread = false;
11961
+ if (entry !== null && (typeof entry === "object" || typeof entry === "function")) {
11962
+ const flag = options.context?.getProperty !== void 0 ? await options.context.getProperty(entry, Symbol.isConcatSpreadable) : getSandboxDataProperty(entry, Symbol.isConcatSpreadable, options.budget);
11963
+ spread = flag === void 0 ? Array.isArray(entry) : Boolean(flag);
11964
+ }
11965
+ if (!spread) {
11918
11966
  options.budget.allocateArrayLength(result.length + 1);
11919
11967
  result.push(entry);
11920
11968
  continue;
11921
11969
  }
11922
11970
  const start = result.length;
11923
- const length = entry.length;
11971
+ const source = await arrayLikeView(entry, options);
11972
+ const length = source.length;
11924
11973
  options.budget.allocateArrayLength(start + length);
11925
11974
  result.length += length;
11926
11975
  for (let index = 0; index < length; index++) {
11927
11976
  options.budget.visitNode();
11928
- if (index in entry)
11929
- result[start + index] = await readArrayElement(entry, index, options);
11977
+ if (index in source)
11978
+ result[start + index] = await readArrayElement(source, index, options);
11930
11979
  }
11931
11980
  }
11932
11981
  return budgetProducedValue(result, options.budget);
@@ -35937,4 +35986,4 @@ export {
35937
35986
  FileSnapshotBackend,
35938
35987
  run
35939
35988
  };
35940
- //# sourceMappingURL=chunk-QQ2J2CDJ.js.map
35989
+ //# sourceMappingURL=chunk-6UY4Z7WY.js.map