axe-core-api 4.5.1.pre.343efa9 → 4.6.0.pre.47f4589
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/axe/api/context.rb +2 -2
- data/lib/axe/api/results.rb +1 -1
- data/lib/axe/api/run.rb +22 -4
- data/lib/axe/api/selector.rb +12 -0
- data/node_modules/axe-core/axe.min.js +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1ea65e2ff4b4f35654eec0460a23c3983746bd35c44b8aff3213b15785176bf
|
4
|
+
data.tar.gz: c038ded6ba91147bdce50e43cb0b04f1fcb5c7497626e8845e06b81dc8f2bc83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '00809dd34d03371139e9a72b76dfb2f03b38610ccb7ef71c69ded8d568b1fccfd28d5188631622c73cd804e2532baebe7dd2f2f1d1b669339cfbc1c23a6fa59b'
|
7
|
+
data.tar.gz: 75d56a04bfb8d27d8598c41f2a9e1db649f3435a0ccd195f724993c02a994898a696eeb76901a2d79d0acd957daa722989b39ca583bc49b052cb239e4777fe02
|
data/lib/axe/api/context.rb
CHANGED
@@ -9,11 +9,11 @@ module Axe
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def within(*selectors)
|
12
|
-
@inclusion.concat selectors.map { |s|
|
12
|
+
@inclusion.concat selectors.map { |s| Selector::normalize s }
|
13
13
|
end
|
14
14
|
|
15
15
|
def excluding(*selectors)
|
16
|
-
@exclusion.concat selectors.map { |s|
|
16
|
+
@exclusion.concat selectors.map { |s| Selector::normalize s }
|
17
17
|
end
|
18
18
|
|
19
19
|
def to_h
|
data/lib/axe/api/results.rb
CHANGED
data/lib/axe/api/run.rb
CHANGED
@@ -36,9 +36,19 @@ module Axe
|
|
36
36
|
partial_results = run_partial_recursive(page, @context, lib, true)
|
37
37
|
throw partial_results if partial_results.respond_to?("key?") and partial_results.key?("errorMessage")
|
38
38
|
results = within_about_blank_context(page) { |page|
|
39
|
+
partial_res_str = partial_results.to_json
|
40
|
+
size_limit = 20_000_000
|
41
|
+
while not partial_res_str.empty? do
|
42
|
+
chunk_size = size_limit
|
43
|
+
chunk_size = partial_res_str.length if chunk_size > partial_res_str.length
|
44
|
+
chunk = partial_res_str[0..chunk_size-1]
|
45
|
+
partial_res_str = partial_res_str[chunk_size..-1]
|
46
|
+
store_chunk page, chunk
|
47
|
+
end
|
48
|
+
|
39
49
|
Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib
|
40
50
|
begin
|
41
|
-
axe_finish_run page
|
51
|
+
axe_finish_run page
|
42
52
|
rescue
|
43
53
|
raise StandardError.new "axe.finishRun failed. Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
|
44
54
|
end
|
@@ -138,12 +148,20 @@ module Axe
|
|
138
148
|
return results
|
139
149
|
end
|
140
150
|
|
141
|
-
def
|
151
|
+
def store_chunk(page, chunk)
|
152
|
+
script = <<-JS
|
153
|
+
const chunk = arguments[0];
|
154
|
+
window.partialResults ??= '';
|
155
|
+
window.partialResults += chunk;
|
156
|
+
JS
|
157
|
+
page.execute_script_fixed script, chunk
|
158
|
+
end
|
159
|
+
def axe_finish_run(page)
|
142
160
|
script = <<-JS
|
143
|
-
const partialResults =
|
161
|
+
const partialResults = JSON.parse(window.partialResults || '[]');
|
144
162
|
return axe.finishRun(partialResults);
|
145
163
|
JS
|
146
|
-
page.execute_script_fixed script
|
164
|
+
page.execute_script_fixed script
|
147
165
|
end
|
148
166
|
|
149
167
|
def axe_shadow_select(page, frame_selector)
|
data/lib/axe/api/selector.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
module Axe
|
2
2
|
module API
|
3
3
|
class Selector
|
4
|
+
def self.normalize(s)
|
5
|
+
if s.is_a? Hash
|
6
|
+
if s.key? :iframe and s.key? :selector
|
7
|
+
Array(Selector.new s)
|
8
|
+
else
|
9
|
+
s
|
10
|
+
end
|
11
|
+
else
|
12
|
+
Array(Selector.new s)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
4
16
|
def initialize(s)
|
5
17
|
@selector = case s
|
6
18
|
when Array then s
|