Class: Browserctl::PageSession
- Inherits:
-
Object
- Object
- Browserctl::PageSession
- Defined in:
- lib/browserctl/server/page_session.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#fingerprint_index ⇒ Object
Returns the value of attribute fingerprint_index.
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
-
#pause_cv ⇒ Object
readonly
Returns the value of attribute pause_cv.
-
#prev_snapshot ⇒ Object
Returns the value of attribute prev_snapshot.
-
#ref_registry ⇒ Object
Returns the value of attribute ref_registry.
-
#snapshot_id ⇒ Object
Returns the value of attribute snapshot_id.
Instance Method Summary collapse
-
#initialize(page_or_driver) ⇒ PageSession
constructor
A new instance of PageSession.
-
#page ⇒ Object
Back-compat accessor.
- #pause! ⇒ Object
- #paused? ⇒ Boolean
- #resume! ⇒ Object
Constructor Details
#initialize(page_or_driver) ⇒ PageSession
Returns a new instance of PageSession.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/browserctl/server/page_session.rb', line 14 def initialize(page_or_driver) @driver = if page_or_driver.is_a?(Browserctl::Driver::PageDriver) page_or_driver else Browserctl::Driver::FerrumPageDriver.new(page_or_driver) end @mutex = Mutex.new @pause_cv = ConditionVariable.new @ref_registry = {} @fingerprint_index = {} @snapshot_id = nil @prev_snapshot = nil @paused = false end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
7 8 9 |
# File 'lib/browserctl/server/page_session.rb', line 7 def driver @driver end |
#fingerprint_index ⇒ Object
Returns the value of attribute fingerprint_index.
8 9 10 |
# File 'lib/browserctl/server/page_session.rb', line 8 def fingerprint_index @fingerprint_index end |
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
7 8 9 |
# File 'lib/browserctl/server/page_session.rb', line 7 def mutex @mutex end |
#pause_cv ⇒ Object (readonly)
Returns the value of attribute pause_cv.
7 8 9 |
# File 'lib/browserctl/server/page_session.rb', line 7 def pause_cv @pause_cv end |
#prev_snapshot ⇒ Object
Returns the value of attribute prev_snapshot.
8 9 10 |
# File 'lib/browserctl/server/page_session.rb', line 8 def prev_snapshot @prev_snapshot end |
#ref_registry ⇒ Object
Returns the value of attribute ref_registry.
8 9 10 |
# File 'lib/browserctl/server/page_session.rb', line 8 def ref_registry @ref_registry end |
#snapshot_id ⇒ Object
Returns the value of attribute snapshot_id.
8 9 10 |
# File 'lib/browserctl/server/page_session.rb', line 8 def snapshot_id @snapshot_id end |
Instance Method Details
#page ⇒ Object
Back-compat accessor. New handler code calls #driver directly; this returns the underlying Ferrum/CDP page for legacy callers (the CDP driver’s ‘devtools_info`, the page-lifecycle close path, and a unit spec).
33 34 35 |
# File 'lib/browserctl/server/page_session.rb', line 33 def page @driver.respond_to?(:raw_page) ? @driver.raw_page : @driver end |
#pause! ⇒ Object
38 |
# File 'lib/browserctl/server/page_session.rb', line 38 def pause! = (@paused = true) |
#paused? ⇒ Boolean
37 |
# File 'lib/browserctl/server/page_session.rb', line 37 def paused? = @paused |
#resume! ⇒ Object
39 |
# File 'lib/browserctl/server/page_session.rb', line 39 def resume! = (@paused = false) |