chromium-bidi 0.4.3 → 0.4.4

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.
Files changed (110) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +58 -60
  3. package/lib/cjs/bidiMapper/BidiServer.d.ts +9 -5
  4. package/lib/cjs/bidiMapper/BidiServer.js +24 -9
  5. package/lib/cjs/bidiMapper/BidiServer.js.map +1 -1
  6. package/lib/cjs/bidiMapper/CdpConnection.d.ts +1 -1
  7. package/lib/cjs/bidiMapper/CommandProcessor.d.ts +7 -4
  8. package/lib/cjs/bidiMapper/CommandProcessor.js +7 -7
  9. package/lib/cjs/bidiMapper/CommandProcessor.js.map +1 -1
  10. package/lib/cjs/bidiMapper/{OutgoindBidiMessage.d.ts → OutgoingBidiMessage.d.ts} +0 -0
  11. package/lib/cjs/bidiMapper/{OutgoindBidiMessage.js → OutgoingBidiMessage.js} +1 -1
  12. package/lib/cjs/bidiMapper/{OutgoindBidiMessage.js.map → OutgoingBidiMessage.js.map} +1 -1
  13. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.d.ts +5 -2
  14. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js +28 -18
  15. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js.map +1 -1
  16. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.d.ts +5 -3
  17. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js +51 -41
  18. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js.map +1 -1
  19. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.d.ts +6 -6
  20. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js +14 -14
  21. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js.map +1 -1
  22. package/lib/cjs/bidiMapper/domains/events/EventManager.d.ts +6 -6
  23. package/lib/cjs/bidiMapper/domains/events/EventManager.js +29 -28
  24. package/lib/cjs/bidiMapper/domains/events/EventManager.js.map +1 -1
  25. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.d.ts +6 -4
  26. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js +42 -4
  27. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js.map +1 -1
  28. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js +43 -17
  29. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js.map +1 -1
  30. package/lib/cjs/bidiMapper/domains/log/logHelper.js +13 -15
  31. package/lib/cjs/bidiMapper/domains/log/logHelper.js.map +1 -1
  32. package/lib/cjs/bidiMapper/domains/log/logHelper_getRemoteValuesText.spec.js.map +1 -1
  33. package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js +12 -12
  34. package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js.map +1 -1
  35. package/lib/cjs/bidiMapper/domains/log/logManager.d.ts +2 -17
  36. package/lib/cjs/bidiMapper/domains/log/logManager.js +37 -39
  37. package/lib/cjs/bidiMapper/domains/log/logManager.js.map +1 -1
  38. package/lib/cjs/bidiMapper/domains/script/realm.d.ts +13 -35
  39. package/lib/cjs/bidiMapper/domains/script/realm.js +98 -77
  40. package/lib/cjs/bidiMapper/domains/script/realm.js.map +1 -1
  41. package/lib/cjs/bidiMapper/domains/script/realmStorage.d.ts +38 -0
  42. package/lib/cjs/bidiMapper/domains/script/realmStorage.js +72 -0
  43. package/lib/cjs/bidiMapper/domains/script/realmStorage.js.map +1 -0
  44. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.d.ts +13 -14
  45. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js +245 -258
  46. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js.map +1 -1
  47. package/lib/cjs/bidiMapper/tsconfig.tsbuildinfo +1 -1
  48. package/lib/cjs/bidiServer/bidiServerRunner.d.ts +1 -1
  49. package/lib/cjs/bidiServer/bidiServerRunner.js +42 -55
  50. package/lib/cjs/bidiServer/bidiServerRunner.js.map +1 -1
  51. package/lib/cjs/bidiServer/index.js +15 -13
  52. package/lib/cjs/bidiServer/index.js.map +1 -1
  53. package/lib/cjs/bidiServer/mapperServer.d.ts +9 -9
  54. package/lib/cjs/bidiServer/mapperServer.js +26 -26
  55. package/lib/cjs/bidiServer/mapperServer.js.map +1 -1
  56. package/lib/cjs/bidiServer/tsconfig.tsbuildinfo +1 -1
  57. package/lib/cjs/bidiTab/bidiTab.js +32 -32
  58. package/lib/cjs/bidiTab/bidiTab.js.map +1 -1
  59. package/lib/cjs/bidiTab/mapperTabPage.d.ts +2 -10
  60. package/lib/cjs/bidiTab/mapperTabPage.js +67 -53
  61. package/lib/cjs/bidiTab/mapperTabPage.js.map +1 -1
  62. package/lib/cjs/bidiTab/tsconfig.tsbuildinfo +1 -1
  63. package/lib/cjs/cdp/cdpClient.d.ts +5 -5
  64. package/lib/cjs/cdp/cdpClient.js +7 -7
  65. package/lib/cjs/cdp/cdpClient.js.map +1 -1
  66. package/lib/cjs/cdp/cdpClient.spec.js +10 -10
  67. package/lib/cjs/cdp/cdpClient.spec.js.map +1 -1
  68. package/lib/cjs/cdp/cdpConnection.d.ts +3 -3
  69. package/lib/cjs/cdp/cdpConnection.js +12 -10
  70. package/lib/cjs/cdp/cdpConnection.js.map +1 -1
  71. package/lib/cjs/cdp/cdpConnection.spec.js +9 -9
  72. package/lib/cjs/cdp/cdpConnection.spec.js.map +1 -1
  73. package/lib/cjs/cdp/stubTransport.spec.d.ts +2 -2
  74. package/lib/cjs/cdp/stubTransport.spec.js +2 -2
  75. package/lib/cjs/cdp/stubTransport.spec.js.map +1 -1
  76. package/lib/cjs/cdp/tsconfig.tsbuildinfo +1 -1
  77. package/lib/cjs/cdp/websocketTransport.d.ts +3 -3
  78. package/lib/cjs/cdp/websocketTransport.js +11 -11
  79. package/lib/cjs/cdp/websocketTransport.js.map +1 -1
  80. package/lib/cjs/protocol/protocol.d.ts +20 -10
  81. package/lib/cjs/protocol/protocol.js +9 -0
  82. package/lib/cjs/protocol/protocol.js.map +1 -1
  83. package/lib/cjs/protocol/tsconfig.tsbuildinfo +1 -1
  84. package/lib/cjs/protocol-parser/protocol-parser.d.ts +54 -17
  85. package/lib/cjs/protocol-parser/protocol-parser.js +15 -7
  86. package/lib/cjs/protocol-parser/protocol-parser.js.map +1 -1
  87. package/lib/cjs/protocol-parser/tsconfig.tsbuildinfo +1 -1
  88. package/lib/cjs/utils/EventEmitter.d.ts +1 -1
  89. package/lib/cjs/utils/EventEmitter.js +5 -5
  90. package/lib/cjs/utils/EventEmitter.js.map +1 -1
  91. package/lib/cjs/utils/EventEmitter.spec.js +5 -5
  92. package/lib/cjs/utils/EventEmitter.spec.js.map +1 -1
  93. package/lib/cjs/utils/buffer.spec.js +1 -1
  94. package/lib/cjs/utils/buffer.spec.js.map +1 -1
  95. package/lib/cjs/utils/deferred.d.ts +3 -3
  96. package/lib/cjs/utils/deferred.js.map +1 -1
  97. package/lib/cjs/utils/idWrapper.spec.js +4 -4
  98. package/lib/cjs/utils/idWrapper.spec.js.map +1 -1
  99. package/lib/cjs/utils/log.d.ts +2 -3
  100. package/lib/cjs/utils/log.js +2 -14
  101. package/lib/cjs/utils/log.js.map +1 -1
  102. package/lib/cjs/utils/processingQueue.d.ts +18 -1
  103. package/lib/cjs/utils/processingQueue.js +9 -8
  104. package/lib/cjs/utils/processingQueue.js.map +1 -1
  105. package/lib/cjs/utils/processingQueue.spec.js +7 -6
  106. package/lib/cjs/utils/processingQueue.spec.js.map +1 -1
  107. package/lib/cjs/utils/tsconfig.tsbuildinfo +1 -1
  108. package/lib/iife/mapperTab.js +2 -2
  109. package/lib/iife/mapperTab.js.map +1 -1
  110. package/package.json +15 -19
package/LICENSE CHANGED
@@ -198,4 +198,4 @@
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # WebDriver BiDi for Chromium [![chromium-bidi on npm](https://img.shields.io/npm/v/chromium-bidi)](https://www.npmjs.com/package/chromium-bidi)
2
2
 
3
- ![E2E Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/e2e.js.yml/badge.svg)
4
- ![Unit Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/unit.js.yml/badge.svg)
5
- ![WPT Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/wpt.yml/badge.svg)
3
+ ![Unit Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/unit.yml/badge.svg)
4
+ ![E2E Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/e2e.yml/badge.svg)
5
+ ![WPT Tests (mapper)](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/wpt-mapper.yml/badge.svg)
6
+ ![WPT Tests (chromedriver)](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/wpt-chromedriver.yml/badge.svg)
7
+
8
+ ![pre-commit](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/pre-commit.yml/badge.svg)
6
9
 
7
10
  This is an implementation of the
8
11
  [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) protocol with some
@@ -11,12 +14,11 @@ for Chromium, implemented as a JavaScript layer translating between BiDi and CDP
11
14
  running inside a Chrome tab.
12
15
 
13
16
  Current status can be checked
14
- in [WPT WebDriver BiDi status](https://wpt.fyi/results/webdriver/tests/bidi).
17
+ at [WPT WebDriver BiDi status](https://wpt.fyi/results/webdriver/tests/bidi).
15
18
 
16
19
  ## BiDi+
17
20
 
18
- **"BiDi+"** is an extension of the WebDriver BiDi protocol. In addition to
19
- the [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) it has:
21
+ **"BiDi+"** is an extension of the WebDriver BiDi protocol. In addition to [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) it has:
20
22
 
21
23
  ### Command `cdp.sendCommand`
22
24
 
@@ -78,7 +80,7 @@ CdpEventReceivedParameters = {
78
80
 
79
81
  The event contains a CDP event.
80
82
 
81
- ## Field `channel`
83
+ ### Field `channel`
82
84
 
83
85
  Each command can be extended with a `channel`:
84
86
 
@@ -125,7 +127,9 @@ Event = {
125
127
  }
126
128
  ```
127
129
 
128
- # Setup
130
+ ## Dev Setup
131
+
132
+ ### `npm`
129
133
 
130
134
  This is a Node.js project, so install dependencies as usual:
131
135
 
@@ -133,7 +137,11 @@ This is a Node.js project, so install dependencies as usual:
133
137
  npm install
134
138
  ```
135
139
 
136
- # Starting the Server
140
+ ### pre-commit.com integration
141
+
142
+ Refer to the documentation at [.pre-commit-config.yaml](.pre-commit-config.yaml).
143
+
144
+ ### Starting the Server
137
145
 
138
146
  This will run the server on port `8080`:
139
147
 
@@ -171,7 +179,7 @@ CHANNEL=chrome-dev npm run server
171
179
  npm run server -- --channel=chrome-dev
172
180
  ```
173
181
 
174
- ## Starting on Linux and Mac
182
+ ### Starting on Linux and Mac
175
183
 
176
184
  TODO: verify if it works on Windows.
177
185
 
@@ -182,20 +190,20 @@ output to the file `log.txt`:
182
190
  ./runBiDiServer.sh --port=8081 --headless=false
183
191
  ```
184
192
 
185
- # Running
193
+ ## Running
186
194
 
187
- ## Unit tests
195
+ ### Unit tests
188
196
 
189
197
  Running:
190
198
 
191
199
  ```sh
192
- npm run unit
200
+ npm test
193
201
  ```
194
202
 
195
- ## e2e tests
203
+ ### E2E tests
196
204
 
197
- The e2e tests are written using Python, in order to learn how to eventually do this
198
- in web-platform-tests.
205
+ The E2E tests are written using Python, in order to learn how to eventually do
206
+ this in web-platform-tests.
199
207
 
200
208
  ### Installation
201
209
 
@@ -207,8 +215,8 @@ python3 -m pip install --user -r tests/requirements.txt
207
215
 
208
216
  ### Running
209
217
 
210
- The e2e tests require BiDi server running on the same host. By default, tests try to
211
- connect to the port `8080`. The server can be run from the project root:
218
+ The E2E tests require BiDi server running on the same host. By default, tests
219
+ try to connect to the port `8080`. The server can be run from the project root:
212
220
 
213
221
  ```sh
214
222
  npm run e2e
@@ -220,45 +228,17 @@ Use the `PORT` environment variable to connect to another port:
220
228
  PORT=8081 npm run e2e
221
229
  ```
222
230
 
223
- ## Examples
224
-
225
- The examples are stored in the `/examples` folder and are intended to show who the
226
- BiDi protocol can be used. Examples are based on
227
- [Puppeteer's examples](https://github.com/puppeteer/puppeteer/tree/main/examples)
228
- .
229
-
230
- ### Installation
231
-
232
- The examples are written using Python, to align with e2e test. Python 3.6+ and some
233
- dependencies are required:
234
-
235
- ```sh
236
- python3 -m pip install --user -r tests/requirements.txt
237
- ```
238
-
239
- ### Running
240
-
241
- The examples require BiDi server running on the same host on the port `8080`. The
242
- server can be run from the project root:
243
-
244
- ```sh
245
- npm run server
246
- ```
247
-
248
- After running server, examples can be simply run:
231
+ ### Examples
249
232
 
250
- ```sh
251
- python3 examples/console_log_example.py
252
- python3 examples/script_example.py
253
- ```
233
+ Refer to [examples/README.md](examples/README.md).
254
234
 
255
- ## WPT
235
+ ## WPT (Web Platform Tests)
256
236
 
257
237
  WPT is added as
258
238
  a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules). To get run
259
239
  WPT tests:
260
240
 
261
- ### Check out WPT and setup
241
+ ### Check out and setup WPT
262
242
 
263
243
  #### 1. Check out WPT
264
244
 
@@ -284,13 +264,13 @@ Follow
284
264
  the [`hosts` File Setup](https://web-platform-tests.org/running-tests/from-local-system.html#hosts-file-setup)
285
265
  instructions.
286
266
 
287
- ##### On Linux, macOS or other UNIX-like system
267
+ ##### 4.a On Linux, macOS or other UNIX-like system
288
268
 
289
269
  ```sh
290
270
  ./wpt make-hosts-file | sudo tee -a /etc/hosts
291
271
  ```
292
272
 
293
- ##### And on **Windows**
273
+ ##### 4.b On **Windows**
294
274
 
295
275
  This must be run in a PowerShell session with Administrator privileges:
296
276
 
@@ -301,27 +281,45 @@ python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts
301
281
  If you are behind a proxy, you also need to make sure the domains above are excluded
302
282
  from your proxy lookups.
303
283
 
304
- #### 5. Set the `WPT_BROWSER_PATH` environment variable to a Chrome, Edge or Chromium binary to launch. For example, on macOS:
284
+ #### 5. Set `WPT_BROWSER_PATH`
285
+
286
+ Set the `WPT_BROWSER_PATH` environment variable to a Chrome, Edge or Chromium binary to launch.
287
+ For example, on macOS:
305
288
 
306
289
  ```sh
290
+ # Chrome
307
291
  export WPT_BROWSER_PATH="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
308
- export WPT_BROWSER_PATH="/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary"
292
+ export WPT_BROWSER_PATH="/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev"
293
+ export WPT_BROWSER_PATH="/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"
294
+ export WPT_BROWSER_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
309
295
  export WPT_BROWSER_PATH="/Applications/Chromium.app/Contents/MacOS/Chromium"
296
+
297
+ # Edge
298
+ export WPT_BROWSER_PATH="/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary"
299
+ export WPT_BROWSER_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
310
300
  ```
311
301
 
312
302
  ### Run WPT tests
313
303
 
314
- #### 1. Make sure you have Chrome Dev instaled
304
+ #### 1. Make sure you have Chrome Dev installed
315
305
 
316
306
  https://www.google.com/chrome/dev/
317
307
 
318
- #### 1. Build ChromeDriver BiDi
308
+ #### 2. Build ChromeDriver BiDi
309
+
310
+ Oneshot:
319
311
 
320
312
  ```sh
321
313
  npm run build
322
314
  ```
323
315
 
324
- #### 2. Run
316
+ Continuously:
317
+
318
+ ```sh
319
+ npm run watch
320
+ ```
321
+
322
+ #### 3. Run
325
323
 
326
324
  ```sh
327
325
  ./wpt/wpt run \
@@ -358,7 +356,7 @@ npm run build
358
356
  ./wptreport.json
359
357
  ```
360
358
 
361
- # How does it work?
359
+ ## How does it work?
362
360
 
363
361
  The architecture is described in the
364
362
  [WebDriver BiDi in Chrome Context implementation plan](https://docs.google.com/document/d/1VfQ9tv0wPSnb5TI-MOobjoQ5CXLnJJx9F_PxOMQc8kY)
@@ -371,12 +369,12 @@ There are 2 main modules:
371
369
  2. front-end BiDi Mapper in `src/bidiMapper`. Gets BiDi commands from the backend,
372
370
  and map them to CDP commands.
373
371
 
374
- ## Contributing
372
+ ### Contributing
375
373
 
376
374
  The BiDi commands are processed in the `src/bidiMapper/commandProcessor.ts`. To add a
377
375
  new command, add it to `_processCommand`, write and call processor for it.
378
376
 
379
- ## Publish new `npm` release
377
+ ### Publish new `npm` release
380
378
 
381
379
  1. On the `main` branch, bump the chromium-bidi version number in `package.json`:
382
380
 
@@ -14,23 +14,27 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { EventEmitter } from '../utils/EventEmitter.js';
18
- import { BidiTransport } from './BidiTransport.js';
19
- import type { Message } from '../protocol/protocol.js';
20
- import { OutgoingBidiMessage } from './OutgoindBidiMessage.js';
21
17
  import { BidiParser } from './CommandProcessor.js';
18
+ import { BidiTransport } from './BidiTransport.js';
19
+ import { BrowsingContextStorage } from './domains/context/browsingContextStorage.js';
22
20
  import { CdpConnection } from './CdpConnection.js';
21
+ import { EventEmitter } from '../utils/EventEmitter.js';
22
+ import { LoggerFn } from '../utils/log.js';
23
+ import type { Message } from '../protocol/protocol.js';
24
+ import { OutgoingBidiMessage } from './OutgoingBidiMessage.js';
23
25
  declare type BidiServerEvents = {
24
26
  message: Message.RawCommandRequest;
25
27
  };
26
28
  export declare class BidiServer extends EventEmitter<BidiServerEvents> {
27
29
  #private;
28
30
  private constructor();
29
- static createAndStart(bidiTransport: BidiTransport, cdpConnection: CdpConnection, selfTargetId: string, parser?: BidiParser): Promise<BidiServer>;
31
+ static createAndStart(bidiTransport: BidiTransport, cdpConnection: CdpConnection, selfTargetId: string, parser?: BidiParser, logger?: LoggerFn): Promise<BidiServer>;
32
+ topLevelContextsLoaded(): Promise<void>;
30
33
  /**
31
34
  * Sends BiDi message.
32
35
  */
33
36
  emitOutgoingMessage(messageEntry: Promise<OutgoingBidiMessage>): void;
34
37
  close(): void;
38
+ getBrowsingContextStorage(): BrowsingContextStorage;
35
39
  }
36
40
  export {};
@@ -17,27 +17,34 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.BidiServer = void 0;
20
- const EventEmitter_js_1 = require("../utils/EventEmitter.js");
21
- const processingQueue_js_1 = require("../utils/processingQueue.js");
22
- const EventManager_js_1 = require("./domains/events/EventManager.js");
23
20
  const CommandProcessor_js_1 = require("./CommandProcessor.js");
24
21
  const browsingContextStorage_js_1 = require("./domains/context/browsingContextStorage.js");
22
+ const EventEmitter_js_1 = require("../utils/EventEmitter.js");
23
+ const EventManager_js_1 = require("./domains/events/EventManager.js");
24
+ const processingQueue_js_1 = require("../utils/processingQueue.js");
25
+ const realmStorage_js_1 = require("./domains/script/realmStorage.js");
25
26
  class BidiServer extends EventEmitter_js_1.EventEmitter {
26
27
  #messageQueue;
27
28
  #transport;
28
29
  #commandProcessor;
29
- constructor(bidiTransport, cdpConnection, selfTargetId, parser) {
30
+ #browsingContextStorage;
31
+ #realmStorage;
32
+ #logger;
33
+ constructor(bidiTransport, cdpConnection, selfTargetId, parser, logger) {
30
34
  super();
31
- this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage);
35
+ this.#logger = logger;
36
+ this.#browsingContextStorage = new browsingContextStorage_js_1.BrowsingContextStorage();
37
+ this.#realmStorage = new realmStorage_js_1.RealmStorage();
38
+ this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage, undefined, this.#logger);
32
39
  this.#transport = bidiTransport;
33
40
  this.#transport.setOnMessage(this.#handleIncomingMessage);
34
- this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser);
41
+ this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(this.#realmStorage, cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser, this.#browsingContextStorage, this.#logger);
35
42
  this.#commandProcessor.on('response', (response) => {
36
43
  this.emitOutgoingMessage(response);
37
44
  });
38
45
  }
39
- static async createAndStart(bidiTransport, cdpConnection, selfTargetId, parser) {
40
- const server = new BidiServer(bidiTransport, cdpConnection, selfTargetId, parser);
46
+ static async createAndStart(bidiTransport, cdpConnection, selfTargetId, parser, logger) {
47
+ const server = new BidiServer(bidiTransport, cdpConnection, selfTargetId, parser, logger);
41
48
  const cdpClient = cdpConnection.browserClient();
42
49
  // Needed to get events about new targets.
43
50
  await cdpClient.sendCommand('Target.setDiscoverTargets', { discover: true });
@@ -47,9 +54,14 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
47
54
  waitForDebuggerOnStart: true,
48
55
  flatten: true,
49
56
  });
50
- await Promise.all(browsingContextStorage_js_1.BrowsingContextStorage.getTopLevelContexts().map((c) => c.awaitLoaded()));
57
+ await server.topLevelContextsLoaded();
51
58
  return server;
52
59
  }
60
+ async topLevelContextsLoaded() {
61
+ await Promise.all(this.#browsingContextStorage
62
+ .getTopLevelContexts()
63
+ .map((c) => c.awaitLoaded()));
64
+ }
53
65
  #processOutgoingMessage = async (messageEntry) => {
54
66
  const message = messageEntry.message;
55
67
  if (messageEntry.channel !== null) {
@@ -69,6 +81,9 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
69
81
  #handleIncomingMessage = async (message) => {
70
82
  this.#commandProcessor.processCommand(message);
71
83
  };
84
+ getBrowsingContextStorage() {
85
+ return this.#browsingContextStorage;
86
+ }
72
87
  }
73
88
  exports.BidiServer = BidiServer;
74
89
  //# sourceMappingURL=BidiServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BidiServer.js","sourceRoot":"","sources":["../../../src/bidiMapper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governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js';
18
17
  import { EventEmitter } from '../utils/EventEmitter.js';
18
+ import type { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js';
19
19
  declare type CdpEvents = {
20
20
  [Property in keyof ProtocolMapping.Events]: ProtocolMapping.Events[Property][0];
21
21
  };
@@ -14,11 +14,14 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { Message, Session, BrowsingContext, Script, CDP } from '../protocol/protocol.js';
17
+ import { BrowsingContext, CDP, Message, Script, Session } from '../protocol/protocol.js';
18
+ import { BrowsingContextStorage } from './domains/context/browsingContextStorage.js';
18
19
  import { CdpConnection } from './CdpConnection.js';
19
- import { OutgoingBidiMessage } from './OutgoindBidiMessage.js';
20
- import { IEventManager } from './domains/events/EventManager.js';
21
20
  import { EventEmitter } from '../utils/EventEmitter.js';
21
+ import { IEventManager } from './domains/events/EventManager.js';
22
+ import { LoggerFn } from '../utils/log.js';
23
+ import { OutgoingBidiMessage } from './OutgoingBidiMessage.js';
24
+ import { RealmStorage } from './domains/script/realmStorage.js';
22
25
  declare type CommandProcessorEvents = {
23
26
  response: Promise<OutgoingBidiMessage>;
24
27
  };
@@ -37,7 +40,7 @@ export interface BidiParser {
37
40
  }
38
41
  export declare class CommandProcessor extends EventEmitter<CommandProcessorEvents> {
39
42
  #private;
40
- constructor(cdpConnection: CdpConnection, eventManager: IEventManager, selfTargetId: string, parser?: BidiParser);
43
+ constructor(realmStorage: RealmStorage, cdpConnection: CdpConnection, eventManager: IEventManager, selfTargetId: string, parser: BidiParser | undefined, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn);
41
44
  processCommand: (command: Message.RawCommandRequest) => Promise<void>;
42
45
  }
43
46
  export {};
@@ -17,10 +17,10 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.CommandProcessor = void 0;
20
- const browsingContextProcessor_js_1 = require("./domains/context/browsingContextProcessor.js");
21
20
  const protocol_js_1 = require("../protocol/protocol.js");
22
- const OutgoindBidiMessage_js_1 = require("./OutgoindBidiMessage.js");
21
+ const browsingContextProcessor_js_1 = require("./domains/context/browsingContextProcessor.js");
23
22
  const EventEmitter_js_1 = require("../utils/EventEmitter.js");
23
+ const OutgoingBidiMessage_js_1 = require("./OutgoingBidiMessage.js");
24
24
  class BidiNoOpParser {
25
25
  parseGetRealmsParams(params) {
26
26
  return params;
@@ -60,10 +60,10 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
60
60
  #contextProcessor;
61
61
  #eventManager;
62
62
  #parser;
63
- constructor(cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser()) {
63
+ constructor(realmStorage, cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser(), browsingContextStorage, logger) {
64
64
  super();
65
65
  this.#eventManager = eventManager;
66
- this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(cdpConnection, selfTargetId, eventManager);
66
+ this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(realmStorage, cdpConnection, selfTargetId, eventManager, browsingContextStorage, logger);
67
67
  this.#parser = parser;
68
68
  }
69
69
  // noinspection JSMethodCanBeStatic,JSUnusedLocalSymbols
@@ -117,17 +117,17 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
117
117
  id: command.id,
118
118
  ...result,
119
119
  };
120
- this.emit('response', OutgoindBidiMessage_js_1.OutgoingBidiMessage.createResolved(response, command.channel ?? null));
120
+ this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(response, command.channel ?? null));
121
121
  }
122
122
  catch (e) {
123
123
  if (e instanceof protocol_js_1.Message.ErrorResponseClass) {
124
124
  const errorResponse = e;
125
- this.emit('response', OutgoindBidiMessage_js_1.OutgoingBidiMessage.createResolved(errorResponse.toErrorResponse(command.id), command.channel ?? null));
125
+ this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(errorResponse.toErrorResponse(command.id), command.channel ?? null));
126
126
  }
127
127
  else {
128
128
  const error = e;
129
129
  console.error(error);
130
- this.emit('response', OutgoindBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.UnknownException(error.message).toErrorResponse(command.id), command.channel ?? null));
130
+ this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.UnknownException(error.message).toErrorResponse(command.id), command.channel ?? null));
131
131
  }
132
132
  }
133
133
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandProcessor.js","sourceRoot":"","sources":["../../../src/bidiMapper/CommandProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,+FAAuF;AACvF,yDAMiC;AAEjC,qEAA6D;AAE7D,8DAAsD;AAoBtD,MAAM,cAAc;IAClB,oBAAoB,CAAC,MAAc;QACjC,OAAO,MAAoC,CAAC;IAC9C,CAAC;IACD,uBAAuB,CAAC,MAAc;QACpC,OAAO,MAAuC,CAAC;IACjD,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAAmC,CAAC;IAC7C,CAAC;IACD,iBAAiB,CAAC,MAAc;QAC9B,OAAO,MAAiC,CAAC;IAC3C,CAAC;IACD,sBAAsB,CAAC,MAAc;QACnC,OAAO,MAA+B,CAAC;IACzC,CAAC;IACD,qBAAqB,CAAC,MAAc;QAClC,OAAO,MAA8B,CAAC;IACxC,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAA2C,CAAC;IACrD,CAAC;IACD,oBAAoB,CAAC,MAAc;QACjC,OAAO,MAAqC,CAAC;IAC/C,CAAC;IACD,iBAAiB,CAAC,MAAc;QAC9B,OAAO,MAA0C,CAAC;IACpD,CAAC;IACD,gBAAgB,CAAC,MAAc;QAC7B,OAAO,MAAyC,C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+B,CAAC;gBACtD,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,EACzC,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;iBAAM;gBACL,MAAM,KAAK,GAAG,CAAU,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,IAAI,qBAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,eAAe,CACzD,OAAO,CAAC,EAAE,CACX,EACD,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;SACF;IACH,CAAC,CAAC;CACH;AA7JD,4CA6JC"}
1
+ {"version":3,"file":"CommandProcessor.js","sourceRoot":"","sources":["../../../src/bidiMapper/CommandProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAMiC;AACjC,+FAAuF;AAGvF,8DAAsD;AAGtD,qEAA6D;AAqB7D,MAAM,cAAc;IAClB,oBAAoB,CAAC,MAAc;QACjC,OAAO,MAAoC,CAAC;IAC9C,CAAC;IACD,uBAAuB,CAAC,MAAc;QACpC,OAAO,MAAuC,CAAC;IACjD,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAAmC,CAAC;IAC7C,CAAC;IACD,iBAAiB,CAAC,MAAc;QAC9B,OAAO,MAAiC,CAAC;IAC3C,CAAC;IACD,sBAAsB,CAAC,MAAc;QACnC,OAAO,MAA+B,CAAC;IACzC,CAAC;IACD,qBAAqB,CAAC,MAAc;QAClC,OAAO,MAA8B,CAAC;IACxC,CAAC;IACD,mBAAmB,CAAC,MAAc;QAChC,OAAO,MAA4C,CAAC;IACtD,CAAC;IACD,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAA2C,C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,EAAE;gBACd,GAAG,MAAM;aACV,CAAC;YAEF,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CACtE,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,qBAAO,CAAC,kBAAkB,EAAE;gBAC3C,MAAM,aAAa,GAAG,CAA+B,CAAC;gBACtD,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,EACzC,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;iBAAM;gBACL,MAAM,KAAK,GAAG,CAAU,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,IAAI,qBAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,eAAe,CACzD,OAAO,CAAC,EAAE,CACX,EACD,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;SACF;IACH,CAAC,CAAC;CACH;AAnKD,4CAmKC"}
@@ -39,4 +39,4 @@ class OutgoingBidiMessage {
39
39
  }
40
40
  }
41
41
  exports.OutgoingBidiMessage = OutgoingBidiMessage;
42
- //# sourceMappingURL=OutgoindBidiMessage.js.map
42
+ //# sourceMappingURL=OutgoingBidiMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OutgoindBidiMessage.js","sourceRoot":"","sources":["../../../src/bidiMapper/OutgoindBidiMessage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,MAAa,mBAAmB;IACrB,QAAQ,CAA0B;IAClC,QAAQ,CAAgB;IAEjC,YACE,OAAgC,EAChC,OAAsB;QAEtB,IAAI,CA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AAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAlCD,kDAkCC"}
@@ -15,15 +15,18 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { BrowsingContext } from '../../../protocol/protocol.js';
18
+ import { BrowsingContextStorage } from './browsingContextStorage.js';
18
19
  import { CdpClient } from '../../CdpConnection.js';
19
20
  import { IEventManager } from '../events/EventManager.js';
20
21
  import { Realm } from '../script/realm.js';
22
+ import { RealmStorage } from '../script/realmStorage.js';
21
23
  export declare class BrowsingContextImpl {
22
24
  #private;
23
25
  private constructor();
24
- static createFrameContext(contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, eventManager: IEventManager): Promise<void>;
25
- static createTargetContext(contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, cdpBrowserContextId: string | null, eventManager: IEventManager): Promise<void>;
26
+ static createFrameContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage): Promise<void>;
27
+ static createTargetContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, cdpBrowserContextId: string | null, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage): Promise<void>;
26
28
  get cdpBrowserContextId(): string | null;
29
+ get navigableId(): string | null;
27
30
  convertFrameToTargetContext(cdpClient: CdpClient, cdpSessionId: string): void;
28
31
  delete(): Promise<void>;
29
32
  get contextId(): string;