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.
Files changed (25) hide show
  1. package/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js +1 -1
  2. package/lib/cjs/bidiMapper/modules/browser/BrowserProcessor.js.map +1 -1
  3. package/lib/cjs/bidiMapper/modules/browser/ContextConfig.d.ts +9 -1
  4. package/lib/cjs/bidiMapper/modules/browser/ContextConfig.js +23 -1
  5. package/lib/cjs/bidiMapper/modules/browser/ContextConfig.js.map +1 -1
  6. package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.d.ts +35 -12
  7. package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.js +40 -32
  8. package/lib/cjs/bidiMapper/modules/browser/ContextConfigStorage.js.map +1 -1
  9. package/lib/cjs/protocol/generated/webdriver-bidi.d.ts +1 -1
  10. package/lib/cjs/protocol-parser/generated/webdriver-bidi.js +1 -1
  11. package/lib/cjs/protocol-parser/generated/webdriver-bidi.js.map +1 -1
  12. package/lib/esm/bidiMapper/modules/browser/BrowserProcessor.js +1 -1
  13. package/lib/esm/bidiMapper/modules/browser/BrowserProcessor.js.map +1 -1
  14. package/lib/esm/bidiMapper/modules/browser/ContextConfig.d.ts +9 -1
  15. package/lib/esm/bidiMapper/modules/browser/ContextConfig.js +23 -1
  16. package/lib/esm/bidiMapper/modules/browser/ContextConfig.js.map +1 -1
  17. package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.d.ts +35 -12
  18. package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.js +40 -32
  19. package/lib/esm/bidiMapper/modules/browser/ContextConfigStorage.js.map +1 -1
  20. package/lib/esm/protocol/generated/webdriver-bidi.d.ts +1 -1
  21. package/lib/esm/protocol-parser/generated/webdriver-bidi.js +1 -1
  22. package/lib/esm/protocol-parser/generated/webdriver-bidi.js.map +1 -1
  23. package/lib/iife/mapperTab.js +24 -34
  24. package/lib/iife/mapperTab.js.map +1 -1
  25. package/package.json +1 -1
@@ -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
- getActiveConfig(topLevelBrowsingContextId?: string, userContext?: string): {
8
- acceptInsecureCerts?: boolean;
9
- viewport?: import("../../../protocol/protocol.js").BrowsingContext.Viewport | null;
10
- devicePixelRatio?: number | null;
11
- extraHeaders?: import("devtools-protocol").Protocol.Network.Headers;
12
- geolocation?: import("../../../protocol/protocol.js").Emulation.GeolocationCoordinates | import("../../../protocol/protocol.js").Emulation.GeolocationPositionError | null;
13
- locale?: string | null;
14
- prerenderingDisabled?: boolean;
15
- screenOrientation?: import("../../../protocol/protocol.js").Emulation.ScreenOrientation | null;
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 = { ...this.#global, ...config };
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
- if (this.#browsingContextConfigs.has(browsingContextId)) {
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
- if (this.#userContextConfigs.has(userContext)) {
38
- this.#userContextConfigs.set(userContext, {
39
- ...this.#userContextConfigs.get(userContext),
40
- ...config,
41
- });
42
- }
43
- else {
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
- let result = { ...this.#global };
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,CA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AAC,CAAC;QACrE,CAAC;QACD,IACE,yBAAyB,KAAK,SAAS;YACvC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAC3D,CAAC;YACD,MAAM,GAAG;gBACP,GAAG,MAAM;gBACT,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,yBAAyB,CAAC;aAC/D,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
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"}
@@ -1434,7 +1434,7 @@ export declare namespace Network {
1434
1434
  }
1435
1435
  export declare namespace Network {
1436
1436
  type SetExtraHeadersParameters = {
1437
- headers: [Network.Header, ...Network.Header[]];
1437
+ headers: [...Network.Header[]];
1438
1438
  contexts?: [
1439
1439
  BrowsingContext.BrowsingContext,
1440
1440
  ...BrowsingContext.BrowsingContext[]
@@ -1504,7 +1504,7 @@ export var Network;
1504
1504
  })(Network || (Network = {}));
1505
1505
  (function (Network) {
1506
1506
  Network.SetExtraHeadersParametersSchema = z.lazy(() => z.object({
1507
- headers: z.array(Network.HeaderSchema).min(1),
1507
+ headers: z.array(Network.HeaderSchema),
1508
1508
  contexts: z
1509
1509
  .array(BrowsingContext.BrowsingContextSchema)
1510
1510
  .min(1)