chromium-bidi 7.3.0 → 7.3.2
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/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js +1 -1
- package/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js.map +1 -1
- package/lib/cjs/bidiMapper/modules/browser/ContextConfig.d.ts +9 -1
- package/lib/cjs/bidiMapper/modules/browser/ContextConfig.js +23 -1
- package/lib/cjs/bidiMapper/modules/browser/ContextConfig.js.map +1 -1
- package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.d.ts +35 -12
- package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.js +40 -32
- package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.js.map +1 -1
- package/lib/cjs/protocol/generated/webdriver-bidi.d.ts +1 -1
- package/lib/cjs/protocol-parser/generated/webdriver-bidi.js +1 -1
- package/lib/cjs/protocol-parser/generated/webdriver-bidi.js.map +1 -1
- package/lib/esm/bidiMapper/modules/browser/BrowserProcessor.js +1 -1
- package/lib/esm/bidiMapper/modules/browser/BrowserProcessor.js.map +1 -1
- package/lib/esm/bidiMapper/modules/browser/ContextConfig.d.ts +9 -1
- package/lib/esm/bidiMapper/modules/browser/ContextConfig.js +23 -1
- package/lib/esm/bidiMapper/modules/browser/ContextConfig.js.map +1 -1
- package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.d.ts +35 -12
- package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.js +40 -32
- package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.js.map +1 -1
- package/lib/esm/protocol/generated/webdriver-bidi.d.ts +1 -1
- package/lib/esm/protocol-parser/generated/webdriver-bidi.js +1 -1
- package/lib/esm/protocol-parser/generated/webdriver-bidi.js.map +1 -1
- package/lib/iife/mapperTab.js +24 -34
- package/lib/iife/mapperTab.js.map +1 -1
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ class BrowserProcessor {
|
|
|
43
43
|
// `Browser.CreateUserContextParameters`.
|
|
44
44
|
const w3cParams = params;
|
|
45
45
|
if (w3cParams.acceptInsecureCerts !== undefined) {
|
|
46
|
-
const globalConfig = this.#configStorage.
|
|
46
|
+
const globalConfig = this.#configStorage.getGlobalConfig();
|
|
47
47
|
if (w3cParams.acceptInsecureCerts === false &&
|
|
48
48
|
globalConfig.acceptInsecureCerts === true)
|
|
49
49
|
// TODO: https://github.com/GoogleChromeLabs/chromium-bidi/issues/3398
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/BrowserProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;
|
|
1
|
+
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/BrowserProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAmLH,kCA6EC;AA5PD,+DAQuC;AAOvC,MAAa,gBAAgB;IAClB,iBAAiB,CAAY;IAC7B,uBAAuB,CAAyB;IAChD,cAAc,CAAuB;IACrC,mBAAmB,CAAqB;IAEjD,YACE,gBAA2B,EAC3B,sBAA8C,EAC9C,aAAmC,EACnC,kBAAsC;QAEtC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,uBAAuB,GAAG,sBAAsB,CAAC;QACtD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;IAChD,CAAC;IAED,KAAK;QACH,sDAAsD;QACtD,6DAA6D;QAC7D,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,M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W,CAAC,YAAY,GAAG,CAAC;gBAC5B,WAAW,CAAC,YAAY,GAAG,GAAG,EAC9B,CAAC;gBACD,MAAM,IAAI,sCAAwB,CAChC,0CAA0C,CAC3C,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,IAAI,CACV,cAAc,WAAW,CAAC,YAAY,MAAM,WAAW,CAAC,UAAU,EAAE,CACrE,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,mFAAmF;YACnF,+DAA+D;YAC/D,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IACD,eAAe;IACf,MAAM,IAAI,mCAAqB,CAAC,oBAAoB,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -18,7 +18,8 @@ import type { Protocol } from 'devtools-protocol';
|
|
|
18
18
|
import type { BrowsingContext, Emulation, Session } from '../../../protocol/protocol.js';
|
|
19
19
|
/**
|
|
20
20
|
* Represents a context configurations. It can be global, per User Context, or per
|
|
21
|
-
* Browsing Context.
|
|
21
|
+
* Browsing Context. The undefined value means the config will be taken from the upstream
|
|
22
|
+
* config. `null` values means the value should be default regardless of the upstream.
|
|
22
23
|
*/
|
|
23
24
|
export declare class ContextConfig {
|
|
24
25
|
acceptInsecureCerts?: boolean;
|
|
@@ -31,4 +32,11 @@ export declare class ContextConfig {
|
|
|
31
32
|
screenOrientation?: Emulation.ScreenOrientation | null;
|
|
32
33
|
timezone?: string | null;
|
|
33
34
|
userPromptHandler?: Session.UserPromptHandler;
|
|
35
|
+
/**
|
|
36
|
+
* Merges multiple `ContextConfig` objects. The configs are merged in the
|
|
37
|
+
* order they are provided. For each property, the value from the last config
|
|
38
|
+
* that defines it (i.e., the value is not `undefined`) will be used.
|
|
39
|
+
* The final result will not contain any `undefined` properties.
|
|
40
|
+
*/
|
|
41
|
+
static merge(...configs: (ContextConfig | undefined)[]): ContextConfig;
|
|
34
42
|
}
|
|
@@ -19,7 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.ContextConfig = void 0;
|
|
20
20
|
/**
|
|
21
21
|
* Represents a context configurations. It can be global, per User Context, or per
|
|
22
|
-
* Browsing Context.
|
|
22
|
+
* Browsing Context. The undefined value means the config will be taken from the upstream
|
|
23
|
+
* config. `null` values means the value should be default regardless of the upstream.
|
|
23
24
|
*/
|
|
24
25
|
class ContextConfig {
|
|
25
26
|
acceptInsecureCerts;
|
|
@@ -34,6 +35,27 @@ class ContextConfig {
|
|
|
34
35
|
// Timezone is kept in CDP format with GMT prefix for offset values.
|
|
35
36
|
timezone;
|
|
36
37
|
userPromptHandler;
|
|
38
|
+
/**
|
|
39
|
+
* Merges multiple `ContextConfig` objects. The configs are merged in the
|
|
40
|
+
* order they are provided. For each property, the value from the last config
|
|
41
|
+
* that defines it (i.e., the value is not `undefined`) will be used.
|
|
42
|
+
* The final result will not contain any `undefined` properties.
|
|
43
|
+
*/
|
|
44
|
+
static merge(...configs) {
|
|
45
|
+
const result = new ContextConfig();
|
|
46
|
+
for (const config of configs) {
|
|
47
|
+
if (!config) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
for (const key in config) {
|
|
51
|
+
const value = config[key];
|
|
52
|
+
if (value !== undefined) {
|
|
53
|
+
result[key] = value;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
37
59
|
}
|
|
38
60
|
exports.ContextConfig = ContextConfig;
|
|
39
61
|
//# sourceMappingURL=ContextConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextConfig.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/ContextConfig.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAUH
|
|
1
|
+
{"version":3,"file":"ContextConfig.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/ContextConfig.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAUH;;;;GAIG;AACH,MAAa,aAAa;IACxB,mBAAmB,CAAW;IAC9B,QAAQ,CAAmC;IAC3C,gBAAgB,CAAiB;IACjC,wCAAwC;IACxC,YAAY,CAA4B;IACxC,WAAW,CAGF;IACT,MAAM,CAAiB;IACvB,oBAAoB,CAAW;IAC/B,iBAAiB,CAAsC;IACvD,oEAAoE;IACpE,QAAQ,CAAiB;IACzB,iBAAiB,CAA6B;IAE9C;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,OAAsC;QACpD,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAEnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,SAAS;YACX,CAAC;YACD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,MAAM,CAAC,GAA0B,CAAC,CAAC;gBACjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACvB,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvCD,sCAuCC"}
|
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
import { ContextConfig } from './ContextConfig.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manages context-specific configurations. This class allows setting
|
|
4
|
+
* configurations at three levels: global, user context, and browsing context.
|
|
5
|
+
*
|
|
6
|
+
* When `getActiveConfig` is called, it merges the configurations in a specific
|
|
7
|
+
* order of precedence: `global -> user context -> browsing context`. For each
|
|
8
|
+
* configuration property, the value from the highest-precedence level that has a
|
|
9
|
+
* non-`undefined` value is used.
|
|
10
|
+
*
|
|
11
|
+
* The `update` methods (`updateGlobalConfig`, `updateUserContextConfig`,
|
|
12
|
+
* `updateBrowsingContextConfig`) merge the provided configuration with the
|
|
13
|
+
* existing one at the corresponding level. Properties with `undefined` values in
|
|
14
|
+
* the provided configuration are ignored, preserving the existing value.
|
|
15
|
+
*/
|
|
2
16
|
export declare class ContextConfigStorage {
|
|
3
17
|
#private;
|
|
18
|
+
/**
|
|
19
|
+
* Updates the global configuration. Properties with `undefined` values in the
|
|
20
|
+
* provided `config` are ignored.
|
|
21
|
+
*/
|
|
4
22
|
updateGlobalConfig(config: ContextConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the configuration for a specific browsing context. Properties with
|
|
25
|
+
* `undefined` values in the provided `config` are ignored.
|
|
26
|
+
*/
|
|
5
27
|
updateBrowsingContextConfig(browsingContextId: string, config: ContextConfig): void;
|
|
28
|
+
/**
|
|
29
|
+
* Updates the configuration for a specific user context. Properties with
|
|
30
|
+
* `undefined` values in the provided `config` are ignored.
|
|
31
|
+
*/
|
|
6
32
|
updateUserContextConfig(userContext: string, config: ContextConfig): void;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
timezone?: string | null;
|
|
17
|
-
userPromptHandler?: import("../../../protocol/protocol.js").Session.UserPromptHandler;
|
|
18
|
-
};
|
|
33
|
+
/**
|
|
34
|
+
* Returns the current global configuration.
|
|
35
|
+
*/
|
|
36
|
+
getGlobalConfig(): ContextConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Calculates the active configuration by merging global, user context, and
|
|
39
|
+
* browsing context settings.
|
|
40
|
+
*/
|
|
41
|
+
getActiveConfig(topLevelBrowsingContextId: string, userContext: string): ContextConfig;
|
|
19
42
|
}
|
|
@@ -18,49 +18,57 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.ContextConfigStorage = void 0;
|
|
20
20
|
const ContextConfig_js_1 = require("./ContextConfig.js");
|
|
21
|
+
/**
|
|
22
|
+
* Manages context-specific configurations. This class allows setting
|
|
23
|
+
* configurations at three levels: global, user context, and browsing context.
|
|
24
|
+
*
|
|
25
|
+
* When `getActiveConfig` is called, it merges the configurations in a specific
|
|
26
|
+
* order of precedence: `global -> user context -> browsing context`. For each
|
|
27
|
+
* configuration property, the value from the highest-precedence level that has a
|
|
28
|
+
* non-`undefined` value is used.
|
|
29
|
+
*
|
|
30
|
+
* The `update` methods (`updateGlobalConfig`, `updateUserContextConfig`,
|
|
31
|
+
* `updateBrowsingContextConfig`) merge the provided configuration with the
|
|
32
|
+
* existing one at the corresponding level. Properties with `undefined` values in
|
|
33
|
+
* the provided configuration are ignored, preserving the existing value.
|
|
34
|
+
*/
|
|
21
35
|
class ContextConfigStorage {
|
|
22
36
|
#global = new ContextConfig_js_1.ContextConfig();
|
|
23
37
|
#userContextConfigs = new Map();
|
|
24
38
|
#browsingContextConfigs = new Map();
|
|
39
|
+
/**
|
|
40
|
+
* Updates the global configuration. Properties with `undefined` values in the
|
|
41
|
+
* provided `config` are ignored.
|
|
42
|
+
*/
|
|
25
43
|
updateGlobalConfig(config) {
|
|
26
|
-
this.#global =
|
|
44
|
+
this.#global = ContextConfig_js_1.ContextConfig.merge(this.#global, config);
|
|
27
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates the configuration for a specific browsing context. Properties with
|
|
48
|
+
* `undefined` values in the provided `config` are ignored.
|
|
49
|
+
*/
|
|
28
50
|
updateBrowsingContextConfig(browsingContextId, config) {
|
|
29
|
-
|
|
30
|
-
this.#browsingContextConfigs.set(browsingContextId, {
|
|
31
|
-
...this.#browsingContextConfigs.get(browsingContextId),
|
|
32
|
-
...config,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.#browsingContextConfigs.set(browsingContextId, config);
|
|
37
|
-
}
|
|
51
|
+
this.#browsingContextConfigs.set(browsingContextId, ContextConfig_js_1.ContextConfig.merge(this.#browsingContextConfigs.get(browsingContextId), config));
|
|
38
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Updates the configuration for a specific user context. Properties with
|
|
55
|
+
* `undefined` values in the provided `config` are ignored.
|
|
56
|
+
*/
|
|
39
57
|
updateUserContextConfig(userContext, config) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.#userContextConfigs.set(userContext, config);
|
|
48
|
-
}
|
|
58
|
+
this.#userContextConfigs.set(userContext, ContextConfig_js_1.ContextConfig.merge(this.#userContextConfigs.get(userContext), config));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns the current global configuration.
|
|
62
|
+
*/
|
|
63
|
+
getGlobalConfig() {
|
|
64
|
+
return this.#global;
|
|
49
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Calculates the active configuration by merging global, user context, and
|
|
68
|
+
* browsing context settings.
|
|
69
|
+
*/
|
|
50
70
|
getActiveConfig(topLevelBrowsingContextId, userContext) {
|
|
51
|
-
|
|
52
|
-
if (userContext !== undefined &&
|
|
53
|
-
this.#userContextConfigs.has(userContext)) {
|
|
54
|
-
result = { ...result, ...this.#userContextConfigs.get(userContext) };
|
|
55
|
-
}
|
|
56
|
-
if (topLevelBrowsingContextId !== undefined &&
|
|
57
|
-
this.#browsingContextConfigs.has(topLevelBrowsingContextId)) {
|
|
58
|
-
result = {
|
|
59
|
-
...result,
|
|
60
|
-
...this.#browsingContextConfigs.get(topLevelBrowsingContextId),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
71
|
+
return ContextConfig_js_1.ContextConfig.merge(this.#global, this.#userContextConfigs.get(userContext), this.#browsingContextConfigs.get(topLevelBrowsingContextId));
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
exports.ContextConfigStorage = ContextConfigStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextConfigStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/ContextConfigStorage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAAiD;AAEjD,MAAa,oBAAoB;IAC/B,OAAO,GAAG,IAAI,gCAAa,EAAE,CAAC;IAC9B,mBAAmB,GAAG,IAAI,GAAG,EAAyB,CAAC;IACvD,uBAAuB,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE3D,kBAAkB,CAAC,MAAqB;QACtC,IAAI,CAAC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"ContextConfigStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/ContextConfigStorage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yDAAiD;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAa,oBAAoB;IAC/B,OAAO,GAAG,IAAI,gCAAa,EAAE,CAAC;IAC9B,mBAAmB,GAAG,IAAI,GAAG,EAAyB,CAAC;IACvD,uBAAuB,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE3D;;;OAGG;IACH,kBAAkB,CAAC,MAAqB;QACtC,IAAI,CAAC,OAAO,GAAG,gCAAa,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,2BAA2B,CACzB,iBAAyB,EACzB,MAAqB;QAErB,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAC9B,iBAAiB,EACjB,gCAAa,CAAC,KAAK,CACjB,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EACnD,MAAM,CACP,CACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,uBAAuB,CAAC,WAAmB,EAAE,MAAqB;QAChE,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAC1B,WAAW,EACX,gCAAa,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CACvE,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,eAAe,CAAC,yBAAiC,EAAE,WAAmB;QACpE,OAAO,gCAAa,CAAC,KAAK,CACxB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,EACzC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAC5D,CAAC;IACJ,CAAC;CACF;AA3DD,oDA2DC"}
|
|
@@ -1434,7 +1434,7 @@ export declare namespace Network {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
export declare namespace Network {
|
|
1436
1436
|
type SetExtraHeadersParameters = {
|
|
1437
|
-
headers: [
|
|
1437
|
+
headers: [...Network.Header[]];
|
|
1438
1438
|
contexts?: [
|
|
1439
1439
|
BrowsingContext.BrowsingContext,
|
|
1440
1440
|
...BrowsingContext.BrowsingContext[]
|
|
@@ -1510,7 +1510,7 @@ var Network;
|
|
|
1510
1510
|
})(Network || (exports.Network = Network = {}));
|
|
1511
1511
|
(function (Network) {
|
|
1512
1512
|
Network.SetExtraHeadersParametersSchema = zod_1.default.lazy(() => zod_1.default.object({
|
|
1513
|
-
headers: zod_1.default.array(Network.HeaderSchema)
|
|
1513
|
+
headers: zod_1.default.array(Network.HeaderSchema),
|
|
1514
1514
|
contexts: zod_1.default
|
|
1515
1515
|
.array(BrowsingContext.BrowsingContextSchema)
|
|
1516
1516
|
.min(1)
|