sqreen 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db75e03bbaf0ff955d869f7e5fea1dd06d911ef363fe85b875befbabc147c948
4
- data.tar.gz: 118223689c18fa3627f901b857c67c0309d6f17a5b4eeffdf631da37d801bebf
3
+ metadata.gz: 04735d805b8ea864d96c46e800a897b8a9721189f0ba85aed0d5d299cb6e7907
4
+ data.tar.gz: 283e87804132bdbeac132989113bd352f71b0e359a55dbffdb577748466ab5b2
5
5
  SHA512:
6
- metadata.gz: cba1b32cb6753e60442e7f17a3b4e8267f978e37552303dec79cb92e429958b3815d9f7c18bda5dd72b4db7bca923ab6e6cafb062fb1194b952bfee977585c7a
7
- data.tar.gz: 6c73b78873835a36ba2b69ef8ac01b06927b138622a9c082690fa45d65c06d5a65f5234da28d6b9928850d107d269428742406b1cd05534ee1bdcec742773d35
6
+ metadata.gz: 409bea4a589bf468b0a1d28024137d9ff19c2a7b2a967b7a7e8c21f963ab71085085b7cdacb1eecdc84303d4774a7b89ce0476dd9b2dfdc36349127c16f4ccbb
7
+ data.tar.gz: e9c396aa040c4c57760e8a27c9ea5caa168da52c4a21c134d565696f801f3c63be4dbbe0888b8cf7ae911f3cb839083dcb85f033d6876a3eb1e3b7f56ee6db0d
@@ -14,6 +14,7 @@ else
14
14
  end
15
15
  end
16
16
 
17
+ require 'weakref'
17
18
  require 'execjs'
18
19
 
19
20
  require 'sqreen/rule_attributes'
@@ -41,6 +42,8 @@ module Sqreen
41
42
  build_runnable(callbacks)
42
43
  if !SQREEN_V8_THREAD
43
44
  @compiled = ExecJS.compile(@source)
45
+ else
46
+ @runtimes = []
44
47
  end
45
48
  @restrict_max_depth = 20
46
49
  end
@@ -144,7 +147,11 @@ module Sqreen
144
147
 
145
148
  def call_callback(name, inst, args, rv = nil)
146
149
  if SQREEN_V8_THREAD
147
- Thread.current["SQREEN_EXECJS_SOURCE#{self.object_id}"] ||= ExecJS.compile(@source)
150
+ if Thread.current["SQREEN_EXECJS_SOURCE#{self.object_id}"].nil? || !Thread.current["SQREEN_EXECJS_SOURCE#{self.object_id}"].weakref_alive?
151
+ runtime = ExecJS.compile(@source)
152
+ @runtimes.push runtime
153
+ Thread.current["SQREEN_EXECJS_SOURCE#{self.object_id}"] = WeakRef.new(runtime)
154
+ end
148
155
  end
149
156
  ret = nil
150
157
  args_override = nil
@@ -169,7 +169,7 @@ module Sqreen
169
169
  Sqreen.log.debug do
170
170
  format('rules: %s', rules.
171
171
  sort_by { |r| r['name'] }.
172
- map { |r| format('(%s, %s)', r['name'], r.to_json.size) }.
172
+ map { |r| format('(%s, %s, %s)', r[Rules::Attrs::NAME], r.to_json.size, r[Rules::Attrs::BLOCK]) }.
173
173
  join(', '))
174
174
  end
175
175
  [rulespack_id, rules]
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  module Sqreen
4
- VERSION = '1.10.0'.freeze
4
+ VERSION = '1.10.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sqreen