mini_racer-csim 0.21.1.3 → 0.21.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0e53581dc8063ed19c418dfc9ea450a7fc027adf5ea7732b32fb5dbabd6b0c7
4
- data.tar.gz: 100100878b0966db7d6b0d8a38723993ac33eff9252bd6c48adccfcec65bf92c
3
+ metadata.gz: 4a64c6a3cd59b38b736212c4ef9685cbc7c6bc9e56d0aee12734e957e749fb7c
4
+ data.tar.gz: 50e7e8a671b90f3bf2e6563092f31ed00edf7d2c8093eb52eccbe502635773ca
5
5
  SHA512:
6
- metadata.gz: c9a3e14d28a170e7d60201c490e0c695c92684e88f77935c733812206cd7a158d07cd96b76cb0bbfdc9a2f9804c3add1a33d189c47ef2b304873980448ce3ab2
7
- data.tar.gz: c74e8ae6b9acac62be7a1099e7464564f08ac3e485f4e2f992b879d27d91c636d412c17506e0e972646e69780cc81dfd70e3de3bdbf961b4c1e3bcf19c808e84
6
+ metadata.gz: 53cb234c4dca6643756f5f0558080dade542569bf64aef713e0f44477e05d2c7e14bc305f63671519d67131a63f35dcee65829893dd493011b5f2764552677bd
7
+ data.tar.gz: ee5e61767e56179bf2aec29c54ca81d0f3c6b3ad7d1788498bb45b84ee5f7d3b6dcb613cc5f297dbdcb4eae32f4005b594a6a7a562d51c9d1904b646537976cb
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ - 0.21.1.4 - 08-06-2026
2
+ - Memoize the safe-context reply filter (the recursive deep-copy fallback used when a reply value is not cloneable by V8's ValueSerializer — e.g. it contains a function or a host object). A visited-set (original → filtered copy) makes shared subgraphs clone once instead of being re-walked per reference path (O(N) instead of super-linear), terminates cycles (previously a cyclic value containing a non-cloneable member recursed forever), and preserves object identity — matching the ValueSerializer fast path it backs
3
+
1
4
  - 0.21.1.3 - 08-06-2026
2
5
  - **Breaking (realm JS API):** move the per-frame-realm JS helpers off bare `globalThis` globals onto the opt-in host namespace, so globalThis pollution is decided once (by `host_namespace:`) rather than per feature
3
6
  - `__mr_realmGlobal(id)` → `<host_namespace>.realmGlobal(id)`
@@ -23,44 +23,61 @@ static const char safe_context_script_source[] = R"js(
23
23
  ;(function($globalThis) {
24
24
  const {Map: $Map, Set: $Set} = $globalThis
25
25
  const sentinel = {}
26
- return function filter(v) {
27
- if (typeof v === "function")
28
- return sentinel
29
- if (typeof v !== "object" || v === null)
30
- return v
31
- if (v instanceof $Map) {
32
- const m = new Map()
33
- for (let [k, t] of Map.prototype.entries.call(v)) {
34
- t = filter(t)
35
- if (t !== sentinel)
36
- m.set(k, t)
37
- }
38
- return m
39
- } else if (v instanceof $Set) {
40
- const s = new Set()
41
- for (let t of Set.prototype.values.call(v)) {
42
- t = filter(t)
43
- if (t !== sentinel)
44
- s.add(t)
45
- }
46
- return s
47
- } else {
48
- const o = Array.isArray(v) ? [] : {}
49
- const pds = Object.getOwnPropertyDescriptors(v)
50
- for (const [k, d] of Object.entries(pds)) {
51
- if (!d.enumerable)
52
- continue
53
- let t = d.value
54
- if (d.get) {
55
- // *not* d.get.call(...), may have been tampered with
56
- t = Function.prototype.call.call(d.get, v, k)
26
+ return function filter(root) {
27
+ // Memoize original -> filtered copy. Registered BEFORE recursing into a
28
+ // value's children so that a value reachable by many paths is cloned
29
+ // once (linear, not super-linear: e.g. a DOM node's ownerDocument is
30
+ // reachable from every node), cycles terminate (the in-progress copy is
31
+ // returned), and object identity is preserved. This matches V8's
32
+ // ValueSerializer (the fast path this is the fallback for), whose ref
33
+ // table also dedupes and handles cycles; without it the slow path both
34
+ // diverges (duplicates shared objects) and can recurse forever on a
35
+ // cyclic value that happens to contain a non-cloneable member.
36
+ const seen = new Map()
37
+ return (function rec(v) {
38
+ if (typeof v === "function")
39
+ return sentinel
40
+ if (typeof v !== "object" || v === null)
41
+ return v
42
+ if (seen.has(v))
43
+ return seen.get(v)
44
+ if (v instanceof $Map) {
45
+ const m = new Map()
46
+ seen.set(v, m)
47
+ for (let [k, t] of Map.prototype.entries.call(v)) {
48
+ t = rec(t)
49
+ if (t !== sentinel)
50
+ m.set(k, t)
51
+ }
52
+ return m
53
+ } else if (v instanceof $Set) {
54
+ const s = new Set()
55
+ seen.set(v, s)
56
+ for (let t of Set.prototype.values.call(v)) {
57
+ t = rec(t)
58
+ if (t !== sentinel)
59
+ s.add(t)
57
60
  }
58
- t = filter(t)
59
- if (t !== sentinel)
60
- Object.defineProperty(o, k, {value: t, enumerable: true})
61
+ return s
62
+ } else {
63
+ const o = Array.isArray(v) ? [] : {}
64
+ seen.set(v, o)
65
+ const pds = Object.getOwnPropertyDescriptors(v)
66
+ for (const [k, d] of Object.entries(pds)) {
67
+ if (!d.enumerable)
68
+ continue
69
+ let t = d.value
70
+ if (d.get) {
71
+ // *not* d.get.call(...), may have been tampered with
72
+ t = Function.prototype.call.call(d.get, v, k)
73
+ }
74
+ t = rec(t)
75
+ if (t !== sentinel)
76
+ Object.defineProperty(o, k, {value: t, enumerable: true})
77
+ }
78
+ return o
61
79
  }
62
- return o
63
- }
80
+ })(root)
64
81
  }
65
82
  })
66
83
  )js";
@@ -4,6 +4,6 @@ module MiniRacerCsim
4
4
  # mini_racer-csim fork: upstream version + a fork revision segment.
5
5
  # 0.21.1.0 = first fork release on upstream 0.21.1; bump the 4th segment for
6
6
  # fork-only changes, reset it when rebasing onto a new upstream version.
7
- VERSION = "0.21.1.3"
7
+ VERSION = "0.21.1.4"
8
8
  LIBV8_NODE_VERSION = "~> 24.12.0.1"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_racer-csim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.1.3
4
+ version: 0.21.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima