sqreen 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: 294bf474df4e1beb0533d87876a9b27e984d47ab332482aab2485fee862de414
|
4
|
+
data.tar.gz: 6a4b0f5c640371ad280c0412c5b3c58f73d921df69f767522659e5c90d4ee663
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb633499e38e67c6768ac77bbdedccd83710708abe7b2422bfb0f3e4f4a2797b532b35203c97fbdf445ea205fe5e63cb5a1613e4ea8237b74330111410065ddb
|
7
|
+
data.tar.gz: 8bf22330ac83b3c9133a96127f358e34f27fe3dd504985832fb8825a19cfcfbafa82a9a3db25284e4c460c76587a92923c331cac7a584c7e8e396e4145ff2070
|
@@ -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