axe-core-api 4.7.0.pre.0345aa9 → 4.7.0
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
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 175a4db67c7f727a73321be7d3e31e7dbf7002b1ebe134a21b072a0b2c14fd27
|
4
|
+
data.tar.gz: 8678aa9c23634486b2c02fb91537b21e60610b84e45672d881bc3db1d5bc4402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d244ea40f73c3fab3cab9d6919b2017c7f7a4c6a934737ce5c2f89a48a5c5bb31c408a769418b2f39bd2a40824727f9d3c2b9a8e9e02f9992e642ff9b0b04a7a
|
7
|
+
data.tar.gz: c4695b7c8f54e16a55cd22f792bd55dbfab3422277e5ce8a3a836deea67c7240ad9a31dd118cd496e7c098bfaee430534b68e7123c27e4c74c623c142c5ff44a
|
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 = 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
|
+
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axe-core-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.7.0
|
4
|
+
version: 4.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deque Systems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dumb_delegator
|
@@ -189,9 +189,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: 2.3.0
|
190
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- - "
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: '0'
|
195
195
|
requirements: []
|
196
196
|
rubygems_version: 3.2.32
|
197
197
|
signing_key:
|