sqreen 1.10.2-java → 1.10.3-java
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: c91d7e3b39f5bfa453736517993a2f82e09c517ca64d4193a854d31c590732ba
|
4
|
+
data.tar.gz: 9fdc5c95877b79971bd834555ef4e899ba14b9675a93dd20f812b088782b4654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeab43c7f9cdd3aab746f49ce1b35d5b9cc1cb09da7bafef45ce9ade183e0c4c576533ae9088308de8695006eeda5aabb5114b34f96922dda4f69d610d0446be
|
7
|
+
data.tar.gz: 4a894580f1ed880ecf7760483709ee811a3f86ff3fd2b9c7eea5392c45737c78bccb003b37c4ad72ec68394052485c78425557677e7e6c22fbea599e53690c4e
|
@@ -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