chromium-bidi 0.4.7 → 0.4.9
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.
- package/README.md +14 -15
- package/lib/cjs/bidiMapper/BidiServer.d.ts +1 -1
- package/lib/cjs/bidiMapper/BidiServer.js +5 -2
- package/lib/cjs/bidiMapper/BidiServer.js.map +1 -1
- package/lib/cjs/bidiMapper/CdpConnection.d.ts +1 -1
- package/lib/cjs/bidiMapper/CommandProcessor.d.ts +2 -2
- package/lib/cjs/bidiMapper/CommandProcessor.js +5 -3
- package/lib/cjs/bidiMapper/CommandProcessor.js.map +1 -1
- package/lib/cjs/bidiMapper/bidiMapper.d.ts +2 -2
- package/lib/cjs/bidiMapper/bidiMapper.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.d.ts +69 -0
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.js +111 -0
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.spec.d.ts +1 -0
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.spec.js +48 -0
- package/lib/cjs/bidiMapper/domains/context/PreloadScriptStorage.spec.js.map +1 -0
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.d.ts +11 -8
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js +64 -65
- package/lib/cjs/bidiMapper/domains/context/browsingContextImpl.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.d.ts +4 -4
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js +59 -49
- package/lib/cjs/bidiMapper/domains/context/browsingContextProcessor.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.d.ts +10 -6
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js +28 -19
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.spec.js +2 -2
- package/lib/cjs/bidiMapper/domains/context/browsingContextStorage.spec.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/context/cdpTarget.d.ts +22 -8
- package/lib/cjs/bidiMapper/domains/context/cdpTarget.js +84 -52
- package/lib/cjs/bidiMapper/domains/context/cdpTarget.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/events/EventManager.d.ts +4 -4
- package/lib/cjs/bidiMapper/domains/events/EventManager.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.d.ts +5 -5
- package/lib/cjs/bidiMapper/domains/events/SubscriptionManager.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/log/logManager.d.ts +1 -1
- package/lib/cjs/bidiMapper/domains/network/networkProcessor.d.ts +2 -2
- package/lib/cjs/bidiMapper/domains/network/networkProcessor.js +3 -3
- package/lib/cjs/bidiMapper/domains/network/networkProcessor.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/network/networkRequest.d.ts +1 -1
- package/lib/cjs/bidiMapper/domains/network/networkRequest.js +23 -14
- package/lib/cjs/bidiMapper/domains/network/networkRequest.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/script/realm.d.ts +4 -3
- package/lib/cjs/bidiMapper/domains/script/realm.js +14 -8
- package/lib/cjs/bidiMapper/domains/script/realm.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/script/realmStorage.d.ts +5 -1
- package/lib/cjs/bidiMapper/domains/script/realmStorage.js +5 -1
- package/lib/cjs/bidiMapper/domains/script/realmStorage.js.map +1 -1
- package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js +4 -4
- package/lib/cjs/bidiMapper/domains/script/scriptEvaluator.js.map +1 -1
- package/lib/cjs/bidiMapper/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/bidiServer/bidiServerRunner.js +2 -2
- package/lib/cjs/bidiServer/bidiServerRunner.js.map +1 -1
- package/lib/cjs/bidiServer/index.js +8 -6
- package/lib/cjs/bidiServer/index.js.map +1 -1
- package/lib/cjs/bidiServer/mapperServer.js +8 -3
- package/lib/cjs/bidiServer/mapperServer.js.map +1 -1
- package/lib/cjs/bidiServer/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/bidiTab/bidiTab.js +3 -3
- package/lib/cjs/bidiTab/bidiTab.js.map +1 -1
- package/lib/cjs/bidiTab/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/cdp/cdpClient.d.ts +1 -1
- package/lib/cjs/cdp/cdpClient.spec.js +1 -0
- package/lib/cjs/cdp/cdpClient.spec.js.map +1 -1
- package/lib/cjs/cdp/cdpConnection.js +12 -4
- package/lib/cjs/cdp/cdpConnection.js.map +1 -1
- package/lib/cjs/cdp/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/protocol/protocol.d.ts +73 -65
- package/lib/cjs/protocol/protocol.js.map +1 -1
- package/lib/cjs/protocol/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/protocol-parser/protocol-parser.d.ts +74 -25
- package/lib/cjs/protocol-parser/protocol-parser.js +23 -21
- package/lib/cjs/protocol-parser/protocol-parser.js.map +1 -1
- package/lib/cjs/protocol-parser/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/idWrapper.js.map +1 -1
- package/lib/cjs/utils/log.d.ts +1 -1
- package/lib/cjs/utils/processingQueue.d.ts +1 -1
- package/lib/cjs/utils/processingQueue.js +1 -4
- package/lib/cjs/utils/processingQueue.js.map +1 -1
- package/lib/cjs/utils/processingQueue.spec.js +3 -3
- package/lib/cjs/utils/processingQueue.spec.js.map +1 -1
- package/lib/cjs/utils/transportStub.spec.d.ts +1 -1
- package/lib/cjs/utils/tsconfig.tsbuildinfo +1 -1
- package/lib/iife/mapperTab.js +2 -2
- package/lib/iife/mapperTab.js.map +1 -1
- package/package.json +144 -37
package/README.md
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
|
7
|
-

|
|
7
|
+

|
|
9
8
|
|
|
10
9
|

|
|
11
10
|

|
|
@@ -196,7 +195,7 @@ DEBUG=* npm run server -- --verbose
|
|
|
196
195
|
|
|
197
196
|
### Starting on Linux and Mac
|
|
198
197
|
|
|
199
|
-
TODO: verify
|
|
198
|
+
TODO: verify it works on Windows.
|
|
200
199
|
|
|
201
200
|
You can also run the server by using script `./runBiDiServer.sh`. It will write
|
|
202
201
|
output to the file `log.txt`:
|
|
@@ -296,22 +295,22 @@ python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts
|
|
|
296
295
|
If you are behind a proxy, you also need to make sure the domains above are excluded
|
|
297
296
|
from your proxy lookups.
|
|
298
297
|
|
|
299
|
-
#### 5. Set `
|
|
298
|
+
#### 5. Set `BROWSER_BIN`
|
|
300
299
|
|
|
301
|
-
Set the `
|
|
300
|
+
Set the `BROWSER_BIN` environment variable to a Chrome, Edge or Chromium binary to launch.
|
|
302
301
|
For example, on macOS:
|
|
303
302
|
|
|
304
303
|
```sh
|
|
305
304
|
# Chrome
|
|
306
|
-
export
|
|
307
|
-
export
|
|
308
|
-
export
|
|
309
|
-
export
|
|
310
|
-
export
|
|
305
|
+
export BROWSER_BIN="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
|
|
306
|
+
export BROWSER_BIN="/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev"
|
|
307
|
+
export BROWSER_BIN="/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"
|
|
308
|
+
export BROWSER_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
309
|
+
export BROWSER_BIN="/Applications/Chromium.app/Contents/MacOS/Chromium"
|
|
311
310
|
|
|
312
311
|
# Edge
|
|
313
|
-
export
|
|
314
|
-
export
|
|
312
|
+
export BROWSER_BIN="/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary"
|
|
313
|
+
export BROWSER_BIN="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
|
|
315
314
|
```
|
|
316
315
|
|
|
317
316
|
### Run WPT tests
|
|
@@ -331,7 +330,7 @@ npm run build
|
|
|
331
330
|
Continuously:
|
|
332
331
|
|
|
333
332
|
```sh
|
|
334
|
-
npm run watch
|
|
333
|
+
npm run build --watch
|
|
335
334
|
```
|
|
336
335
|
|
|
337
336
|
#### 3. Run
|
|
@@ -339,7 +338,7 @@ npm run watch
|
|
|
339
338
|
```sh
|
|
340
339
|
./wpt/wpt run \
|
|
341
340
|
--webdriver-binary runBiDiServer.sh \
|
|
342
|
-
--binary "$
|
|
341
|
+
--binary "$BROWSER_BIN" \
|
|
343
342
|
--manifest wpt/MANIFEST.json \
|
|
344
343
|
--metadata wpt-metadata/mapper/headless \
|
|
345
344
|
chromium \
|
|
@@ -353,7 +352,7 @@ npm run watch
|
|
|
353
352
|
```sh
|
|
354
353
|
./wpt/wpt run \
|
|
355
354
|
--webdriver-binary runBiDiServer.sh \
|
|
356
|
-
--binary "$
|
|
355
|
+
--binary "$BROWSER_BIN" \
|
|
357
356
|
--manifest wpt/MANIFEST.json \
|
|
358
357
|
--metadata wpt-metadata/mapper/headless \
|
|
359
358
|
--log-wptreport wptreport.json \
|
|
@@ -22,7 +22,7 @@ import { BidiTransport } from './BidiTransport.js';
|
|
|
22
22
|
import { BrowsingContextStorage } from './domains/context/browsingContextStorage.js';
|
|
23
23
|
import { CdpConnection } from './CdpConnection.js';
|
|
24
24
|
import { OutgoingBidiMessage } from './OutgoingBidiMessage.js';
|
|
25
|
-
|
|
25
|
+
type BidiServerEvents = {
|
|
26
26
|
message: Message.RawCommandRequest;
|
|
27
27
|
};
|
|
28
28
|
export declare class BidiServer extends EventEmitter<BidiServerEvents> {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.BidiServer = void 0;
|
|
20
20
|
const EventEmitter_js_1 = require("../utils/EventEmitter.js");
|
|
21
|
+
const log_js_1 = require("../utils/log.js");
|
|
21
22
|
const processingQueue_js_1 = require("../utils/processingQueue.js");
|
|
22
23
|
const CommandProcessor_js_1 = require("./CommandProcessor.js");
|
|
23
24
|
const browsingContextStorage_js_1 = require("./domains/context/browsingContextStorage.js");
|
|
@@ -31,7 +32,9 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
|
|
|
31
32
|
#realmStorage;
|
|
32
33
|
#logger;
|
|
33
34
|
#handleIncomingMessage = (message) => {
|
|
34
|
-
this.#commandProcessor.processCommand(message)
|
|
35
|
+
void this.#commandProcessor.processCommand(message).catch((error) => {
|
|
36
|
+
this.#logger?.(log_js_1.LogType.system, error);
|
|
37
|
+
});
|
|
35
38
|
};
|
|
36
39
|
#processOutgoingMessage = async (messageEntry) => {
|
|
37
40
|
const message = messageEntry.message;
|
|
@@ -45,7 +48,7 @@ class BidiServer extends EventEmitter_js_1.EventEmitter {
|
|
|
45
48
|
this.#logger = logger;
|
|
46
49
|
this.#browsingContextStorage = new browsingContextStorage_js_1.BrowsingContextStorage();
|
|
47
50
|
this.#realmStorage = new realmStorage_js_1.RealmStorage();
|
|
48
|
-
this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage,
|
|
51
|
+
this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage, this.#logger);
|
|
49
52
|
this.#transport = bidiTransport;
|
|
50
53
|
this.#transport.setOnMessage(this.#handleIncomingMessage);
|
|
51
54
|
this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(this.#realmStorage, cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser, this.#browsingContextStorage, this.#logger);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BidiServer.js","sourceRoot":"","sources":["../../../src/bidiMapper/BidiServer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,8DAAsD;
|
|
1
|
+
{"version":3,"file":"BidiServer.js","sourceRoot":"","sources":["../../../src/bid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ACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAC/B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,YAA0C;QAC5D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,yBAAyB;QACvB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;CACF;AA9GD,gCA8GC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import type { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js';
|
|
21
21
|
import { EventEmitter } from '../utils/EventEmitter.js';
|
|
22
|
-
|
|
22
|
+
type CdpEvents = {
|
|
23
23
|
[Property in keyof ProtocolMapping.Events]: ProtocolMapping.Events[Property][0];
|
|
24
24
|
};
|
|
25
25
|
export interface CdpConnection {
|
|
@@ -22,7 +22,7 @@ import { CdpConnection } from './CdpConnection.js';
|
|
|
22
22
|
import { IEventManager } from './domains/events/EventManager.js';
|
|
23
23
|
import { OutgoingBidiMessage } from './OutgoingBidiMessage.js';
|
|
24
24
|
import { RealmStorage } from './domains/script/realmStorage.js';
|
|
25
|
-
|
|
25
|
+
type CommandProcessorEvents = {
|
|
26
26
|
response: Promise<OutgoingBidiMessage>;
|
|
27
27
|
};
|
|
28
28
|
export interface BidiParser {
|
|
@@ -34,7 +34,7 @@ export interface BidiParser {
|
|
|
34
34
|
parseDisownParams(params: object): Script.DisownParameters;
|
|
35
35
|
parseSendCommandParams(params: object): CDP.SendCommandParams;
|
|
36
36
|
parseGetSessionParams(params: object): CDP.GetSessionParams;
|
|
37
|
-
parseSubscribeParams(params: object): Session.
|
|
37
|
+
parseSubscribeParams(params: object): Session.SubscriptionRequest;
|
|
38
38
|
parseNavigateParams(params: object): BrowsingContext.NavigateParameters;
|
|
39
39
|
parseGetTreeParams(params: object): BrowsingContext.GetTreeParameters;
|
|
40
40
|
parseCreateParams(params: object): BrowsingContext.CreateParameters;
|
|
@@ -128,9 +128,11 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
|
|
128
128
|
return this.#contextProcessor.process_cdp_sendCommand(this.#parser.parseSendCommandParams(commandData.params));
|
|
129
129
|
case 'cdp.getSession':
|
|
130
130
|
return this.#contextProcessor.process_cdp_getSession(this.#parser.parseGetSessionParams(commandData.params));
|
|
131
|
-
default:
|
|
132
|
-
throw new protocol_js_1.Message.UnknownCommandException(`Unknown command '${commandData.method}'.`);
|
|
133
131
|
}
|
|
132
|
+
// Intentionally kept outside of the switch statement to ensure that
|
|
133
|
+
// ESLint @typescript-eslint/switch-exhaustiveness-check triggers if a new
|
|
134
|
+
// command is added.
|
|
135
|
+
throw new protocol_js_1.Message.UnknownCommandException(`Unknown command '${commandData.method}'.`);
|
|
134
136
|
}
|
|
135
137
|
async processCommand(command) {
|
|
136
138
|
try {
|
|
@@ -149,7 +151,7 @@ class CommandProcessor extends EventEmitter_js_1.EventEmitter {
|
|
|
149
151
|
else {
|
|
150
152
|
const error = e;
|
|
151
153
|
this.#logger?.(log_js_1.LogType.bidi, error);
|
|
152
|
-
this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.
|
|
154
|
+
this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.UnknownErrorException(error.message).toErrorResponse(command.id), command.channel ?? null));
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandProcessor.js","sourceRoot":"","sources":["../../../src/bidiMapper/CommandProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAMiC;AACjC,4CAAkD;AAClD,8DAAsD;AAEtD,+FAAuF;AAIvF,qEA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AAc,CAAC,OAAkC;QACrD,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAEnD,MAAM,QAAQ,GAAG;gBACf,EAAE,EAAE,OAAO,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,aAAa,EAAE;gBACtC,MAAM,aAAa,GAAG,CAAC,CAAC;gBACxB,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,IAAI,CAAC,OAAO,EAAE,CAAC,gBAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACpC,IAAI,CAAC,IAAI,CACP,UAAU,EACV,4CAAmB,CAAC,cAAc,CAChC,IAAI,qBAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,eAAe,CAC9D,OAAO,CAAC,EAAE,CACX,EACD,OAAO,CAAC,OAAO,IAAI,IAAI,CACxB,CACF,CAAC;aACH;SACF;IACH,CAAC;CACF;AApLD,4CAoLC"}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
|
-
* The entry point to the BiDi Mapper namespace.
|
|
18
|
+
* @fileoverview The entry point to the BiDi Mapper namespace.
|
|
19
19
|
* Other modules should only access exports defined in this file.
|
|
20
|
-
*
|
|
20
|
+
* XXX: eslint rule for this.
|
|
21
21
|
*/
|
|
22
22
|
export { CdpConnection, CdpClient } from './CdpConnection.js';
|
|
23
23
|
export { BidiServer } from './BidiServer.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bidiMapper.js","sourceRoot":"","sources":["../../../src/bidiMapper/bidiMapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;
|
|
1
|
+
{"version":3,"file":"bidiMapper.js","sourceRoot":"","sources":["../../../src/bidiMapper/bidiMapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAQH,iDAA2C;AAAnC,2GAAA,UAAU,OAAA;AAElB,4DAAsD;AAA9C,+GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CommonDataTypes, Script } from '../../../protocol/protocol.js';
|
|
2
|
+
import { CdpTarget } from './cdpTarget.js';
|
|
3
|
+
export type BidiPreloadScript = {
|
|
4
|
+
/** BiDi ID, an automatically generated UUID. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** CDP preload scripts. */
|
|
7
|
+
cdpPreloadScripts: CdpPreloadScript[];
|
|
8
|
+
/** The script itself, in a format expected by the spec i.e. a function. */
|
|
9
|
+
functionDeclaration: string;
|
|
10
|
+
/** The script sandbox / world name. */
|
|
11
|
+
sandbox?: string;
|
|
12
|
+
/** Browsing context ID. */
|
|
13
|
+
contextId: CommonDataTypes.BrowsingContext | null;
|
|
14
|
+
};
|
|
15
|
+
/** BidiPreloadScripts can be filtered by either context ID or BiDi ID. */
|
|
16
|
+
export type BidiPreloadScriptFilter = Partial<Pick<BidiPreloadScript, 'contextId'> & Pick<BidiPreloadScript, 'id'>> & {
|
|
17
|
+
contextIds?: (CommonDataTypes.BrowsingContext | null)[];
|
|
18
|
+
};
|
|
19
|
+
export type CdpPreloadScript = {
|
|
20
|
+
/** CDP target. Includes session ID and target ID. */
|
|
21
|
+
target: CdpTarget;
|
|
22
|
+
/** CDP preload script ID. */
|
|
23
|
+
preloadScriptId: Script.PreloadScript;
|
|
24
|
+
};
|
|
25
|
+
/** CdpPreloadScripts can be filtered by CDP session ID or target ID. */
|
|
26
|
+
export type CdpPreloadScriptFilter = {
|
|
27
|
+
/** CDP session ID. */
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
/** CDP target ID. */
|
|
30
|
+
targetId?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Container class for preload scripts.
|
|
34
|
+
*
|
|
35
|
+
* BiDi IDs are generated by the server and are unique within the context.
|
|
36
|
+
*
|
|
37
|
+
* CDP preload script IDs are generated by the client and are unique
|
|
38
|
+
* within the session.
|
|
39
|
+
*
|
|
40
|
+
* The mapping between BiDi and CDP preload script IDs is 1:many.
|
|
41
|
+
* BiDi IDs are needed by the mapper to keep track of potential multiple CDP IDs
|
|
42
|
+
* in the client.
|
|
43
|
+
*
|
|
44
|
+
* This class does not concern itself with the validity of the IDs.
|
|
45
|
+
*/
|
|
46
|
+
export declare class PreloadScriptStorage {
|
|
47
|
+
#private;
|
|
48
|
+
/** Finds all entries that match the given filter. */
|
|
49
|
+
findPreloadScripts(filter?: BidiPreloadScriptFilter): BidiPreloadScript[];
|
|
50
|
+
/**
|
|
51
|
+
* Keeps track of the given CDP preload scripts associated with the given
|
|
52
|
+
* browsing context ID.
|
|
53
|
+
*
|
|
54
|
+
* @param contextId Browsing context ID, or null for global context.
|
|
55
|
+
* @param cdpPreloadScripts CDP preload scripts.
|
|
56
|
+
* @param functionDeclaration The script itself, in a format expected by the spec
|
|
57
|
+
* i.e. a function.
|
|
58
|
+
*/
|
|
59
|
+
addPreloadScripts(contextId: CommonDataTypes.BrowsingContext | null, cdpPreloadScripts: CdpPreloadScript[], functionDeclaration: string, sandbox?: string): BidiPreloadScript;
|
|
60
|
+
/**
|
|
61
|
+
* Keeps track of the given CDP preload script in the given BiDi preload
|
|
62
|
+
* script.
|
|
63
|
+
*/
|
|
64
|
+
appendCdpPreloadScript(script: BidiPreloadScript, cdpPreloadScript: CdpPreloadScript): void;
|
|
65
|
+
/** Deletes all BiDi preload script entries that match the given filter. */
|
|
66
|
+
removeBiDiPreloadScripts(filter?: BidiPreloadScriptFilter): void;
|
|
67
|
+
/** Deletes all CDP preload script entries that match the given filter. */
|
|
68
|
+
removeCdpPreloadScripts(filter?: CdpPreloadScriptFilter): void;
|
|
69
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreloadScriptStorage = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2023 Google LLC.
|
|
6
|
+
* Copyright (c) Microsoft Corporation.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
const uuid_1 = require("uuid");
|
|
21
|
+
/**
|
|
22
|
+
* Container class for preload scripts.
|
|
23
|
+
*
|
|
24
|
+
* BiDi IDs are generated by the server and are unique within the context.
|
|
25
|
+
*
|
|
26
|
+
* CDP preload script IDs are generated by the client and are unique
|
|
27
|
+
* within the session.
|
|
28
|
+
*
|
|
29
|
+
* The mapping between BiDi and CDP preload script IDs is 1:many.
|
|
30
|
+
* BiDi IDs are needed by the mapper to keep track of potential multiple CDP IDs
|
|
31
|
+
* in the client.
|
|
32
|
+
*
|
|
33
|
+
* This class does not concern itself with the validity of the IDs.
|
|
34
|
+
*/
|
|
35
|
+
class PreloadScriptStorage {
|
|
36
|
+
/** Tracks all BiDi preload scripts. */
|
|
37
|
+
#scripts = new Set();
|
|
38
|
+
/** Finds all entries that match the given filter. */
|
|
39
|
+
findPreloadScripts(filter) {
|
|
40
|
+
if (!filter) {
|
|
41
|
+
return [...this.#scripts];
|
|
42
|
+
}
|
|
43
|
+
return [...this.#scripts].filter((script) => {
|
|
44
|
+
if (filter?.id !== undefined && filter?.id !== script.id) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (filter?.contextId !== undefined &&
|
|
48
|
+
filter?.contextId !== script.contextId) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (filter?.contextIds !== undefined &&
|
|
52
|
+
!filter?.contextIds.includes(script.contextId)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Keeps track of the given CDP preload scripts associated with the given
|
|
60
|
+
* browsing context ID.
|
|
61
|
+
*
|
|
62
|
+
* @param contextId Browsing context ID, or null for global context.
|
|
63
|
+
* @param cdpPreloadScripts CDP preload scripts.
|
|
64
|
+
* @param functionDeclaration The script itself, in a format expected by the spec
|
|
65
|
+
* i.e. a function.
|
|
66
|
+
*/
|
|
67
|
+
addPreloadScripts(contextId, cdpPreloadScripts, functionDeclaration, sandbox) {
|
|
68
|
+
// Generate a random ID.
|
|
69
|
+
const bidiId = (0, uuid_1.v4)();
|
|
70
|
+
const preloadScript = {
|
|
71
|
+
id: bidiId,
|
|
72
|
+
contextId,
|
|
73
|
+
cdpPreloadScripts,
|
|
74
|
+
functionDeclaration,
|
|
75
|
+
sandbox,
|
|
76
|
+
};
|
|
77
|
+
this.#scripts.add(preloadScript);
|
|
78
|
+
return preloadScript;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Keeps track of the given CDP preload script in the given BiDi preload
|
|
82
|
+
* script.
|
|
83
|
+
*/
|
|
84
|
+
appendCdpPreloadScript(script, cdpPreloadScript) {
|
|
85
|
+
script.cdpPreloadScripts.push(cdpPreloadScript);
|
|
86
|
+
}
|
|
87
|
+
/** Deletes all BiDi preload script entries that match the given filter. */
|
|
88
|
+
removeBiDiPreloadScripts(filter) {
|
|
89
|
+
for (const preloadScript of this.findPreloadScripts(filter)) {
|
|
90
|
+
this.#scripts.delete(preloadScript);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Deletes all CDP preload script entries that match the given filter. */
|
|
94
|
+
removeCdpPreloadScripts(filter) {
|
|
95
|
+
for (const preloadScript of this.#scripts) {
|
|
96
|
+
preloadScript.cdpPreloadScripts = preloadScript.cdpPreloadScripts.filter((cdpPreloadScript) => {
|
|
97
|
+
if (filter?.targetId !== undefined &&
|
|
98
|
+
filter?.targetId !== cdpPreloadScript.target.targetId) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
if (filter?.sessionId !== undefined &&
|
|
102
|
+
filter?.sessionId !== cdpPreloadScript.target.cdpSessionId) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.PreloadScriptStorage = PreloadScriptStorage;
|
|
111
|
+
//# sourceMappingURL=PreloadScriptStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreloadScriptStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/context/PreloadScriptStorage.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,+BAAkC;AAuClC;;;;;;;;;;;;;GAaG;AACH,MAAa,oBAAoB;IAC/B,wCAAwC;IAC/B,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEjD,qDAAqD;IACrD,kBAAkB,CAAC,MAAgC;QACjD,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,GAAG,IAA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CAAC,aAAa,CAAC,CAAC;SACrC;IACH,CAAC;IAED,0EAA0E;IAC1E,uBAAuB,CAAC,MAA+B;QACrD,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,QAAQ,EAAE;YACzC,aAAa,CAAC,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC,MAAM,CACtE,CAAC,gBAAgB,EAAE,EAAE;gBACnB,IACE,MAAM,EAAE,QAAQ,KAAK,SAAS;oBAC9B,MAAM,EAAE,QAAQ,KAAK,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EACrD;oBACA,OAAO,IAAI,CAAC;iBACb;gBACD,IACE,MAAM,EAAE,SAAS,KAAK,SAAS;oBAC/B,MAAM,EAAE,SAAS,KAAK,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAC1D;oBACA,OAAO,IAAI,CAAC;iBACb;gBACD,OAAO,KAAK,CAAC;YACf,CAAC,CACF,CAAC;SACH;IACH,CAAC;CACF;AArGD,oDAqGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/**
|
|
7
|
+
* Copyright 2023 Google LLC.
|
|
8
|
+
* Copyright (c) Microsoft Corporation.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const sinon_1 = __importDefault(require("sinon"));
|
|
24
|
+
const PreloadScriptStorage_1 = require("./PreloadScriptStorage");
|
|
25
|
+
// TODO: expand unit tests.
|
|
26
|
+
describe('PreloadScriptStorage', () => {
|
|
27
|
+
let preloadScriptStorage;
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
preloadScriptStorage = new PreloadScriptStorage_1.PreloadScriptStorage();
|
|
30
|
+
});
|
|
31
|
+
it('initial state', () => {
|
|
32
|
+
(0, chai_1.expect)(preloadScriptStorage.findPreloadScripts()).to.be.empty;
|
|
33
|
+
(0, chai_1.expect)(preloadScriptStorage.findPreloadScripts({})).to.be.empty;
|
|
34
|
+
(0, chai_1.expect)(preloadScriptStorage.findPreloadScripts({
|
|
35
|
+
id: '',
|
|
36
|
+
})).to.be.empty;
|
|
37
|
+
(0, chai_1.expect)(preloadScriptStorage.findPreloadScripts({
|
|
38
|
+
contextId: null,
|
|
39
|
+
})).to.be.empty;
|
|
40
|
+
(0, chai_1.expect)(preloadScriptStorage.findPreloadScripts({
|
|
41
|
+
contextId: '',
|
|
42
|
+
})).to.be.empty;
|
|
43
|
+
});
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
sinon_1.default.restore();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=PreloadScriptStorage.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreloadScriptStorage.spec.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/domains/context/PreloadScriptStorage.spec.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,+BAA4B;AAC5B,kDAA0B;AAE1B,iEAA4D;AAE5D,2BAA2B;AAC3B,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,oBAA0C,CAAC;IAE/C,UAAU,CAAC,GAAG,EAAE;QACd,oBAAoB,GAAG,IAAI,2CAAoB,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,IAAA,aAAM,EAAC,oBAAoB,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC9D,IAAA,aAAM,EAAC,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAChE,IAAA,aAAM,EACJ,oBAAoB,CAAC,kBAAkB,CAAC;YACtC,EAAE,EAAE,EAAE;SACP,CAAC,CACH,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACd,IAAA,aAAM,EACJ,oBAAoB,CAAC,kBAAkB,CAAC;YACtC,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACd,IAAA,aAAM,EACJ,oBAAoB,CAAC,kBAAkB,CAAC;YACtC,SAAS,EAAE,EAAE;SACd,CAAC,CACH,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,eAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -14,34 +14,38 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { BrowsingContext, CommonDataTypes
|
|
17
|
+
import { BrowsingContext, CommonDataTypes } from '../../../protocol/protocol.js';
|
|
18
18
|
import { LoggerFn } from '../../../utils/log.js';
|
|
19
19
|
import { IEventManager } from '../events/EventManager.js';
|
|
20
20
|
import { Realm } from '../script/realm.js';
|
|
21
21
|
import { RealmStorage } from '../script/realmStorage.js';
|
|
22
22
|
import { BrowsingContextStorage } from './browsingContextStorage.js';
|
|
23
|
-
import { CdpTarget } from './cdpTarget';
|
|
23
|
+
import { CdpTarget } from './cdpTarget.js';
|
|
24
24
|
export declare class BrowsingContextImpl {
|
|
25
25
|
#private;
|
|
26
26
|
private constructor();
|
|
27
|
-
static create(cdpTarget: CdpTarget, realmStorage: RealmStorage,
|
|
27
|
+
static create(cdpTarget: CdpTarget, realmStorage: RealmStorage, id: CommonDataTypes.BrowsingContext, parentId: CommonDataTypes.BrowsingContext | null, eventManager: IEventManager, browsingContextStorage: BrowsingContextStorage, logger?: LoggerFn): BrowsingContextImpl;
|
|
28
28
|
/**
|
|
29
29
|
* @see https://html.spec.whatwg.org/multipage/document-sequences.html#navigable
|
|
30
30
|
*/
|
|
31
31
|
get navigableId(): string | null;
|
|
32
32
|
delete(): void;
|
|
33
33
|
/** Returns the ID of this context. */
|
|
34
|
-
get
|
|
34
|
+
get id(): CommonDataTypes.BrowsingContext;
|
|
35
35
|
/** Returns the parent context ID. */
|
|
36
36
|
get parentId(): CommonDataTypes.BrowsingContext | null;
|
|
37
|
-
/** Returns
|
|
38
|
-
get
|
|
37
|
+
/** Returns the parent context. */
|
|
38
|
+
get parent(): BrowsingContextImpl | null;
|
|
39
|
+
/** Returns all direct children contexts. */
|
|
40
|
+
get directChildren(): BrowsingContextImpl[];
|
|
41
|
+
/** Returns all children contexts, flattened. */
|
|
42
|
+
get allChildren(): BrowsingContextImpl[];
|
|
39
43
|
/**
|
|
40
44
|
* Returns true if this is a top-level context.
|
|
41
45
|
* This is the case whenever the parent context ID is null.
|
|
42
46
|
*/
|
|
43
47
|
isTopLevelContext(): boolean;
|
|
44
|
-
addChild(
|
|
48
|
+
addChild(childId: CommonDataTypes.BrowsingContext): void;
|
|
45
49
|
get cdpTarget(): CdpTarget;
|
|
46
50
|
updateCdpTarget(cdpTarget: CdpTarget): void;
|
|
47
51
|
get url(): string;
|
|
@@ -52,5 +56,4 @@ export declare class BrowsingContextImpl {
|
|
|
52
56
|
navigate(url: string, wait: BrowsingContext.ReadinessState): Promise<BrowsingContext.NavigateResult>;
|
|
53
57
|
captureScreenshot(): Promise<BrowsingContext.CaptureScreenshotResult>;
|
|
54
58
|
print(params: BrowsingContext.PrintParameters): Promise<BrowsingContext.PrintResult>;
|
|
55
|
-
addPreloadScript(params: Script.AddPreloadScriptParameters): Promise<Script.AddPreloadScriptResult>;
|
|
56
59
|
}
|