@@ -17,6 +17,7 @@ def initialize(*args)
1717 @frame_stack = [ ]
1818 @accept_modal = [ ]
1919 @modal_messages = [ ]
20+ @modal_response = nil
2021 super
2122 end
2223
@@ -130,35 +131,13 @@ def title
130131
131132 private
132133
133- # rubocop:disable Metrics/CyclomaticComplexity
134- # rubocop:disable Metrics/PerceivedComplexity
135- # rubocop:disable Style/GuardClause
136134 def prepare_page
137135 super
138136
139- network . intercept if !Array ( @browser . url_whitelist ) . empty? ||
140- !Array ( @browser . url_blacklist ) . empty?
141-
142- on ( :request ) do |request , index , total |
143- if @browser . url_blacklist && !@browser . url_blacklist . empty?
144- if @browser . url_blacklist . any? { |r | request . match? ( r ) }
145- request . abort and next
146- else
147- request . continue and next
148- end
149- elsif @browser . url_whitelist && !@browser . url_whitelist . empty?
150- if @browser . url_whitelist . any? { |r | request . match? ( r ) }
151- request . continue and next
152- else
153- request . abort and next
154- end
155- elsif index + 1 < total
156- # There are other callbacks that may handle this request
157- next
158- else
159- # If there are no callbacks then just continue
160- request . continue
161- end
137+ if @browser . url_blacklist . any?
138+ network . blacklist = @browser . url_blacklist
139+ elsif @browser . url_whitelist . any?
140+ network . whitelist = @browser . url_whitelist
162141 end
163142
164143 on ( "Page.javascriptDialogOpening" ) do |params |
@@ -181,9 +160,6 @@ def prepare_page
181160 command ( "Page.handleJavaScriptDialog" , **options )
182161 end
183162 end
184- # rubocop:enable Metrics/CyclomaticComplexity
185- # rubocop:enable Metrics/PerceivedComplexity
186- # rubocop:enable Style/GuardClause
187163
188164 def find_position ( node , **options )
189165 node . find_position ( **options )
0 commit comments