puppeteer-bidi 0.0.1.beta1 → 0.0.1.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CLAUDE.md +50 -4
- data/README.md +8 -1
- data/Steepfile +36 -0
- data/lib/puppeteer/bidi/async_utils.rb +1 -0
- data/lib/puppeteer/bidi/browser.rb +38 -24
- data/lib/puppeteer/bidi/browser_context.rb +13 -4
- data/lib/puppeteer/bidi/browser_launcher.rb +1 -0
- data/lib/puppeteer/bidi/connection.rb +26 -9
- data/lib/puppeteer/bidi/core/browser.rb +15 -14
- data/lib/puppeteer/bidi/core/browsing_context.rb +64 -46
- data/lib/puppeteer/bidi/core/disposable.rb +10 -3
- data/lib/puppeteer/bidi/core/errors.rb +18 -1
- data/lib/puppeteer/bidi/core/event_emitter.rb +18 -9
- data/lib/puppeteer/bidi/core/navigation.rb +4 -3
- data/lib/puppeteer/bidi/core/realm.rb +29 -26
- data/lib/puppeteer/bidi/core/request.rb +33 -29
- data/lib/puppeteer/bidi/core/session.rb +14 -11
- data/lib/puppeteer/bidi/core/user_context.rb +17 -16
- data/lib/puppeteer/bidi/core/user_prompt.rb +8 -7
- data/lib/puppeteer/bidi/core.rb +1 -0
- data/lib/puppeteer/bidi/deserializer.rb +1 -0
- data/lib/puppeteer/bidi/element_handle.rb +52 -52
- data/lib/puppeteer/bidi/errors.rb +1 -0
- data/lib/puppeteer/bidi/file_chooser.rb +1 -0
- data/lib/puppeteer/bidi/frame.rb +70 -70
- data/lib/puppeteer/bidi/http_response.rb +1 -0
- data/lib/puppeteer/bidi/injected_source.rb +1 -0
- data/lib/puppeteer/bidi/js_handle.rb +23 -23
- data/lib/puppeteer/bidi/keyboard.rb +24 -13
- data/lib/puppeteer/bidi/lazy_arg.rb +1 -0
- data/lib/puppeteer/bidi/mouse.rb +31 -18
- data/lib/puppeteer/bidi/page.rb +87 -87
- data/lib/puppeteer/bidi/query_handler.rb +3 -0
- data/lib/puppeteer/bidi/realm.rb +70 -6
- data/lib/puppeteer/bidi/serializer.rb +1 -0
- data/lib/puppeteer/bidi/target.rb +24 -0
- data/lib/puppeteer/bidi/task_manager.rb +9 -3
- data/lib/puppeteer/bidi/timeout_settings.rb +1 -0
- data/lib/puppeteer/bidi/transport.rb +1 -0
- data/lib/puppeteer/bidi/version.rb +1 -1
- data/lib/puppeteer/bidi/wait_task.rb +1 -0
- data/lib/puppeteer/bidi.rb +8 -4
- data/sig/_external.rbs +128 -0
- data/sig/_supplementary.rbs +20 -0
- data/sig/puppeteer/bidi/async_utils.rbs +68 -0
- data/sig/puppeteer/bidi/browser.rbs +35 -26
- data/sig/puppeteer/bidi/browser_context.rbs +39 -0
- data/sig/puppeteer/bidi/browser_launcher.rbs +45 -0
- data/sig/puppeteer/bidi/connection.rbs +67 -0
- data/sig/puppeteer/bidi/core/browser.rbs +79 -0
- data/sig/puppeteer/bidi/core/browsing_context.rbs +210 -0
- data/sig/puppeteer/bidi/core/disposable.rbs +42 -0
- data/sig/puppeteer/bidi/core/errors.rbs +65 -0
- data/sig/puppeteer/bidi/core/event_emitter.rbs +50 -0
- data/sig/puppeteer/bidi/core/navigation.rbs +37 -0
- data/sig/puppeteer/bidi/core/realm.rbs +132 -0
- data/sig/puppeteer/bidi/core/request.rbs +120 -0
- data/sig/puppeteer/bidi/core/session.rbs +65 -0
- data/sig/puppeteer/bidi/core/user_context.rbs +72 -0
- data/sig/puppeteer/bidi/core/user_prompt.rbs +52 -0
- data/sig/puppeteer/bidi/core.rbs +9 -0
- data/sig/puppeteer/bidi/deserializer.rbs +28 -0
- data/sig/puppeteer/bidi/element_handle.rbs +52 -52
- data/sig/puppeteer/bidi/errors.rbs +34 -0
- data/sig/puppeteer/bidi/file_chooser.rbs +27 -0
- data/sig/puppeteer/bidi/frame.rbs +70 -70
- data/sig/puppeteer/bidi/http_response.rbs +18 -0
- data/sig/puppeteer/bidi/injected_source.rbs +21 -0
- data/sig/puppeteer/bidi/js_handle.rbs +23 -23
- data/sig/puppeteer/bidi/keyboard.rbs +57 -0
- data/sig/puppeteer/bidi/lazy_arg.rbs +15 -0
- data/sig/puppeteer/bidi/mouse.rbs +73 -0
- data/sig/puppeteer/bidi/page.rbs +87 -87
- data/sig/puppeteer/bidi/query_handler.rbs +113 -0
- data/sig/puppeteer/bidi/realm.rbs +141 -0
- data/sig/puppeteer/bidi/serializer.rbs +31 -0
- data/sig/puppeteer/bidi/target.rbs +68 -0
- data/sig/puppeteer/bidi/task_manager.rbs +36 -0
- data/sig/puppeteer/bidi/timeout_settings.rbs +14 -0
- data/sig/puppeteer/bidi/transport.rbs +43 -0
- data/sig/puppeteer/bidi/wait_task.rbs +62 -0
- data/sig/puppeteer/bidi.rbs +8 -4
- metadata +36 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/browser.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Browser represents the browser instance in the core layer
|
|
7
|
+
# It manages user contexts and provides browser-level operations
|
|
8
|
+
class Browser < EventEmitter
|
|
9
|
+
include Disposable::DisposableMixin
|
|
10
|
+
|
|
11
|
+
# Create a browser instance from a session
|
|
12
|
+
# @rbs session: Session -- BiDi session
|
|
13
|
+
# @rbs return: Async::Task[Browser] -- Browser instance
|
|
14
|
+
def self.from: (Session session) -> Async::Task[Browser]
|
|
15
|
+
|
|
16
|
+
attr_reader session: untyped
|
|
17
|
+
|
|
18
|
+
def initialize: (untyped session) -> untyped
|
|
19
|
+
|
|
20
|
+
# Check if the browser is closed
|
|
21
|
+
def closed?: () -> untyped
|
|
22
|
+
|
|
23
|
+
# Check if the browser is disconnected
|
|
24
|
+
def disconnected?: () -> untyped
|
|
25
|
+
|
|
26
|
+
alias disposed? disconnected?
|
|
27
|
+
|
|
28
|
+
# Get the default user context
|
|
29
|
+
# @rbs return: UserContext? -- Default user context
|
|
30
|
+
def default_user_context: () -> UserContext?
|
|
31
|
+
|
|
32
|
+
# Get all user contexts
|
|
33
|
+
# @rbs return: Array[UserContext] -- All user contexts
|
|
34
|
+
def user_contexts: () -> Array[UserContext]
|
|
35
|
+
|
|
36
|
+
# Close the browser
|
|
37
|
+
# @rbs return: Async::Task[void]
|
|
38
|
+
def close: () -> Async::Task[void]
|
|
39
|
+
|
|
40
|
+
# Add a preload script to the browser
|
|
41
|
+
# @rbs function_declaration: String -- JavaScript function to preload
|
|
42
|
+
# @rbs **options: untyped -- Preload script options
|
|
43
|
+
# @rbs return: Async::Task[String] -- Script ID
|
|
44
|
+
def add_preload_script: (String function_declaration, **untyped options) -> Async::Task[String]
|
|
45
|
+
|
|
46
|
+
# Remove a preload script
|
|
47
|
+
# @rbs script: String -- Script ID
|
|
48
|
+
# @rbs return: Async::Task[untyped]
|
|
49
|
+
def remove_preload_script: (String script) -> Async::Task[untyped]
|
|
50
|
+
|
|
51
|
+
# Create a new user context
|
|
52
|
+
# @rbs **options: untyped -- User context options
|
|
53
|
+
# @rbs return: Async::Task[UserContext] -- New user context
|
|
54
|
+
def create_user_context: (**untyped options) -> Async::Task[UserContext]
|
|
55
|
+
|
|
56
|
+
# Remove a network intercept
|
|
57
|
+
# @rbs intercept: String -- Intercept ID
|
|
58
|
+
# @rbs return: Async::Task[untyped]
|
|
59
|
+
def remove_intercept: (String intercept) -> Async::Task[untyped]
|
|
60
|
+
|
|
61
|
+
def perform_dispose: () -> untyped
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def initialize_browser: () -> untyped
|
|
66
|
+
|
|
67
|
+
def sync_user_contexts: () -> untyped
|
|
68
|
+
|
|
69
|
+
def sync_browsing_contexts: () -> untyped
|
|
70
|
+
|
|
71
|
+
def process_contexts: (untyped contexts, untyped context_ids) -> untyped
|
|
72
|
+
|
|
73
|
+
def create_user_context_object: (untyped id) -> untyped
|
|
74
|
+
|
|
75
|
+
def dispose_browser: (untyped reason, ?closed: untyped) -> untyped
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/browsing_context.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# BrowsingContext represents a browsing context (tab, window, or iframe)
|
|
7
|
+
class BrowsingContext < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
# Create a browsing context
|
|
11
|
+
# @rbs user_context: UserContext -- Parent user context
|
|
12
|
+
# @rbs parent: BrowsingContext? -- Parent browsing context
|
|
13
|
+
# @rbs id: String -- Context ID
|
|
14
|
+
# @rbs url: String -- Initial URL
|
|
15
|
+
# @rbs original_opener: String? -- Original opener context ID
|
|
16
|
+
# @rbs return: BrowsingContext -- New browsing context
|
|
17
|
+
def self.from: (UserContext user_context, BrowsingContext? parent, String id, String url, String? original_opener) -> BrowsingContext
|
|
18
|
+
|
|
19
|
+
attr_reader id: untyped
|
|
20
|
+
|
|
21
|
+
attr_reader user_context: untyped
|
|
22
|
+
|
|
23
|
+
attr_reader parent: untyped
|
|
24
|
+
|
|
25
|
+
attr_reader original_opener: untyped
|
|
26
|
+
|
|
27
|
+
attr_reader default_realm: untyped
|
|
28
|
+
|
|
29
|
+
attr_reader navigation: untyped
|
|
30
|
+
|
|
31
|
+
attr_reader inflight_requests: untyped
|
|
32
|
+
|
|
33
|
+
def initialize: (untyped user_context, untyped parent, untyped id, untyped url, untyped original_opener) -> untyped
|
|
34
|
+
|
|
35
|
+
# Check if the context is closed
|
|
36
|
+
def closed?: () -> untyped
|
|
37
|
+
|
|
38
|
+
alias disposed? closed?
|
|
39
|
+
|
|
40
|
+
# Get the current URL
|
|
41
|
+
# @rbs return: String -- Current URL
|
|
42
|
+
def url: () -> String
|
|
43
|
+
|
|
44
|
+
# Get child browsing contexts
|
|
45
|
+
# @rbs return: Array[BrowsingContext] -- Child contexts
|
|
46
|
+
def children: () -> Array[BrowsingContext]
|
|
47
|
+
|
|
48
|
+
# Get all realms in this context
|
|
49
|
+
# @rbs return: Array[WindowRealm] -- All realms
|
|
50
|
+
def realms: () -> Array[WindowRealm]
|
|
51
|
+
|
|
52
|
+
# Get the top-level browsing context
|
|
53
|
+
# @rbs return: BrowsingContext -- Top-level context
|
|
54
|
+
def top: () -> BrowsingContext
|
|
55
|
+
|
|
56
|
+
# Activate this browsing context
|
|
57
|
+
def activate: () -> untyped
|
|
58
|
+
|
|
59
|
+
# Navigate to a URL
|
|
60
|
+
# @rbs url: String -- URL to navigate to
|
|
61
|
+
# @rbs wait: String? -- Wait condition ('none', 'interactive', 'complete')
|
|
62
|
+
# @rbs return: Async::Task[untyped]
|
|
63
|
+
def navigate: (String url, ?wait: String?) -> Async::Task[untyped]
|
|
64
|
+
|
|
65
|
+
# Reload the page
|
|
66
|
+
# @rbs **options: untyped -- Reload options
|
|
67
|
+
# @rbs return: Async::Task[untyped]
|
|
68
|
+
def reload: (**untyped options) -> Async::Task[untyped]
|
|
69
|
+
|
|
70
|
+
# Capture a screenshot
|
|
71
|
+
# @rbs **options: untyped -- Screenshot options
|
|
72
|
+
# @rbs return: Async::Task[String] -- Base64-encoded image data
|
|
73
|
+
def capture_screenshot: (**untyped options) -> Async::Task[String]
|
|
74
|
+
|
|
75
|
+
# Print to PDF
|
|
76
|
+
# @rbs **options: untyped -- Print options
|
|
77
|
+
# @rbs return: Async::Task[String] -- Base64-encoded PDF data
|
|
78
|
+
def print: (**untyped options) -> Async::Task[String]
|
|
79
|
+
|
|
80
|
+
# Close this browsing context
|
|
81
|
+
# @rbs prompt_unload: bool -- Whether to prompt before unload
|
|
82
|
+
# @rbs return: Async::Task[void]
|
|
83
|
+
def close: (?prompt_unload: bool) -> Async::Task[void]
|
|
84
|
+
|
|
85
|
+
# Traverse history
|
|
86
|
+
# @rbs delta: Integer -- Number of steps to go back (negative) or forward (positive)
|
|
87
|
+
# @rbs return: Async::Task[untyped]
|
|
88
|
+
def traverse_history: (Integer delta) -> Async::Task[untyped]
|
|
89
|
+
|
|
90
|
+
# Handle a user prompt
|
|
91
|
+
# @rbs **options: untyped -- Prompt handling options
|
|
92
|
+
# @rbs return: Async::Task[untyped]
|
|
93
|
+
def handle_user_prompt: (**untyped options) -> Async::Task[untyped]
|
|
94
|
+
|
|
95
|
+
# Set viewport
|
|
96
|
+
# @rbs **options: untyped -- Viewport options
|
|
97
|
+
# @rbs return: Async::Task[untyped]
|
|
98
|
+
def set_viewport: (**untyped options) -> Async::Task[untyped]
|
|
99
|
+
|
|
100
|
+
# Perform input actions
|
|
101
|
+
# @rbs actions: Array[Hash[String, untyped]] -- Input actions
|
|
102
|
+
# @rbs return: Async::Task[untyped]
|
|
103
|
+
def perform_actions: (Array[Hash[String, untyped]] actions) -> Async::Task[untyped]
|
|
104
|
+
|
|
105
|
+
# Release input actions
|
|
106
|
+
def release_actions: () -> untyped
|
|
107
|
+
|
|
108
|
+
# Set cache behavior
|
|
109
|
+
# @rbs cache_behavior: String -- 'default' or 'bypass'
|
|
110
|
+
# @rbs return: Async::Task[untyped]
|
|
111
|
+
def set_cache_behavior: (String cache_behavior) -> Async::Task[untyped]
|
|
112
|
+
|
|
113
|
+
# Create a sandboxed window realm
|
|
114
|
+
# @rbs sandbox: String -- Sandbox name
|
|
115
|
+
# @rbs return: WindowRealm -- New realm
|
|
116
|
+
def create_window_realm: (String sandbox) -> WindowRealm
|
|
117
|
+
|
|
118
|
+
# Add a preload script to this context
|
|
119
|
+
# @rbs function_declaration: String -- JavaScript function
|
|
120
|
+
# @rbs **options: untyped -- Script options
|
|
121
|
+
# @rbs return: Async::Task[String] -- Script ID
|
|
122
|
+
def add_preload_script: (String function_declaration, **untyped options) -> Async::Task[String]
|
|
123
|
+
|
|
124
|
+
# Remove a preload script
|
|
125
|
+
# @rbs script: String -- Script ID
|
|
126
|
+
# @rbs return: Async::Task[untyped]
|
|
127
|
+
def remove_preload_script: (String script) -> Async::Task[untyped]
|
|
128
|
+
|
|
129
|
+
# Add network intercept
|
|
130
|
+
# @rbs **options: untyped -- Intercept options
|
|
131
|
+
# @rbs return: String -- Intercept ID
|
|
132
|
+
def add_intercept: (**untyped options) -> String
|
|
133
|
+
|
|
134
|
+
# Get cookies
|
|
135
|
+
# @rbs **options: untyped -- Cookie filter options
|
|
136
|
+
# @rbs return: Array[Hash[String, untyped]] -- Cookies
|
|
137
|
+
def get_cookies: (**untyped options) -> Array[Hash[String, untyped]]
|
|
138
|
+
|
|
139
|
+
# Set a cookie
|
|
140
|
+
# @rbs cookie: Hash[String, untyped] -- Cookie data
|
|
141
|
+
# @rbs return: Async::Task[untyped]
|
|
142
|
+
def set_cookie: (Hash[String, untyped] cookie) -> Async::Task[untyped]
|
|
143
|
+
|
|
144
|
+
# Delete cookies
|
|
145
|
+
# @rbs *cookie_filters: Hash[String, untyped] -- Cookie filters
|
|
146
|
+
# @rbs return: void
|
|
147
|
+
def delete_cookie: (*Hash[String, untyped] cookie_filters) -> void
|
|
148
|
+
|
|
149
|
+
# Set geolocation override
|
|
150
|
+
# @rbs **options: untyped -- Geolocation options
|
|
151
|
+
# @rbs return: Async::Task[untyped]
|
|
152
|
+
def set_geolocation_override: (**untyped options) -> Async::Task[untyped]
|
|
153
|
+
|
|
154
|
+
# Set timezone override
|
|
155
|
+
# @rbs timezone_id: String? -- Timezone ID
|
|
156
|
+
# @rbs return: Async::Task[untyped]
|
|
157
|
+
def set_timezone_override: (?String? timezone_id) -> Async::Task[untyped]
|
|
158
|
+
|
|
159
|
+
# Set files on an input element
|
|
160
|
+
# @rbs element: Hash[String, untyped] -- Element reference
|
|
161
|
+
# @rbs files: Array[String] -- File paths
|
|
162
|
+
# @rbs return: Async::Task[untyped]
|
|
163
|
+
def set_files: (Hash[String, untyped] element, Array[String] files) -> Async::Task[untyped]
|
|
164
|
+
|
|
165
|
+
# Locate nodes in the context
|
|
166
|
+
# @rbs locator: Hash[String, untyped] -- Node locator
|
|
167
|
+
# @rbs start_nodes: Array[Hash[String, untyped]] -- Starting nodes
|
|
168
|
+
# @rbs return: Array[Hash[String, untyped]] -- Located nodes
|
|
169
|
+
def locate_nodes: (Hash[String, untyped] locator, ?Array[Hash[String, untyped]] start_nodes) -> Array[Hash[String, untyped]]
|
|
170
|
+
|
|
171
|
+
# Set JavaScript enabled state
|
|
172
|
+
# @rbs enabled: bool -- Whether JavaScript is enabled
|
|
173
|
+
# @rbs return: Async::Task[void]
|
|
174
|
+
def set_javascript_enabled: (bool enabled) -> Async::Task[void]
|
|
175
|
+
|
|
176
|
+
# Check if JavaScript is enabled
|
|
177
|
+
# @rbs return: bool -- Whether JavaScript is enabled
|
|
178
|
+
def javascript_enabled?: () -> bool
|
|
179
|
+
|
|
180
|
+
# Subscribe to events for this context
|
|
181
|
+
# @rbs events: Array[String] -- Event names
|
|
182
|
+
# @rbs return: void
|
|
183
|
+
def subscribe: (Array[String] events) -> void
|
|
184
|
+
|
|
185
|
+
# Add interception for this context
|
|
186
|
+
# @rbs events: Array[String] -- Event names
|
|
187
|
+
# @rbs return: void
|
|
188
|
+
def add_interception: (Array[String] events) -> void
|
|
189
|
+
|
|
190
|
+
# Override dispose to emit :closed event before setting @disposed = true
|
|
191
|
+
# This is needed because EventEmitter#emit returns early if @disposed is true
|
|
192
|
+
def dispose: () -> untyped
|
|
193
|
+
|
|
194
|
+
def perform_dispose: () -> untyped
|
|
195
|
+
|
|
196
|
+
private
|
|
197
|
+
|
|
198
|
+
def session: () -> untyped
|
|
199
|
+
|
|
200
|
+
def initialize_context: () -> untyped
|
|
201
|
+
|
|
202
|
+
def setup_event_listeners: () -> untyped
|
|
203
|
+
|
|
204
|
+
def dispose_children: (untyped reason) -> untyped
|
|
205
|
+
|
|
206
|
+
def dispose_context: (untyped reason) -> untyped
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/disposable.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Disposable provides resource management and cleanup capabilities
|
|
7
|
+
# Similar to TypeScript's DisposableStack
|
|
8
|
+
module Disposable
|
|
9
|
+
# DisposableStack manages multiple disposable resources
|
|
10
|
+
class DisposableStack
|
|
11
|
+
# @rbs return: void
|
|
12
|
+
def initialize: () -> void
|
|
13
|
+
|
|
14
|
+
# Add a disposable resource to the stack
|
|
15
|
+
# @rbs resource: untyped -- Resource that responds to #dispose
|
|
16
|
+
# @rbs return: untyped -- The resource itself for convenience
|
|
17
|
+
def use: (untyped resource) -> untyped
|
|
18
|
+
|
|
19
|
+
# Dispose all resources in reverse order (LIFO)
|
|
20
|
+
# @rbs return: void
|
|
21
|
+
def dispose: () -> void
|
|
22
|
+
|
|
23
|
+
# @rbs return: bool
|
|
24
|
+
def disposed?: () -> bool
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Module to be included in classes that need disposal
|
|
28
|
+
module DisposableMixin
|
|
29
|
+
# @rbs return: void
|
|
30
|
+
def dispose: () -> void
|
|
31
|
+
|
|
32
|
+
# @rbs return: bool
|
|
33
|
+
def disposed?: () -> bool
|
|
34
|
+
|
|
35
|
+
# Override this method to perform cleanup
|
|
36
|
+
# @rbs return: void
|
|
37
|
+
def perform_dispose: () -> void
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/errors.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Base error class for Core module
|
|
7
|
+
class Error < Puppeteer::Bidi::Error
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Raised when attempting to use a disposed resource
|
|
11
|
+
class DisposedError < Error
|
|
12
|
+
attr_reader resource_type: String
|
|
13
|
+
|
|
14
|
+
attr_reader reason: String
|
|
15
|
+
|
|
16
|
+
# @rbs resource_type: String
|
|
17
|
+
# @rbs reason: String
|
|
18
|
+
# @rbs return: void
|
|
19
|
+
def initialize: (String resource_type, String reason) -> void
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Raised when a realm has been destroyed
|
|
23
|
+
class RealmDestroyedError < DisposedError
|
|
24
|
+
# @rbs reason: String
|
|
25
|
+
# @rbs return: void
|
|
26
|
+
def initialize: (String reason) -> void
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Raised when a browsing context has been closed
|
|
30
|
+
class BrowsingContextClosedError < DisposedError
|
|
31
|
+
# @rbs reason: String
|
|
32
|
+
# @rbs return: void
|
|
33
|
+
def initialize: (String reason) -> void
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Raised when a user context has been closed
|
|
37
|
+
class UserContextClosedError < DisposedError
|
|
38
|
+
# @rbs reason: String
|
|
39
|
+
# @rbs return: void
|
|
40
|
+
def initialize: (String reason) -> void
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Raised when a user prompt has been closed
|
|
44
|
+
class UserPromptClosedError < DisposedError
|
|
45
|
+
# @rbs reason: String
|
|
46
|
+
# @rbs return: void
|
|
47
|
+
def initialize: (String reason) -> void
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Raised when a session has ended
|
|
51
|
+
class SessionEndedError < DisposedError
|
|
52
|
+
# @rbs reason: String
|
|
53
|
+
# @rbs return: void
|
|
54
|
+
def initialize: (String reason) -> void
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Raised when a browser has been disconnected
|
|
58
|
+
class BrowserDisconnectedError < DisposedError
|
|
59
|
+
# @rbs reason: String
|
|
60
|
+
# @rbs return: void
|
|
61
|
+
def initialize: (String reason) -> void
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/event_emitter.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# EventEmitter provides event subscription and emission capabilities
|
|
7
|
+
# Similar to Node.js EventEmitter but simpler
|
|
8
|
+
class EventEmitter
|
|
9
|
+
# @rbs return: void
|
|
10
|
+
def initialize: () -> void
|
|
11
|
+
|
|
12
|
+
# Register an event listener
|
|
13
|
+
# @rbs event: Symbol | String -- Event name
|
|
14
|
+
# @rbs &block: (untyped) -> void -- Event handler
|
|
15
|
+
# @rbs return: void
|
|
16
|
+
def on: (Symbol | String event) { (untyped) -> void } -> void
|
|
17
|
+
|
|
18
|
+
# Register a one-time event listener
|
|
19
|
+
# @rbs event: Symbol | String -- Event name
|
|
20
|
+
# @rbs &block: (untyped) -> void -- Event handler
|
|
21
|
+
# @rbs return: void
|
|
22
|
+
def once: (Symbol | String event) { (untyped) -> void } -> void
|
|
23
|
+
|
|
24
|
+
# Remove an event listener
|
|
25
|
+
# @rbs event: Symbol | String -- Event name
|
|
26
|
+
# @rbs &block: ((untyped) -> void)? -- Event handler to remove
|
|
27
|
+
# @rbs return: void
|
|
28
|
+
def off: (Symbol | String event) ?{ (?) -> untyped } -> void
|
|
29
|
+
|
|
30
|
+
# Remove all listeners for an event or all events
|
|
31
|
+
# @rbs event: (Symbol | String)? -- Event name
|
|
32
|
+
# @rbs return: void
|
|
33
|
+
def remove_all_listeners: (?(Symbol | String)? event) -> void
|
|
34
|
+
|
|
35
|
+
# Emit an event to all registered listeners
|
|
36
|
+
# @rbs event: Symbol | String -- Event name
|
|
37
|
+
# @rbs data: untyped -- Event data
|
|
38
|
+
# @rbs return: void
|
|
39
|
+
def emit: (Symbol | String event, ?untyped data) -> void
|
|
40
|
+
|
|
41
|
+
# Dispose the event emitter
|
|
42
|
+
# @rbs return: void
|
|
43
|
+
def dispose: () -> void
|
|
44
|
+
|
|
45
|
+
# @rbs return: bool
|
|
46
|
+
def disposed?: () -> bool
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/navigation.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Navigation represents a single navigation operation
|
|
7
|
+
class Navigation < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
# Create a navigation instance
|
|
11
|
+
# @rbs browsing_context: BrowsingContext -- The browsing context
|
|
12
|
+
# @rbs return: Navigation -- New navigation instance
|
|
13
|
+
def self.from: (BrowsingContext browsing_context) -> Navigation
|
|
14
|
+
|
|
15
|
+
attr_reader browsing_context: untyped
|
|
16
|
+
|
|
17
|
+
attr_reader request: untyped
|
|
18
|
+
|
|
19
|
+
def initialize: (untyped browsing_context) -> untyped
|
|
20
|
+
|
|
21
|
+
# Get the nested navigation if any
|
|
22
|
+
# @rbs return: Navigation? -- Nested navigation
|
|
23
|
+
def navigation: () -> Navigation?
|
|
24
|
+
|
|
25
|
+
def perform_dispose: () -> untyped
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def session: () -> untyped
|
|
30
|
+
|
|
31
|
+
def initialize_navigation: () -> untyped
|
|
32
|
+
|
|
33
|
+
def matches?: (untyped navigation_id) -> untyped
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Generated from lib/puppeteer/bidi/core/realm.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Puppeteer
|
|
4
|
+
module Bidi
|
|
5
|
+
module Core
|
|
6
|
+
# Realm is the base class for script execution realms
|
|
7
|
+
class Realm < EventEmitter
|
|
8
|
+
include Disposable::DisposableMixin
|
|
9
|
+
|
|
10
|
+
attr_reader id: untyped
|
|
11
|
+
|
|
12
|
+
attr_reader origin: untyped
|
|
13
|
+
|
|
14
|
+
def initialize: (untyped id, untyped origin) -> untyped
|
|
15
|
+
|
|
16
|
+
# Get the target for script execution
|
|
17
|
+
# @rbs return: Hash[Symbol, untyped] -- BiDi target descriptor
|
|
18
|
+
def target: () -> Hash[Symbol, untyped]
|
|
19
|
+
|
|
20
|
+
# Disown handles (remove references)
|
|
21
|
+
# @rbs handles: Array[String] -- Handle IDs to disown
|
|
22
|
+
# @rbs return: Async::Task[untyped]
|
|
23
|
+
def disown: (Array[String] handles) -> Async::Task[untyped]
|
|
24
|
+
|
|
25
|
+
# Call a function in the realm
|
|
26
|
+
# @rbs function_declaration: String -- Function source code
|
|
27
|
+
# @rbs await_promise: bool -- Whether to await promise results
|
|
28
|
+
# @rbs **options: untyped -- Additional options (arguments, serializationOptions, resultOwnership, etc.)
|
|
29
|
+
# @rbs return: Async::Task[Hash[String, untyped]] -- Evaluation result
|
|
30
|
+
def call_function: (String function_declaration, bool await_promise, **untyped options) -> Async::Task[Hash[String, untyped]]
|
|
31
|
+
|
|
32
|
+
# Evaluate an expression in the realm
|
|
33
|
+
# @rbs expression: String -- JavaScript expression
|
|
34
|
+
# @rbs await_promise: bool -- Whether to await promise results
|
|
35
|
+
# @rbs **options: untyped -- Additional options (serializationOptions, resultOwnership, etc.)
|
|
36
|
+
# @rbs return: Async::Task[Hash[String, untyped]] -- Evaluation result
|
|
37
|
+
def evaluate: (String expression, bool await_promise, **untyped options) -> Async::Task[Hash[String, untyped]]
|
|
38
|
+
|
|
39
|
+
# Resolve the CDP execution context ID for this realm
|
|
40
|
+
# @rbs return: Integer -- Execution context ID
|
|
41
|
+
def resolve_execution_context_id: () -> Integer
|
|
42
|
+
|
|
43
|
+
# Abstract method - must be implemented by subclasses
|
|
44
|
+
# @rbs return: Session -- The session for this realm
|
|
45
|
+
def session: () -> Session
|
|
46
|
+
|
|
47
|
+
def perform_dispose: () -> untyped
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# WindowRealm represents a JavaScript realm in a window or iframe
|
|
51
|
+
class WindowRealm < Realm
|
|
52
|
+
# Create a window realm
|
|
53
|
+
# @rbs browsing_context: BrowsingContext -- The browsing context
|
|
54
|
+
# @rbs sandbox: String? -- Sandbox name
|
|
55
|
+
# @rbs return: WindowRealm -- New window realm
|
|
56
|
+
def self.from: (BrowsingContext browsing_context, ?String? sandbox) -> WindowRealm
|
|
57
|
+
|
|
58
|
+
attr_reader browsing_context: untyped
|
|
59
|
+
|
|
60
|
+
attr_reader sandbox: untyped
|
|
61
|
+
|
|
62
|
+
def initialize: (untyped browsing_context, ?untyped sandbox) -> untyped
|
|
63
|
+
|
|
64
|
+
# Set the environment (Frame) for this realm
|
|
65
|
+
# This is set by Frame when it's created
|
|
66
|
+
# @rbs frame: untyped -- The frame environment
|
|
67
|
+
# @rbs return: void
|
|
68
|
+
def environment=: (untyped frame) -> void
|
|
69
|
+
|
|
70
|
+
# Get the environment (Frame) for this realm
|
|
71
|
+
# @rbs return: untyped -- The frame environment
|
|
72
|
+
def environment: () -> untyped
|
|
73
|
+
|
|
74
|
+
# Override target to use context-based target
|
|
75
|
+
# @rbs return: Hash[Symbol, untyped] -- BiDi target descriptor
|
|
76
|
+
def target: () -> Hash[Symbol, untyped]
|
|
77
|
+
|
|
78
|
+
def session: () -> untyped
|
|
79
|
+
|
|
80
|
+
private
|
|
81
|
+
|
|
82
|
+
def initialize_realm: () -> untyped
|
|
83
|
+
|
|
84
|
+
def dispose_realm: (untyped reason) -> untyped
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# DedicatedWorkerRealm represents a JavaScript realm in a dedicated worker
|
|
88
|
+
class DedicatedWorkerRealm < Realm
|
|
89
|
+
# Create a dedicated worker realm
|
|
90
|
+
# @rbs owner: WindowRealm | DedicatedWorkerRealm | SharedWorkerRealm -- Owner realm
|
|
91
|
+
# @rbs id: String -- Realm ID
|
|
92
|
+
# @rbs origin: String -- Realm origin
|
|
93
|
+
# @rbs return: DedicatedWorkerRealm -- New dedicated worker realm
|
|
94
|
+
def self.from: (WindowRealm | DedicatedWorkerRealm | SharedWorkerRealm owner, String id, String origin) -> DedicatedWorkerRealm
|
|
95
|
+
|
|
96
|
+
attr_reader owners: untyped
|
|
97
|
+
|
|
98
|
+
def initialize: (untyped owner, untyped id, untyped origin) -> untyped
|
|
99
|
+
|
|
100
|
+
def session: () -> untyped
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def initialize_realm: () -> untyped
|
|
105
|
+
|
|
106
|
+
def dispose_realm: (untyped reason) -> untyped
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# SharedWorkerRealm represents a JavaScript realm in a shared worker
|
|
110
|
+
class SharedWorkerRealm < Realm
|
|
111
|
+
# Create a shared worker realm
|
|
112
|
+
# @rbs browser: Browser -- Browser instance
|
|
113
|
+
# @rbs id: String -- Realm ID
|
|
114
|
+
# @rbs origin: String -- Realm origin
|
|
115
|
+
# @rbs return: SharedWorkerRealm -- New shared worker realm
|
|
116
|
+
def self.from: (Browser browser, String id, String origin) -> SharedWorkerRealm
|
|
117
|
+
|
|
118
|
+
attr_reader browser: untyped
|
|
119
|
+
|
|
120
|
+
def initialize: (untyped browser, untyped id, untyped origin) -> untyped
|
|
121
|
+
|
|
122
|
+
def session: () -> untyped
|
|
123
|
+
|
|
124
|
+
private
|
|
125
|
+
|
|
126
|
+
def initialize_realm: () -> untyped
|
|
127
|
+
|
|
128
|
+
def dispose_realm: (untyped reason) -> untyped
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|