@poe-platform/safe-js 0.1.394 → 0.1.395

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.
@@ -8165,6 +8165,12 @@ var guestClosures = /* @__PURE__ */ new WeakSet();
8165
8165
  var functionProperties = /* @__PURE__ */ new WeakMap();
8166
8166
  var functionPropertyRevisions = /* @__PURE__ */ new WeakMap();
8167
8167
  var prototypes = /* @__PURE__ */ new WeakMap();
8168
+ var trackedPrototypes = /* @__PURE__ */ new WeakMap();
8169
+ function storePrototype(value, prototype) {
8170
+ prototypes.set(value, prototype);
8171
+ const tracked = trackedPrototypes.get(value);
8172
+ if (tracked !== void 0) tracked.current = prototype;
8173
+ }
8168
8174
  var intrinsicPrototypes = /* @__PURE__ */ new WeakMap();
8169
8175
  var boxedPrototypes = /* @__PURE__ */ new WeakMap();
8170
8176
  var regexPrototypes = /* @__PURE__ */ new WeakMap();
@@ -8249,7 +8255,7 @@ function getGuestFunctionProperty(closure, key) {
8249
8255
  return properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, key)?.value;
8250
8256
  }
8251
8257
  function installObjectPrototype(budget, prototype, constructor) {
8252
- prototypes.set(prototype, null);
8258
+ storePrototype(prototype, null);
8253
8259
  intrinsicPrototypes.set(budget, prototype);
8254
8260
  registerIntrinsicPrototype(budget, prototype, constructor);
8255
8261
  }
@@ -8290,7 +8296,7 @@ function installDatePrototype(budget, prototype, constructor) {
8290
8296
  }
8291
8297
  function installArrayPrototype(budget, prototype, constructor) {
8292
8298
  arrayPrototypes.set(budget, prototype);
8293
- prototypes.set(prototype, intrinsicPrototypes.get(budget) ?? null);
8299
+ storePrototype(prototype, intrinsicPrototypes.get(budget) ?? null);
8294
8300
  initialArrayMethods.set(prototype, new Map(Object.entries(Object.getOwnPropertyDescriptors(prototype)).map(([key, descriptor]) => [key, descriptor.value])));
8295
8301
  registerIntrinsicPrototype(budget, prototype, constructor);
8296
8302
  }
@@ -8338,12 +8344,20 @@ function trackIntrinsicState(budget, root, owner, targets) {
8338
8344
  let roots = intrinsicPrototypeRoots.get(budget);
8339
8345
  if (roots === void 0) intrinsicPrototypeRoots.set(budget, roots = /* @__PURE__ */ new Set());
8340
8346
  roots.add(root);
8341
- const records = [...new Set(targets)].map((target) => ({
8342
- target,
8343
- value: isGuestClosure(target) ? materializeFunctionProperties(target) : target,
8344
- prototype: getSandboxPrototype(target),
8345
- explicit: hasExplicitSandboxPrototype(target)
8346
- })).map((record4) => ({
8347
+ const records = [...new Set(targets)].map((target) => {
8348
+ let tracked = trackedPrototypes.get(target);
8349
+ if (tracked === void 0) {
8350
+ tracked = { current: getSandboxPrototype(target) };
8351
+ trackedPrototypes.set(target, tracked);
8352
+ }
8353
+ return {
8354
+ target,
8355
+ value: isGuestClosure(target) ? materializeFunctionProperties(target) : target,
8356
+ prototype: tracked.current,
8357
+ tracked,
8358
+ explicit: hasExplicitSandboxPrototype(target)
8359
+ };
8360
+ }).map((record4) => ({
8347
8361
  ...record4,
8348
8362
  revision: functionPropertyRevisions.get(record4.value),
8349
8363
  capturedRevision: -1,
@@ -8364,8 +8378,8 @@ function trackIntrinsicState(budget, root, owner, targets) {
8364
8378
  budget.setRetainedValues(root, () => {
8365
8379
  const retained = [];
8366
8380
  for (const record4 of records) {
8367
- const { target, value, descriptors: descriptors2, prototype: parent, revision } = record4;
8368
- const currentPrototype = getSandboxPrototype(target);
8381
+ const { value, descriptors: descriptors2, prototype: parent, revision } = record4;
8382
+ const currentPrototype = record4.tracked.current;
8369
8383
  if (currentPrototype !== parent) retained.push(currentPrototype);
8370
8384
  if (revision === void 0 || revision.revision !== record4.capturedRevision) {
8371
8385
  const captured = [];
@@ -8503,7 +8517,7 @@ function setSandboxPrototype(value, prototype, budget, throwOnFailure = true) {
8503
8517
  );
8504
8518
  }
8505
8519
  if (getSandboxPrototype(value, budget) === prototype) {
8506
- if (prototype === null) prototypes.set(value, null);
8520
+ if (prototype === null) storePrototype(value, null);
8507
8521
  return true;
8508
8522
  }
8509
8523
  if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
@@ -8519,7 +8533,7 @@ function setSandboxPrototype(value, prototype, budget, throwOnFailure = true) {
8519
8533
  throw new TypeError("Cyclic prototype value.");
8520
8534
  }
8521
8535
  }
8522
- prototypes.set(value, prototype);
8536
+ storePrototype(value, prototype);
8523
8537
  return true;
8524
8538
  }
8525
8539
  function isPrototypeRecord(value) {
@@ -45001,4 +45015,4 @@ export {
45001
45015
  FileSnapshotBackend,
45002
45016
  run
45003
45017
  };
45004
- //# sourceMappingURL=chunk-XVBBWKP2.js.map
45018
+ //# sourceMappingURL=chunk-7V4MG4KI.js.map