@poe-platform/safe-js 0.1.168 → 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
  }
@@ -35973,4 +35986,4 @@ export {
35973
35986
  FileSnapshotBackend,
35974
35987
  run
35975
35988
  };
35976
- //# sourceMappingURL=chunk-6QBK7Y47.js.map
35989
+ //# sourceMappingURL=chunk-6UY4Z7WY.js.map