axe-core-api 4.2.0.pre.edcd659 → 4.2.1.pre.ea3a33f

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: e3964599a863f53179b8b189e6fa60e4d220240fe362c7b3aa6263bb4686b366
4
- data.tar.gz: '0558215cb31d486cd8383118e63c0a1c29de40c4aabdbc5c29f8c791aa86037e'
3
+ metadata.gz: bb9b1c448ed1fc45e65334e4a6c7e7196625479760b6fc5360f3405bbe6827cc
4
+ data.tar.gz: ab52874de939adf105d7fa9404e97b2801a75991ba081d69e22399c1fea4cdd3
5
5
  SHA512:
6
- metadata.gz: 06de18b3a8137ca0f65cec3e9c9c72637854ce5339df2ce2569460bf9cb50c603e703631333204db45ff0b50266b7dcc27ed1812627cd9120d1906c1bf040993
7
- data.tar.gz: 47f7aeb22a09792f63b4be4f2429be0ef0f03a8c06aaed5e33cd94b80c9d25822841ca9c8d5bc0963e1e5d1c21b7c0ccf027e14bbcac7c0485aedd78656d5718
6
+ metadata.gz: 307884bb973a6f61e95109fd9e8fa210e2ec32cb403c331b206127d6e54dcc8e5ae77183193fb3566ebcfa2661954afad8be9e7fe102712041270dd17b9f09f2
7
+ data.tar.gz: d43691bb82528acca7420156103610e56f8852e5c7e22531bd8b7278bfaa3d8112858f3e4804d8070928557d173dc59aa708930a66fdf76b18e65b274a0c97a5
data/lib/axe/api/run.rb CHANGED
@@ -37,7 +37,11 @@ module Axe
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
39
  Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib
40
- axe_finish_run page, partial_results
40
+ begin
41
+ axe_finish_run page, partial_results
42
+ rescue
43
+ raise StandardError.new "axe.finishRun failed. Please check out https://github.com/dequelabs/axe-core-gems/error-handling.md`"
44
+ end
41
45
  }
42
46
  Audit.new to_js, Results.new(results)
43
47
  end
@@ -67,8 +71,16 @@ module Axe
67
71
  def within_about_blank_context(page)
68
72
  driver = get_selenium page
69
73
 
70
- driver.execute_script("window.open('about:blank'), '_blank'")
71
- driver.switch_to.window page.window_handles[-1]
74
+ num_handles = page.window_handles.length
75
+ begin
76
+ driver.execute_script("window.open('about:blank'), '_blank'")
77
+ if num_handles == page.window_handles.length
78
+ raise StandardError.new "Could not open new window. Please make sure that you have popup blockers disabled."
79
+ end
80
+ driver.switch_to.window page.window_handles[-1]
81
+ rescue
82
+ raise StandardError.new "switchToWindow failed. Are you using updated browser drivers?"
83
+ end
72
84
  driver.get "about:blank"
73
85
 
74
86
  ret = yield page
@@ -14,7 +14,8 @@ module Axe
14
14
  attr_writer :jslib
15
15
  attr_accessor :page,
16
16
  :jslib_path,
17
- :skip_iframes
17
+ :skip_iframes,
18
+ :legacy_mode
18
19
  def_delegators ::WebDriverScriptAdapter,
19
20
  :async_results_identifier,
20
21
  :async_results_identifier=,
data/lib/axe/core.rb CHANGED
@@ -14,20 +14,28 @@ module Axe
14
14
  end
15
15
 
16
16
  def call(callable)
17
- if has_run_partial?
17
+ if use_run_partial
18
18
  callable.analyze_post_43x @page, self
19
19
  else
20
20
  callable.call @page
21
21
  end
22
22
  end
23
23
 
24
+ def call_verbatim(callable)
25
+ callable.call @page
26
+ end
27
+
24
28
  private
25
29
 
30
+ def use_run_partial
31
+ has_run_partial? and not Axe::Configuration.instance.legacy_mode
32
+ end
33
+
26
34
  def load_axe_core(source)
27
35
  return if already_loaded?
28
36
  loader = Common::Loader.new(@page, self)
29
37
  loader.load_top_level source
30
- return if has_run_partial?
38
+ return if use_run_partial
31
39
 
32
40
  loader.call source
33
41
  end
data/lib/loader.rb CHANGED
@@ -17,13 +17,19 @@ module Common
17
17
 
18
18
  def call(source, is_top_level = true)
19
19
  @page.execute_script source unless (@loaded_top_level and is_top_level)
20
- @page.execute_script "axe.configure({ allowedOrigins: ['<unsafe_all_origins>'] });"
20
+ set_allowed_origins
21
21
  Common::Hooks.run_after_load @lib
22
22
  load_into_iframes(source) unless Axe::Configuration.instance.skip_iframes
23
23
  end
24
24
 
25
25
  private
26
26
 
27
+ def set_allowed_origins
28
+ allowed_origins = "<unsafe_all_origins>"
29
+ allowed_origins = "<same_origin>" if Axe::Configuration.instance.legacy_mode
30
+ @page.execute_script "axe.configure({ allowedOrigins: ['#{allowed_origins}'] });"
31
+ end
32
+
27
33
  def load_into_iframes(source)
28
34
  @page.find_frames.each do |iframe|
29
35
  @page.within_frame(iframe) { call source, false }
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.2.0.pre.edcd659
4
+ version: 4.2.1.pre.ea3a33f
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deque Systems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-02 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dumb_delegator
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: capybara
28
+ name: virtus
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,27 +39,27 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: selenium-webdriver
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
47
+ version: '2.1'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.1'
55
55
  - !ruby/object:Gem::Dependency
56
- name: watir
56
+ name: capybara
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- type: :runtime
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
@@ -67,13 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: virtus
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
- type: :runtime
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -81,21 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '2.1'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '2.1'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
98
+ name: rspec-its
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: selenium-webdriver
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec-its
126
+ name: watir
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="