axe-core-api 4.7.0.pre.0c19f86 → 4.7.0.pre.3fef592
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/run.rb +31 -48
- data/lib/axe/core.rb +0 -15
- data/node_modules/axe-core/axe.min.js +3 -3
- 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: 184e8889d0e0267b547d795658a4821956bc829cb304faf5172a99721f1afba3
|
4
|
+
data.tar.gz: 6a85bd09134d066b0c6401147bd9c0ec967aebbd16d1cf62036ad56ccf366d11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3a6c1d3e8e098df050224426c2d4a78349997af9cc62a6f835a898be026a3ece34d9fa9ce67f1886774b35e4e3e0d85e932460356af9fd5c9e516a8704fe2e
|
7
|
+
data.tar.gz: 0c907651e2dff7d014571deb724ac1c6bed6fcd0cb8398dae61f3a1c9a97dd71ae164af04295dec80313dfa05afa340a68cd76ca72c1eaf12c75efdb137f5259
|
data/lib/axe/api/run.rb
CHANGED
@@ -32,34 +32,27 @@ module Axe
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def analyze_post_43x(page, lib)
|
35
|
-
|
36
|
-
(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
raise StandardError.new "axe.finishRun failed. Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
|
57
|
-
end
|
58
|
-
|
59
|
-
}
|
60
|
-
ensure
|
61
|
-
(get_selenium page).manage.timeouts.page_load = user_page_load
|
62
|
-
end
|
35
|
+
@original_window = window_handle page
|
36
|
+
partial_results = run_partial_recursive(page, @context, lib, true)
|
37
|
+
throw partial_results if partial_results.respond_to?("key?") and partial_results.key?("errorMessage")
|
38
|
+
results = within_about_blank_context(page) { |page|
|
39
|
+
partial_res_str = partial_results.to_json
|
40
|
+
size_limit = 10_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
|
+
|
49
|
+
Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib
|
50
|
+
begin
|
51
|
+
axe_finish_run page
|
52
|
+
rescue
|
53
|
+
raise StandardError.new "axe.finishRun failed. Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
|
54
|
+
end
|
55
|
+
}
|
63
56
|
Audit.new to_js, Results.new(results)
|
64
57
|
end
|
65
58
|
|
@@ -115,15 +108,15 @@ module Axe
|
|
115
108
|
page.current_window_handle
|
116
109
|
end
|
117
110
|
|
118
|
-
def run_partial_recursive(page, context, lib, top_level = false
|
111
|
+
def run_partial_recursive(page, context, lib, top_level = false)
|
119
112
|
begin
|
120
|
-
current_window_handle = window_handle page
|
121
113
|
if not top_level
|
122
114
|
begin
|
123
115
|
Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib
|
124
116
|
rescue
|
125
117
|
return [nil]
|
126
118
|
end
|
119
|
+
|
127
120
|
end
|
128
121
|
|
129
122
|
frame_contexts = get_frame_context_script page
|
@@ -133,30 +126,20 @@ module Axe
|
|
133
126
|
end
|
134
127
|
|
135
128
|
res = axe_run_partial page, context
|
136
|
-
if res.
|
137
|
-
if top_level
|
138
|
-
throw res unless res.nil?
|
139
|
-
throw "axe.runPartial returned null"
|
140
|
-
end
|
129
|
+
if res.key?("errorMessage")
|
130
|
+
throw res if top_level
|
141
131
|
return [nil]
|
142
132
|
else
|
143
133
|
results = [res]
|
144
134
|
end
|
145
135
|
|
146
136
|
for frame_context in frame_contexts
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
results += res
|
154
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
155
|
-
page = get_selenium page
|
156
|
-
page.switch_to.window current_window_handle
|
157
|
-
frame_stack.each {|frame| page.switch_to.frame frame }
|
158
|
-
results.push nil
|
159
|
-
end
|
137
|
+
frame_selector = frame_context["frameSelector"]
|
138
|
+
frame_context = frame_context["frameContext"]
|
139
|
+
frame = axe_shadow_select page, frame_selector
|
140
|
+
switch_to_frame_by_handle page, frame
|
141
|
+
res = run_partial_recursive page, frame_context, lib
|
142
|
+
results += res
|
160
143
|
end
|
161
144
|
|
162
145
|
ensure
|
data/lib/axe/core.rb
CHANGED
@@ -3,7 +3,6 @@ require_relative "../webdriver_script_adapter/frame_adapter"
|
|
3
3
|
require_relative "../webdriver_script_adapter/query_selector_adapter"
|
4
4
|
require_relative "../loader"
|
5
5
|
require_relative "./configuration"
|
6
|
-
require 'timeout'
|
7
6
|
|
8
7
|
module Axe
|
9
8
|
class Core
|
@@ -38,22 +37,8 @@ module Axe
|
|
38
37
|
Core.has_run_partial?(@page) and not Axe::Configuration.instance.legacy_mode
|
39
38
|
end
|
40
39
|
|
41
|
-
def assert_frame_ready
|
42
|
-
begin
|
43
|
-
ready = Timeout.timeout(10) {
|
44
|
-
@page.evaluate_script <<-JS
|
45
|
-
document.readyState === 'complete'
|
46
|
-
JS
|
47
|
-
}
|
48
|
-
rescue Timeout::Error
|
49
|
-
ready = false
|
50
|
-
end
|
51
|
-
raise Exception.new "Page/frame not ready" if not ready
|
52
|
-
end
|
53
|
-
|
54
40
|
def load_axe_core(source)
|
55
41
|
return if already_loaded?
|
56
|
-
assert_frame_ready
|
57
42
|
loader = Common::Loader.new(@page, self)
|
58
43
|
loader.load_top_level source
|
59
44
|
return if use_run_partial
|