@poe-platform/safe-js 0.1.472 → 0.1.474

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.
@@ -10321,21 +10321,19 @@ function createObjectGlobal(methods3, budget) {
10321
10321
  sandbox: true,
10322
10322
  name: "hasOwnProperty",
10323
10323
  length: 1,
10324
- call: async ([key], context) => hasOwnSandboxProperty(
10325
- requireReceiver(context?.thisValue),
10326
- await toPropertyKey(key, budget, context),
10327
- false
10328
- )
10324
+ call: async ([key], context) => {
10325
+ const property = await toPropertyKey(key, budget, context);
10326
+ return hasOwnSandboxProperty(context?.thisValue, property, false);
10327
+ }
10329
10328
  }),
10330
10329
  propertyIsEnumerable: createSandboxClosure({
10331
10330
  sandbox: true,
10332
10331
  name: "propertyIsEnumerable",
10333
10332
  length: 1,
10334
- call: async ([key], context) => hasOwnSandboxProperty(
10335
- requireReceiver(context?.thisValue),
10336
- await toPropertyKey(key, budget, context),
10337
- true
10338
- )
10333
+ call: async ([key], context) => {
10334
+ const property = await toPropertyKey(key, budget, context);
10335
+ return hasOwnSandboxProperty(context?.thisValue, property, true);
10336
+ }
10339
10337
  }),
10340
10338
  isPrototypeOf: createSandboxClosure({
10341
10339
  sandbox: true,
@@ -10354,9 +10352,79 @@ function createObjectGlobal(methods3, budget) {
10354
10352
  }
10355
10353
  })
10356
10354
  };
10355
+ for (const [name, kind, define] of [
10356
+ ["__defineGetter__", "get", true],
10357
+ ["__defineSetter__", "set", true],
10358
+ ["__lookupGetter__", "get", false],
10359
+ ["__lookupSetter__", "set", false]
10360
+ ]) {
10361
+ prototypeMethods[name] = createSandboxClosure({
10362
+ guest: true,
10363
+ sandbox: true,
10364
+ name,
10365
+ length: define ? 2 : 1,
10366
+ call: async ([key, accessor], context) => {
10367
+ const target = construct([requireReceiver(context?.thisValue)]);
10368
+ const release = retainValues(budget, () => [target, key, accessor]);
10369
+ try {
10370
+ if (define && !isSandboxClosure(accessor)) throw new TypeError("Accessor must be callable.");
10371
+ const property = await toPropertyKey(key, budget, context);
10372
+ if (define) {
10373
+ await defineDataProperty(target, property, {
10374
+ [kind]: accessorAdapter(accessor, kind),
10375
+ enumerable: true,
10376
+ configurable: true
10377
+ }, budget, context);
10378
+ return void 0;
10379
+ }
10380
+ let current = target;
10381
+ let depth = 0;
10382
+ while (current !== null) {
10383
+ budget.visitNode();
10384
+ assertSandboxDataDepth(depth++);
10385
+ const descriptor = Object.getOwnPropertyDescriptor(objectProperties(current), property);
10386
+ if (descriptor !== void 0) return accessorClosure(descriptor[kind]);
10387
+ current = getSandboxPrototype(current, budget);
10388
+ }
10389
+ return void 0;
10390
+ } finally {
10391
+ release();
10392
+ }
10393
+ }
10394
+ });
10395
+ }
10357
10396
  for (const [name, method] of Object.entries(prototypeMethods)) {
10358
10397
  Object.defineProperty(prototype, name, { value: method, writable: true, configurable: true });
10359
10398
  }
10399
+ Object.defineProperty(prototype, "__proto__", {
10400
+ configurable: true,
10401
+ get: accessorAdapter(createSandboxClosure({
10402
+ guest: true,
10403
+ sandbox: true,
10404
+ name: "get __proto__",
10405
+ length: 0,
10406
+ call: (_args, context) => {
10407
+ const target = construct([requireReceiver(context?.thisValue)]);
10408
+ objectProperties(target);
10409
+ return getSandboxPrototype(target, budget);
10410
+ }
10411
+ }), "get"),
10412
+ set: accessorAdapter(createSandboxClosure({
10413
+ guest: true,
10414
+ sandbox: true,
10415
+ name: "set __proto__",
10416
+ length: 1,
10417
+ call: ([parent], context) => {
10418
+ const target = requireReceiver(context?.thisValue);
10419
+ if (parent !== null && typeof parent !== "object") return void 0;
10420
+ if (typeof target !== "object") return void 0;
10421
+ objectProperties(target, true);
10422
+ if (parent !== null) objectProperties(parent);
10423
+ setSandboxPrototype(target, parent, budget);
10424
+ return void 0;
10425
+ }
10426
+ }), "set")
10427
+ });
10360
10428
  markDescriptorObject(prototype);
10361
10429
  installObjectPrototype(budget, prototype, constructor);
10362
10430
  return constructor;
@@ -57075,4 +57143,4 @@ authorization of the copyright holder.
57075
57143
  SPDX-License-Identifier: Unicode-3.0
57076
57144
 
57077
57145
  */
57078
- //# sourceMappingURL=chunk-VDY62X4N.js.map
57146
+ //# sourceMappingURL=chunk-CGSXGKIZ.js.map