chromium-bidi 0.4.3 → 0.4.5

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 +74 -80
  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.js → OutgoingBidiMessage.js} +1 -1
  11. package/lib/cjs/bidiMapper/{OutgoindBidiMessage.js.map → OutgoingBidiMessage.js.map} +1 -1
  12. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.d.ts +6 -2
  13. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js +59 -41
  14. package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js.map +1 -1
  15. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.d.ts +5 -3
  16. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js +49 -39
  17. package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js.map +1 -1
  18. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.d.ts +6 -6
  19. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js +14 -14
  20. package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js.map +1 -1
  21. package/lib/cjs/bidiMapper/domains/events/EventManager.d.ts +6 -6
  22. package/lib/cjs/bidiMapper/domains/events/EventManager.js +48 -35
  23. package/lib/cjs/bidiMapper/domains/events/EventManager.js.map +1 -1
  24. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.d.ts +6 -4
  25. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js +56 -6
  26. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js.map +1 -1
  27. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js +75 -17
  28. package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.spec.js.map +1 -1
  29. package/lib/cjs/bidiMapper/domains/log/logHelper.js +13 -15
  30. package/lib/cjs/bidiMapper/domains/log/logHelper.js.map +1 -1
  31. package/lib/cjs/bidiMapper/domains/log/logHelper_getRemoteValuesText.spec.js.map +1 -1
  32. package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js +12 -12
  33. package/lib/cjs/bidiMapper/domains/log/logHelper_logMessageFormatter.spec.js.map +1 -1
  34. package/lib/cjs/bidiMapper/domains/log/logManager.d.ts +2 -17
  35. package/lib/cjs/bidiMapper/domains/log/logManager.js +37 -39
  36. package/lib/cjs/bidiMapper/domains/log/logManager.js.map +1 -1
  37. package/lib/cjs/bidiMapper/domains/script/realm.d.ts +11 -33
  38. package/lib/cjs/bidiMapper/domains/script/realm.js +97 -75
  39. package/lib/cjs/bidiMapper/domains/script/realm.js.map +1 -1
  40. package/lib/cjs/bidiMapper/domains/script/realmStorage.d.ts +38 -0
  41. package/lib/cjs/bidiMapper/domains/script/realmStorage.js +72 -0
  42. package/lib/cjs/bidiMapper/domains/script/realmStorage.js.map +1 -0
  43. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.d.ts +13 -14
  44. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js +242 -258
  45. package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js.map +1 -1
  46. package/lib/cjs/bidiMapper/tsconfig.tsbuildinfo +1 -1
  47. package/lib/cjs/bidiServer/bidiServerRunner.d.ts +1 -1
  48. package/lib/cjs/bidiServer/bidiServerRunner.js +42 -55
  49. package/lib/cjs/bidiServer/bidiServerRunner.js.map +1 -1
  50. package/lib/cjs/bidiServer/index.js +15 -13
  51. package/lib/cjs/bidiServer/index.js.map +1 -1
  52. package/lib/cjs/bidiServer/mapperServer.d.ts +9 -9
  53. package/lib/cjs/bidiServer/mapperServer.js +26 -26
  54. package/lib/cjs/bidiServer/mapperServer.js.map +1 -1
  55. package/lib/cjs/bidiServer/tsconfig.tsbuildinfo +1 -1
  56. package/lib/cjs/bidiTab/bidiTab.js +32 -32
  57. package/lib/cjs/bidiTab/bidiTab.js.map +1 -1
  58. package/lib/cjs/bidiTab/mapperTabPage.d.ts +2 -10
  59. package/lib/cjs/bidiTab/mapperTabPage.js +67 -53
  60. package/lib/cjs/bidiTab/mapperTabPage.js.map +1 -1
  61. package/lib/cjs/bidiTab/tsconfig.tsbuildinfo +1 -1
  62. package/lib/cjs/cdp/cdpClient.d.ts +5 -5
  63. package/lib/cjs/cdp/cdpClient.js +7 -7
  64. package/lib/cjs/cdp/cdpClient.js.map +1 -1
  65. package/lib/cjs/cdp/cdpClient.spec.js +10 -10
  66. package/lib/cjs/cdp/cdpClient.spec.js.map +1 -1
  67. package/lib/cjs/cdp/cdpConnection.d.ts +3 -3
  68. package/lib/cjs/cdp/cdpConnection.js +12 -10
  69. package/lib/cjs/cdp/cdpConnection.js.map +1 -1
  70. package/lib/cjs/cdp/cdpConnection.spec.js +9 -9
  71. package/lib/cjs/cdp/cdpConnection.spec.js.map +1 -1
  72. package/lib/cjs/cdp/stubTransport.spec.d.ts +2 -2
  73. package/lib/cjs/cdp/stubTransport.spec.js +2 -2
  74. package/lib/cjs/cdp/stubTransport.spec.js.map +1 -1
  75. package/lib/cjs/cdp/tsconfig.tsbuildinfo +1 -1
  76. package/lib/cjs/cdp/websocketTransport.d.ts +3 -3
  77. package/lib/cjs/cdp/websocketTransport.js +11 -11
  78. package/lib/cjs/cdp/websocketTransport.js.map +1 -1
  79. package/lib/cjs/protocol/protocol.d.ts +24 -14
  80. package/lib/cjs/protocol/protocol.js +9 -0
  81. package/lib/cjs/protocol/protocol.js.map +1 -1
  82. package/lib/cjs/protocol/tsconfig.tsbuildinfo +1 -1
  83. package/lib/cjs/protocol-parser/protocol-parser.d.ts +42 -69
  84. package/lib/cjs/protocol-parser/protocol-parser.js +17 -18
  85. package/lib/cjs/protocol-parser/protocol-parser.js.map +1 -1
  86. package/lib/cjs/protocol-parser/tsconfig.tsbuildinfo +1 -1
  87. package/lib/cjs/utils/EventEmitter.d.ts +1 -1
  88. package/lib/cjs/utils/EventEmitter.js +5 -5
  89. package/lib/cjs/utils/EventEmitter.js.map +1 -1
  90. package/lib/cjs/utils/EventEmitter.spec.js +5 -5
  91. package/lib/cjs/utils/EventEmitter.spec.js.map +1 -1
  92. package/lib/cjs/utils/buffer.spec.js +1 -1
  93. package/lib/cjs/utils/buffer.spec.js.map +1 -1
  94. package/lib/cjs/utils/deferred.d.ts +3 -3
  95. package/lib/cjs/utils/deferred.js.map +1 -1
  96. package/lib/cjs/utils/idWrapper.spec.js +4 -4
  97. package/lib/cjs/utils/idWrapper.spec.js.map +1 -1
  98. package/lib/cjs/utils/log.d.ts +2 -3
  99. package/lib/cjs/utils/log.js +2 -14
  100. package/lib/cjs/utils/log.js.map +1 -1
  101. package/lib/cjs/utils/processingQueue.d.ts +18 -1
  102. package/lib/cjs/utils/processingQueue.js +9 -8
  103. package/lib/cjs/utils/processingQueue.js.map +1 -1
  104. package/lib/cjs/utils/processingQueue.spec.js +7 -6
  105. package/lib/cjs/utils/processingQueue.spec.js.map +1 -1
  106. package/lib/cjs/utils/tsconfig.tsbuildinfo +1 -1
  107. package/lib/iife/mapperTab.js +2 -2
  108. package/lib/iife/mapperTab.js.map +1 -1
  109. package/package.json +15 -19
  110. /package/lib/cjs/bidiMapper/{OutgoindBidiMessage.d.ts → OutgoingBidiMessage.d.ts} +0 -0
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,14 @@
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
+ ## CI status
4
+
5
+ ![E2E Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/e2e.yml/badge.svg)
6
+ ![Unit Tests](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/unit.yml/badge.svg)
7
+ ![WPT Tests (chromedriver)](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/wpt-chromedriver.yml/badge.svg)
8
+ ![WPT Tests (mapper)](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/wpt-mapper.yml/badge.svg)
9
+
10
+ ![Generate WPT Report](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/generate-wpt-report.yml/badge.svg)
11
+ ![Pre-commit](https://github.com/GoogleChromeLabs/chromium-bidi/actions/workflows/pre-commit.yml/badge.svg)
6
12
 
7
13
  This is an implementation of the
8
14
  [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) protocol with some
@@ -11,12 +17,11 @@ for Chromium, implemented as a JavaScript layer translating between BiDi and CDP
11
17
  running inside a Chrome tab.
12
18
 
13
19
  Current status can be checked
14
- in [WPT WebDriver BiDi status](https://wpt.fyi/results/webdriver/tests/bidi).
20
+ at [WPT WebDriver BiDi status](https://wpt.fyi/results/webdriver/tests/bidi).
15
21
 
16
22
  ## BiDi+
17
23
 
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:
24
+ **"BiDi+"** is an extension of the WebDriver BiDi protocol. In addition to [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) it has:
20
25
 
21
26
  ### Command `cdp.sendCommand`
22
27
 
@@ -78,7 +83,7 @@ CdpEventReceivedParameters = {
78
83
 
79
84
  The event contains a CDP event.
80
85
 
81
- ## Field `channel`
86
+ ### Field `channel`
82
87
 
83
88
  Each command can be extended with a `channel`:
84
89
 
@@ -125,7 +130,9 @@ Event = {
125
130
  }
126
131
  ```
127
132
 
128
- # Setup
133
+ ## Dev Setup
134
+
135
+ ### `npm`
129
136
 
130
137
  This is a Node.js project, so install dependencies as usual:
131
138
 
@@ -133,7 +140,11 @@ This is a Node.js project, so install dependencies as usual:
133
140
  npm install
134
141
  ```
135
142
 
136
- # Starting the Server
143
+ ### pre-commit.com integration
144
+
145
+ Refer to the documentation at [.pre-commit-config.yaml](.pre-commit-config.yaml).
146
+
147
+ ### Starting the Server
137
148
 
138
149
  This will run the server on port `8080`:
139
150
 
@@ -171,7 +182,7 @@ CHANNEL=chrome-dev npm run server
171
182
  npm run server -- --channel=chrome-dev
172
183
  ```
173
184
 
174
- ## Starting on Linux and Mac
185
+ ### Starting on Linux and Mac
175
186
 
176
187
  TODO: verify if it works on Windows.
177
188
 
@@ -182,20 +193,20 @@ output to the file `log.txt`:
182
193
  ./runBiDiServer.sh --port=8081 --headless=false
183
194
  ```
184
195
 
185
- # Running
196
+ ## Running
186
197
 
187
- ## Unit tests
198
+ ### Unit tests
188
199
 
189
200
  Running:
190
201
 
191
202
  ```sh
192
- npm run unit
203
+ npm test
193
204
  ```
194
205
 
195
- ## e2e tests
206
+ ### E2E tests
196
207
 
197
- The e2e tests are written using Python, in order to learn how to eventually do this
198
- in web-platform-tests.
208
+ The E2E tests are written using Python, in order to learn how to eventually do
209
+ this in web-platform-tests.
199
210
 
200
211
  ### Installation
201
212
 
@@ -207,8 +218,8 @@ python3 -m pip install --user -r tests/requirements.txt
207
218
 
208
219
  ### Running
209
220
 
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:
221
+ The E2E tests require BiDi server running on the same host. By default, tests
222
+ try to connect to the port `8080`. The server can be run from the project root:
212
223
 
213
224
  ```sh
214
225
  npm run e2e
@@ -220,45 +231,17 @@ Use the `PORT` environment variable to connect to another port:
220
231
  PORT=8081 npm run e2e
221
232
  ```
222
233
 
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:
234
+ ### Examples
249
235
 
250
- ```sh
251
- python3 examples/console_log_example.py
252
- python3 examples/script_example.py
253
- ```
236
+ Refer to [examples/README.md](examples/README.md).
254
237
 
255
- ## WPT
238
+ ## WPT (Web Platform Tests)
256
239
 
257
240
  WPT is added as
258
241
  a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules). To get run
259
242
  WPT tests:
260
243
 
261
- ### Check out WPT and setup
244
+ ### Check out and setup WPT
262
245
 
263
246
  #### 1. Check out WPT
264
247
 
@@ -284,13 +267,13 @@ Follow
284
267
  the [`hosts` File Setup](https://web-platform-tests.org/running-tests/from-local-system.html#hosts-file-setup)
285
268
  instructions.
286
269
 
287
- ##### On Linux, macOS or other UNIX-like system
270
+ ##### 4.a On Linux, macOS or other UNIX-like system
288
271
 
289
272
  ```sh
290
273
  ./wpt make-hosts-file | sudo tee -a /etc/hosts
291
274
  ```
292
275
 
293
- ##### And on **Windows**
276
+ ##### 4.b On **Windows**
294
277
 
295
278
  This must be run in a PowerShell session with Administrator privileges:
296
279
 
@@ -301,34 +284,52 @@ python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts
301
284
  If you are behind a proxy, you also need to make sure the domains above are excluded
302
285
  from your proxy lookups.
303
286
 
304
- #### 5. Set the `WPT_BROWSER_PATH` environment variable to a Chrome, Edge or Chromium binary to launch. For example, on macOS:
287
+ #### 5. Set `WPT_BROWSER_PATH`
288
+
289
+ Set the `WPT_BROWSER_PATH` environment variable to a Chrome, Edge or Chromium binary to launch.
290
+ For example, on macOS:
305
291
 
306
292
  ```sh
293
+ # Chrome
307
294
  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"
295
+ export WPT_BROWSER_PATH="/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev"
296
+ export WPT_BROWSER_PATH="/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"
297
+ export WPT_BROWSER_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
309
298
  export WPT_BROWSER_PATH="/Applications/Chromium.app/Contents/MacOS/Chromium"
299
+
300
+ # Edge
301
+ export WPT_BROWSER_PATH="/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary"
302
+ export WPT_BROWSER_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
310
303
  ```
311
304
 
312
305
  ### Run WPT tests
313
306
 
314
- #### 1. Make sure you have Chrome Dev instaled
307
+ #### 1. Make sure you have Chrome Dev installed
315
308
 
316
309
  https://www.google.com/chrome/dev/
317
310
 
318
- #### 1. Build ChromeDriver BiDi
311
+ #### 2. Build Chromedriver BiDi
312
+
313
+ Oneshot:
319
314
 
320
315
  ```sh
321
316
  npm run build
322
317
  ```
323
318
 
324
- #### 2. Run
319
+ Continuously:
320
+
321
+ ```sh
322
+ npm run watch
323
+ ```
324
+
325
+ #### 3. Run
325
326
 
326
327
  ```sh
327
328
  ./wpt/wpt run \
328
- --webdriver-binary ./runBiDiServer.sh \
329
+ --webdriver-binary runBiDiServer.sh \
329
330
  --binary "$WPT_BROWSER_PATH" \
330
- --manifest ./wpt/MANIFEST.json \
331
- --metadata ./wpt-metadata \
331
+ --manifest wpt/MANIFEST.json \
332
+ --metadata wpt-metadata/mapper/headless \
332
333
  chromium \
333
334
  webdriver/tests/bidi/
334
335
  ```
@@ -339,10 +340,10 @@ npm run build
339
340
 
340
341
  ```sh
341
342
  ./wpt/wpt run \
342
- --webdriver-binary ./runBiDiServer.sh \
343
+ --webdriver-binary runBiDiServer.sh \
343
344
  --binary "$WPT_BROWSER_PATH" \
344
- --manifest ./wpt/MANIFEST.json \
345
- --metadata ./wpt-metadata \
345
+ --manifest wpt/MANIFEST.json \
346
+ --metadata wpt-metadata/mapper/headless \
346
347
  --log-wptreport wptreport.json \
347
348
  chromium \
348
349
  webdriver/tests/bidi/
@@ -353,12 +354,12 @@ npm run build
353
354
  ```sh
354
355
  ./wpt/wpt update-expectations \
355
356
  --product chromium \
356
- --manifest ./wpt/MANIFEST.json \
357
- --metadata ./wpt-metadata \
358
- ./wptreport.json
357
+ --manifest wpt/MANIFEST.json \
358
+ --metadata wpt-metadata/mapper/headless \
359
+ wptreport.json
359
360
  ```
360
361
 
361
- # How does it work?
362
+ ## How does it work?
362
363
 
363
364
  The architecture is described in the
364
365
  [WebDriver BiDi in Chrome Context implementation plan](https://docs.google.com/document/d/1VfQ9tv0wPSnb5TI-MOobjoQ5CXLnJJx9F_PxOMQc8kY)
@@ -371,27 +372,20 @@ There are 2 main modules:
371
372
  2. front-end BiDi Mapper in `src/bidiMapper`. Gets BiDi commands from the backend,
372
373
  and map them to CDP commands.
373
374
 
374
- ## Contributing
375
+ ### Contributing
375
376
 
376
377
  The BiDi commands are processed in the `src/bidiMapper/commandProcessor.ts`. To add a
377
378
  new command, add it to `_processCommand`, write and call processor for it.
378
379
 
379
- ## Publish new `npm` release
380
+ ### Publish new `npm` release
380
381
 
381
- 1. On the `main` branch, bump the chromium-bidi version number in `package.json`:
382
+ 1. Open a PR bumping the chromium-bidi version number in `package.json` for review:
382
383
 
383
384
  ```sh
384
- npm version patch -m 'Release v%s'
385
+ npm version patch -m 'Release v%s' --no-git-tag-version
385
386
  ```
386
387
 
387
388
  Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
388
389
 
389
- Note that this produces a Git commit + tag.
390
-
391
- 1. Push the release commit and tag:
392
-
393
- ```sh
394
- git push && git push --tags
395
- ```
396
-
397
- Our CI then automatically publishes the new release to npm.
390
+ 1. After the PR is reviewed, [create a GitHub release](https://github.com/GoogleChromeLabs/chromium-bidi/releases/new) specifying the tag name matching the bumped version.
391
+ Our CI then automatically publishes the new release to npm based on the tag name.
@@ -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/bid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the specific language 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,MAA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,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;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,MAA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CAAC,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,IAA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pE,CAAC;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,19 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { BrowsingContext } from '../../../protocol/protocol.js';
18
+ import { LoggerFn } from '../../../utils/log.js';
19
+ import { BrowsingContextStorage } from './browsingContextStorage.js';
18
20
  import { CdpClient } from '../../CdpConnection.js';
19
21
  import { IEventManager } from '../events/EventManager.js';
20
22
  import { Realm } from '../script/realm.js';
23
+ import { RealmStorage } from '../script/realmStorage.js';
21
24
  export declare class BrowsingContextImpl {
22
25
  #private;
23
26
  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>;
27
+ static createFrameContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn): Promise<void>;
28
+ static createTargetContext(realmStorage: RealmStorage, contextId: string, parentId: string | null, cdpClient: CdpClient, cdpSessionId: string, cdpBrowserContextId: string | null, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn): Promise<void>;
26
29
  get cdpBrowserContextId(): string | null;
30
+ get navigableId(): string | null;
27
31
  convertFrameToTargetContext(cdpClient: CdpClient, cdpSessionId: string): void;
28
32
  delete(): Promise<void>;
29
33
  get contextId(): string;