Module: Arachni::Framework::Parts::Browser
- Included in:
- Arachni::Framework
- Defined in:
- lib/arachni/framework/parts/browser.rb
Overview
Provides access to the BrowserCluster and relevant helpers.
Instance Method Summary collapse
-
#browser_cluster ⇒ BrowserCluster?
A lazy-loaded browser cluster or `nil` if OptionGroups::BrowserCluster#pool_size or OptionGroups::Scope#dom_depth_limit are 0 or not #host_has_browser?.
- #browser_cluster_job_skip_states ⇒ Object
-
#host_has_browser? ⇒ Bool
`true` if the environment has a browser, `false` otherwise.
- #use_browsers? ⇒ Boolean
- #wait_for_browser_cluster? ⇒ Boolean
Instance Method Details
#browser_cluster ⇒ BrowserCluster?
Returns A lazy-loaded browser cluster or `nil` if OptionGroups::BrowserCluster#pool_size or OptionGroups::Scope#dom_depth_limit are 0 or not #host_has_browser?.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/arachni/framework/parts/browser.rb', line 23 def browser_cluster return if !use_browsers? # Initialization may take a while so since we lazy load this make sure # that only one thread gets to this code at a time. synchronize do if !@browser_cluster state. :browser_cluster_startup end @browser_cluster ||= BrowserCluster.new( on_pop: proc do next if !pause? print_debug 'Blocking browser cluster on pop.' wait_if_paused end ) state. @browser_cluster end end |
#browser_cluster_job_skip_states ⇒ Object
58 59 60 61 |
# File 'lib/arachni/framework/parts/browser.rb', line 58 def browser_cluster_job_skip_states return if !@browser_cluster browser_cluster.skip_states( browser_job.id ) end |
#host_has_browser? ⇒ Bool
Returns `true` if the environment has a browser, `false` otherwise.
49 50 51 |
# File 'lib/arachni/framework/parts/browser.rb', line 49 def host_has_browser? Arachni::Browser.has_executable? end |
#use_browsers? ⇒ Boolean
63 64 65 66 |
# File 'lib/arachni/framework/parts/browser.rb', line 63 def use_browsers? .browser_cluster.pool_size > 0 && .scope.dom_depth_limit > 0 && host_has_browser? end |
#wait_for_browser_cluster? ⇒ Boolean
53 54 55 |
# File 'lib/arachni/framework/parts/browser.rb', line 53 def wait_for_browser_cluster? @browser_cluster && !browser_cluster.done? end |