chromium-bidi 7.3.0 → 7.3.1
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/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/iife/mapperTab.js +23 -33
- 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,MAA2B;QAE3B,gFAAgF;QAChF,sEAAsE;QACtE,qDAAqD;QACrD,yCAAyC;QAEzC,MAAM,SAAS,GAAG,MAA6C,CAAC;QAEhE,IAAI,SAAS,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAChD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;YAC3D,IACE,SAAS,CAAC,mBAAmB,K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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"}
|
|
@@ -39,7 +39,7 @@ export class BrowserProcessor {
|
|
|
39
39
|
// `Browser.CreateUserContextParameters`.
|
|
40
40
|
const w3cParams = params;
|
|
41
41
|
if (w3cParams.acceptInsecureCerts !== undefined) {
|
|
42
|
-
const globalConfig = this.#configStorage.
|
|
42
|
+
const globalConfig = this.#configStorage.getGlobalConfig();
|
|
43
43
|
if (w3cParams.acceptInsecureCerts === false &&
|
|
44
44
|
globalConfig.acceptInsecureCerts === true)
|
|
45
45
|
// 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;AAIH,OAAO,EAGL,wBAAwB,EACxB,0BAA0B,EAE1B,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAOvC,MAAM,OAAO,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,MAA2B;QAE3B,gFAAgF;QAChF,sEAAsE;QACtE,qDAAqD;QACrD,yCAAyC;QAEzC,MAAM,SAAS,GAAG,MAA6C,CAAC;QAEhE,IAAI,SAAS,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAChD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"BrowserProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/BrowserProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAGL,wBAAwB,EACxB,0BAA0B,EAE1B,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAOvC,MAAM,OAAO,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,MAA2B;QAE3B,gFAAgF;QAChF,sEAAsE;QACtE,qDAAqD;QACrD,yCAAyC;QAEzC,MAAM,SAAS,GAAG,MAA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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,qBAAqB,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
|
}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
* Represents a context configurations. It can be global, per User Context, or per
|
|
19
|
-
* Browsing Context.
|
|
19
|
+
* Browsing Context. The undefined value means the config will be taken from the upstream
|
|
20
|
+
* config. `null` values means the value should be default regardless of the upstream.
|
|
20
21
|
*/
|
|
21
22
|
export class ContextConfig {
|
|
22
23
|
acceptInsecureCerts;
|
|
@@ -31,5 +32,26 @@ export class ContextConfig {
|
|
|
31
32
|
// Timezone is kept in CDP format with GMT prefix for offset values.
|
|
32
33
|
timezone;
|
|
33
34
|
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) {
|
|
42
|
+
const result = new ContextConfig();
|
|
43
|
+
for (const config of configs) {
|
|
44
|
+
if (!config) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
for (const key in config) {
|
|
48
|
+
const value = config[key];
|
|
49
|
+
if (value !== undefined) {
|
|
50
|
+
result[key] = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
34
56
|
}
|
|
35
57
|
//# 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,MAAM,OAAO,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"}
|
|
@@ -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
|
}
|
|
@@ -15,49 +15,57 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { ContextConfig } from './ContextConfig.js';
|
|
18
|
+
/**
|
|
19
|
+
* Manages context-specific configurations. This class allows setting
|
|
20
|
+
* configurations at three levels: global, user context, and browsing context.
|
|
21
|
+
*
|
|
22
|
+
* When `getActiveConfig` is called, it merges the configurations in a specific
|
|
23
|
+
* order of precedence: `global -> user context -> browsing context`. For each
|
|
24
|
+
* configuration property, the value from the highest-precedence level that has a
|
|
25
|
+
* non-`undefined` value is used.
|
|
26
|
+
*
|
|
27
|
+
* The `update` methods (`updateGlobalConfig`, `updateUserContextConfig`,
|
|
28
|
+
* `updateBrowsingContextConfig`) merge the provided configuration with the
|
|
29
|
+
* existing one at the corresponding level. Properties with `undefined` values in
|
|
30
|
+
* the provided configuration are ignored, preserving the existing value.
|
|
31
|
+
*/
|
|
18
32
|
export class ContextConfigStorage {
|
|
19
33
|
#global = new ContextConfig();
|
|
20
34
|
#userContextConfigs = new Map();
|
|
21
35
|
#browsingContextConfigs = new Map();
|
|
36
|
+
/**
|
|
37
|
+
* Updates the global configuration. Properties with `undefined` values in the
|
|
38
|
+
* provided `config` are ignored.
|
|
39
|
+
*/
|
|
22
40
|
updateGlobalConfig(config) {
|
|
23
|
-
this.#global =
|
|
41
|
+
this.#global = ContextConfig.merge(this.#global, config);
|
|
24
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Updates the configuration for a specific browsing context. Properties with
|
|
45
|
+
* `undefined` values in the provided `config` are ignored.
|
|
46
|
+
*/
|
|
25
47
|
updateBrowsingContextConfig(browsingContextId, config) {
|
|
26
|
-
|
|
27
|
-
this.#browsingContextConfigs.set(browsingContextId, {
|
|
28
|
-
...this.#browsingContextConfigs.get(browsingContextId),
|
|
29
|
-
...config,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.#browsingContextConfigs.set(browsingContextId, config);
|
|
34
|
-
}
|
|
48
|
+
this.#browsingContextConfigs.set(browsingContextId, ContextConfig.merge(this.#browsingContextConfigs.get(browsingContextId), config));
|
|
35
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Updates the configuration for a specific user context. Properties with
|
|
52
|
+
* `undefined` values in the provided `config` are ignored.
|
|
53
|
+
*/
|
|
36
54
|
updateUserContextConfig(userContext, config) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.#userContextConfigs.set(userContext, config);
|
|
45
|
-
}
|
|
55
|
+
this.#userContextConfigs.set(userContext, ContextConfig.merge(this.#userContextConfigs.get(userContext), config));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the current global configuration.
|
|
59
|
+
*/
|
|
60
|
+
getGlobalConfig() {
|
|
61
|
+
return this.#global;
|
|
46
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Calculates the active configuration by merging global, user context, and
|
|
65
|
+
* browsing context settings.
|
|
66
|
+
*/
|
|
47
67
|
getActiveConfig(topLevelBrowsingContextId, userContext) {
|
|
48
|
-
|
|
49
|
-
if (userContext !== undefined &&
|
|
50
|
-
this.#userContextConfigs.has(userContext)) {
|
|
51
|
-
result = { ...result, ...this.#userContextConfigs.get(userContext) };
|
|
52
|
-
}
|
|
53
|
-
if (topLevelBrowsingContextId !== undefined &&
|
|
54
|
-
this.#browsingContextConfigs.has(topLevelBrowsingContextId)) {
|
|
55
|
-
result = {
|
|
56
|
-
...result,
|
|
57
|
-
...this.#browsingContextConfigs.get(topLevelBrowsingContextId),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
68
|
+
return ContextConfig.merge(this.#global, this.#userContextConfigs.get(userContext), this.#browsingContextConfigs.get(topLevelBrowsingContextId));
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
//# sourceMappingURL=ContextConfigStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextConfigStorage.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/browser/ContextConfigStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,oBAAoB;IAC/B,OAAO,GAAG,IAAI,aAAa,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,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,oBAAoB;IAC/B,OAAO,GAAG,IAAI,aAAa,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,aAAa,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,aAAa,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,aAAa,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,aAAa,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"}
|
package/lib/iife/mapperTab.js
CHANGED
|
@@ -616,7 +616,7 @@
|
|
|
616
616
|
async createUserContext(params) {
|
|
617
617
|
const w3cParams = params;
|
|
618
618
|
if (w3cParams.acceptInsecureCerts !== undefined) {
|
|
619
|
-
const globalConfig = this.#configStorage.
|
|
619
|
+
const globalConfig = this.#configStorage.getGlobalConfig();
|
|
620
620
|
if (w3cParams.acceptInsecureCerts === false &&
|
|
621
621
|
globalConfig.acceptInsecureCerts === true)
|
|
622
622
|
throw new UnknownErrorException(`Cannot set user context's "acceptInsecureCerts" to false, when a capability "acceptInsecureCerts" is set to true`);
|
|
@@ -5340,6 +5340,21 @@
|
|
|
5340
5340
|
screenOrientation;
|
|
5341
5341
|
timezone;
|
|
5342
5342
|
userPromptHandler;
|
|
5343
|
+
static merge(...configs) {
|
|
5344
|
+
const result = new ContextConfig();
|
|
5345
|
+
for (const config of configs) {
|
|
5346
|
+
if (!config) {
|
|
5347
|
+
continue;
|
|
5348
|
+
}
|
|
5349
|
+
for (const key in config) {
|
|
5350
|
+
const value = config[key];
|
|
5351
|
+
if (value !== undefined) {
|
|
5352
|
+
result[key] = value;
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
return result;
|
|
5357
|
+
}
|
|
5343
5358
|
}
|
|
5344
5359
|
|
|
5345
5360
|
/*
|
|
@@ -5363,44 +5378,19 @@
|
|
|
5363
5378
|
#userContextConfigs = new Map();
|
|
5364
5379
|
#browsingContextConfigs = new Map();
|
|
5365
5380
|
updateGlobalConfig(config) {
|
|
5366
|
-
this.#global =
|
|
5381
|
+
this.#global = ContextConfig.merge(this.#global, config);
|
|
5367
5382
|
}
|
|
5368
5383
|
updateBrowsingContextConfig(browsingContextId, config) {
|
|
5369
|
-
|
|
5370
|
-
this.#browsingContextConfigs.set(browsingContextId, {
|
|
5371
|
-
...this.#browsingContextConfigs.get(browsingContextId),
|
|
5372
|
-
...config,
|
|
5373
|
-
});
|
|
5374
|
-
}
|
|
5375
|
-
else {
|
|
5376
|
-
this.#browsingContextConfigs.set(browsingContextId, config);
|
|
5377
|
-
}
|
|
5384
|
+
this.#browsingContextConfigs.set(browsingContextId, ContextConfig.merge(this.#browsingContextConfigs.get(browsingContextId), config));
|
|
5378
5385
|
}
|
|
5379
5386
|
updateUserContextConfig(userContext, config) {
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
});
|
|
5385
|
-
}
|
|
5386
|
-
else {
|
|
5387
|
-
this.#userContextConfigs.set(userContext, config);
|
|
5388
|
-
}
|
|
5387
|
+
this.#userContextConfigs.set(userContext, ContextConfig.merge(this.#userContextConfigs.get(userContext), config));
|
|
5388
|
+
}
|
|
5389
|
+
getGlobalConfig() {
|
|
5390
|
+
return this.#global;
|
|
5389
5391
|
}
|
|
5390
5392
|
getActiveConfig(topLevelBrowsingContextId, userContext) {
|
|
5391
|
-
|
|
5392
|
-
if (userContext !== undefined &&
|
|
5393
|
-
this.#userContextConfigs.has(userContext)) {
|
|
5394
|
-
result = { ...result, ...this.#userContextConfigs.get(userContext) };
|
|
5395
|
-
}
|
|
5396
|
-
if (topLevelBrowsingContextId !== undefined &&
|
|
5397
|
-
this.#browsingContextConfigs.has(topLevelBrowsingContextId)) {
|
|
5398
|
-
result = {
|
|
5399
|
-
...result,
|
|
5400
|
-
...this.#browsingContextConfigs.get(topLevelBrowsingContextId),
|
|
5401
|
-
};
|
|
5402
|
-
}
|
|
5403
|
-
return result;
|
|
5393
|
+
return ContextConfig.merge(this.#global, this.#userContextConfigs.get(userContext), this.#browsingContextConfigs.get(topLevelBrowsingContextId));
|
|
5404
5394
|
}
|
|
5405
5395
|
}
|
|
5406
5396
|
|