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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/axe/api/run.rb +31 -48
  3. data/lib/axe/core.rb +0 -15
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca055add104549cb00f6fa62afa4a4c438dbf2c7a71b2915116616b81ebab54f
4
- data.tar.gz: b8dd8c03cb04fd012c9bce782a2ce0dc6961fee147da61233b3ce8277656b9d5
3
+ metadata.gz: 175a4db67c7f727a73321be7d3e31e7dbf7002b1ebe134a21b072a0b2c14fd27
4
+ data.tar.gz: 8678aa9c23634486b2c02fb91537b21e60610b84e45672d881bc3db1d5bc4402
5
5
  SHA512:
6
- metadata.gz: c5d9b65a3631fd420fc2057c03227bf9290e5a9b4d879e9c0a537035ed7bd450068d47db5acc400c0e7a05ed02a6eec833e972af195d08452ea7be58c0171618
7
- data.tar.gz: d9892067ef1b0c6b1538d33bd6402f7cac586be5ed300f6d9b40d066489095b8a6be1ae9843f06c6511b77a78c664eb1344d99647a7c587616a1815d9cdf5e13
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
- user_page_load = (get_selenium page).manage.timeouts.page_load
36
- (get_selenium page).manage.timeouts.page_load = 1
37
- begin
38
- @original_window = window_handle page
39
- partial_results = run_partial_recursive(page, @context, lib, true)
40
- throw partial_results if partial_results.respond_to?("key?") and partial_results.key?("errorMessage")
41
- results = within_about_blank_context(page) { |page|
42
- partial_res_str = partial_results.to_json
43
- size_limit = 10_000_000
44
- while not partial_res_str.empty? do
45
- chunk_size = size_limit
46
- chunk_size = partial_res_str.length if chunk_size > partial_res_str.length
47
- chunk = partial_res_str[0..chunk_size-1]
48
- partial_res_str = partial_res_str[chunk_size..-1]
49
- store_chunk page, chunk
50
- end
51
-
52
- Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib
53
- begin
54
- axe_finish_run page
55
- rescue
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, frame_stack = [])
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.nil? || res.key?("errorMessage")
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
- begin
148
- frame_selector = frame_context["frameSelector"]
149
- frame_context = frame_context["frameContext"]
150
- frame = axe_shadow_select page, frame_selector
151
- switch_to_frame_by_handle page, frame
152
- res = run_partial_recursive page, frame_context, lib, false, [*frame_stack, frame]
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.pre.0345aa9
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-09-07 00:00:00.000000000 Z
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: 1.3.1
194
+ version: '0'
195
195
  requirements: []
196
196
  rubygems_version: 3.2.32
197
197
  signing_key: