sqreen-alt 1.10.2 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sqreen/rules_callbacks/execjs.rb +25 -13
- data/lib/sqreen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a169f32476ad6277d799d9bd4d0863af3773a11ed06c333c730de94b2ac22ca
|
4
|
+
data.tar.gz: 45f88106b370b133a77a170d5a35aab1e256a1802f7e520464cc8743f15fe1d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc167b552a154fd6776b8ed4eab9084e6679812df4c0efef3dafa753d4af5b605dba73839773b35f08b95d291d82e71e3bc74ec33e58acb56baee480d2ccb845
|
7
|
+
data.tar.gz: df8d0458e197eb4fcebf909f0cf3ce3b7cd1067b45d14503b67f87c4f422e8c0b1692ab3e10b55278ffdffa828dbe04f2f12095f562e6bba9c831912895a6d4e
|
@@ -147,23 +147,35 @@ module Sqreen
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
+
def push_runtime(runtime)
|
151
|
+
@runtimes.delete_if do |th, _runt|
|
152
|
+
th.nil? || !th.weakref_alive? || !th.alive?
|
153
|
+
end
|
154
|
+
@runtimes.push [WeakRef.new(Thread.current), runtime, Thread.current.object_id]
|
155
|
+
end
|
156
|
+
|
157
|
+
def dispose_runtime(runtime)
|
158
|
+
@runtimes.delete_if { |_th, _runt, thid| thid == Thread.current.object_id }
|
159
|
+
runtime.dispose
|
160
|
+
end
|
161
|
+
|
150
162
|
def call_callback(name, inst, args, rv = nil)
|
151
163
|
if SQREEN_MINI_RACER
|
152
|
-
mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{
|
164
|
+
mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"]
|
153
165
|
if mini_racer_context.nil? || mini_racer_context[:r].nil? || !mini_racer_context[:r].weakref_alive?
|
154
|
-
|
155
|
-
|
156
|
-
Thread.current["SQREEN_MINI_RACER_CONTEXT_#{
|
166
|
+
new_runtime = MiniRacer::Context.new(:snapshot => @snapshot)
|
167
|
+
push_runtime new_runtime
|
168
|
+
Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"] = {
|
169
|
+
:c => 0,
|
170
|
+
:r => WeakRef.new(new_runtime),
|
171
|
+
}
|
157
172
|
elsif mini_racer_context[:c] >= GC_MINI_RACER
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
@runtimes.push new_runtime
|
163
|
-
|
164
|
-
Thread.current["SQREEN_MINI_RACER_CONTEXT_#{self.object_id}"] = {
|
173
|
+
dispose_runtime(mini_racer_context[:r])
|
174
|
+
new_runtime = MiniRacer::Context.new(:snapshot => @snapshot)
|
175
|
+
push_runtime new_runtime
|
176
|
+
Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"] = {
|
165
177
|
:c => 0,
|
166
|
-
:r => WeakRef.new(new_runtime)
|
178
|
+
:r => WeakRef.new(new_runtime),
|
167
179
|
}
|
168
180
|
end
|
169
181
|
end
|
@@ -177,7 +189,7 @@ module Sqreen
|
|
177
189
|
arguments = restrict(name, arguments) if @conditions.key?(name)
|
178
190
|
Sqreen.log.debug { [name, arguments].inspect }
|
179
191
|
if SQREEN_MINI_RACER
|
180
|
-
mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{
|
192
|
+
mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"]
|
181
193
|
mini_racer_context[:c] += 1
|
182
194
|
ret = mini_racer_context[:r].eval("#{name}.apply(this, #{::JSON.generate(arguments)})")
|
183
195
|
else
|
data/lib/sqreen/version.rb
CHANGED