axe-core-api 4.2.0.pre.6beb600 → 4.2.0.pre.33afee3

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: 93fdbc2f4d06b670e6a36caa7489196b44f3b2a09e939ec16b541ae7c45c47d9
4
- data.tar.gz: 7dcc16ad9bd768830d7a5a227ba72af18e7ec67d0612397cd8cd391547049c0d
3
+ metadata.gz: f912af3af630db04fffaf7bf951e439d8d50b302446cb531928a453d317f55c5
4
+ data.tar.gz: c144064037bd09230de05f6a25c55846dc92742ad126be45d6023db8b2298406
5
5
  SHA512:
6
- metadata.gz: e359e128c431a0345906f64bdf29444f35f5128cb67c728cf4af58bbbe55e88b6d600b4766800e886e16d225f6746f3e0c31f911e9fd21e895f9de740356e13b
7
- data.tar.gz: daa3fcd4f2c12b81e560e19771151ae3010977153f74423b31b16e5567dac224ce89825ed53da5556ea56bf5991a8db4120f144a333e983b29870ba6ea4fd6d9
6
+ metadata.gz: 330231cec5eb39c3dbdb18acc05a69d0c19051da826a2753f51364d120445731113eb8fabb3af801294817a6b536ee28083a2086b0f13e1df28490404e39ba82
7
+ data.tar.gz: b84595ee0edd9b02e241248eb47c429d4ae5ae651961f20e08454d79bca303c58042520a2993c1fa124d3ca43e4c096efc5394d1d8d8f5ebe10d2d0c37a280cd
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,7 +14,7 @@ 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
@@ -27,11 +27,15 @@ module Axe
27
27
 
28
28
  private
29
29
 
30
+ def use_run_partial
31
+ has_run_partial? and not Axe::Configuration.instance.legacy_mode
32
+ end
33
+
30
34
  def load_axe_core(source)
31
35
  return if already_loaded?
32
36
  loader = Common::Loader.new(@page, self)
33
37
  loader.load_top_level source
34
- return if has_run_partial?
38
+ return if use_run_partial
35
39
 
36
40
  loader.call source
37
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.6beb600
4
+ version: 4.2.0.pre.33afee3
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-07 00:00:00.000000000 Z
11
+ date: 2021-09-15 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
  - - ">="