chromium-bidi 0.5.19 → 0.5.21

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 (63) hide show
  1. package/.browser +1 -1
  2. package/README.md +3 -3
  3. package/lib/THIRD_PARTY_NOTICES +1 -1
  4. package/lib/cjs/bidiMapper/CommandProcessor.js +1 -1
  5. package/lib/cjs/bidiMapper/CommandProcessor.js.map +1 -1
  6. package/lib/cjs/bidiMapper/modules/cdp/CdpTarget.d.ts +1 -1
  7. package/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js +32 -3
  8. package/lib/cjs/bidiMapper/modules/cdp/CdpTarget.js.map +1 -1
  9. package/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js +14 -2
  10. package/lib/cjs/bidiMapper/modules/cdp/CdpTargetManager.js.map +1 -1
  11. package/lib/cjs/bidiMapper/modules/context/BrowsingContextImpl.d.ts +1 -1
  12. package/lib/cjs/bidiMapper/modules/context/BrowsingContextImpl.js +65 -27
  13. package/lib/cjs/bidiMapper/modules/context/BrowsingContextImpl.js.map +1 -1
  14. package/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.d.ts +2 -1
  15. package/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js +20 -1
  16. package/lib/cjs/bidiMapper/modules/context/BrowsingContextProcessor.js.map +1 -1
  17. package/lib/cjs/bidiMapper/modules/input/ActionDispatcher.js +26 -9
  18. package/lib/cjs/bidiMapper/modules/input/ActionDispatcher.js.map +1 -1
  19. package/lib/cjs/bidiMapper/modules/input/InputProcessor.js +16 -10
  20. package/lib/cjs/bidiMapper/modules/input/InputProcessor.js.map +1 -1
  21. package/lib/cjs/bidiMapper/modules/input/InputSource.d.ts +5 -5
  22. package/lib/cjs/bidiMapper/modules/input/keyUtils.d.ts +12 -0
  23. package/lib/cjs/bidiMapper/modules/input/keyUtils.js +23 -1
  24. package/lib/cjs/bidiMapper/modules/input/keyUtils.js.map +1 -1
  25. package/lib/cjs/bidiMapper/modules/log/LogManager.js.map +1 -1
  26. package/lib/cjs/bidiMapper/modules/network/NetworkProcessor.d.ts +6 -0
  27. package/lib/cjs/bidiMapper/modules/network/NetworkProcessor.js +78 -20
  28. package/lib/cjs/bidiMapper/modules/network/NetworkProcessor.js.map +1 -1
  29. package/lib/cjs/bidiMapper/modules/network/NetworkRequest.d.ts +1 -1
  30. package/lib/cjs/bidiMapper/modules/network/NetworkRequest.js +34 -9
  31. package/lib/cjs/bidiMapper/modules/network/NetworkRequest.js.map +1 -1
  32. package/lib/cjs/bidiMapper/modules/network/NetworkStorage.js.map +1 -1
  33. package/lib/cjs/bidiMapper/modules/network/NetworkUtils.d.ts +3 -1
  34. package/lib/cjs/bidiMapper/modules/network/NetworkUtils.js +21 -4
  35. package/lib/cjs/bidiMapper/modules/network/NetworkUtils.js.map +1 -1
  36. package/lib/cjs/bidiMapper/modules/session/EventManager.d.ts +8 -0
  37. package/lib/cjs/bidiMapper/modules/session/EventManager.js +21 -1
  38. package/lib/cjs/bidiMapper/modules/session/EventManager.js.map +1 -1
  39. package/lib/cjs/bidiMapper/modules/session/SubscriptionManager.d.ts +13 -2
  40. package/lib/cjs/bidiMapper/modules/session/SubscriptionManager.js +35 -12
  41. package/lib/cjs/bidiMapper/modules/session/SubscriptionManager.js.map +1 -1
  42. package/lib/cjs/bidiMapper/modules/storage/StorageProcessor.js +2 -2
  43. package/lib/cjs/bidiMapper/modules/storage/StorageProcessor.js.map +1 -1
  44. package/lib/cjs/bidiServer/MapperCdpConnection.js +13 -3
  45. package/lib/cjs/bidiServer/MapperCdpConnection.js.map +1 -1
  46. package/lib/cjs/bidiTab/bidiTab.d.ts +1 -0
  47. package/lib/cjs/bidiTab/bidiTab.js.map +1 -1
  48. package/lib/cjs/bidiTab/mapperTabPage.js +2 -0
  49. package/lib/cjs/bidiTab/mapperTabPage.js.map +1 -1
  50. package/lib/cjs/protocol-parser/generated/webdriver-bidi.d.ts +10996 -32218
  51. package/lib/cjs/protocol-parser/protocol-parser.d.ts +9 -9
  52. package/lib/cjs/utils/Deferred.d.ts +1 -0
  53. package/lib/cjs/utils/Deferred.js +8 -0
  54. package/lib/cjs/utils/Deferred.js.map +1 -1
  55. package/lib/cjs/utils/DistinctValues.d.ts +14 -0
  56. package/lib/cjs/utils/DistinctValues.js +59 -0
  57. package/lib/cjs/utils/DistinctValues.js.map +1 -0
  58. package/lib/cjs/utils/GraphemeTools.d.ts +9 -0
  59. package/lib/cjs/utils/GraphemeTools.js +39 -0
  60. package/lib/cjs/utils/GraphemeTools.js.map +1 -0
  61. package/lib/iife/mapperTab.js +787 -194
  62. package/lib/iife/mapperTab.js.map +1 -1
  63. package/package.json +23 -23
@@ -30,13 +30,7 @@ export declare namespace Network {
30
30
  function parseAddInterceptParameters(params: unknown): Protocol.Network.AddInterceptParameters;
31
31
  function parseContinueRequestParameters(params: unknown): {
32
32
  request: string;
33
- body?: {
34
- type: "string";
35
- value: string;
36
- } | {
37
- type: "base64";
38
- value: string;
39
- } | undefined;
33
+ url?: string | undefined;
40
34
  cookies?: {
41
35
  value: {
42
36
  type: "string";
@@ -47,6 +41,14 @@ export declare namespace Network {
47
41
  };
48
42
  name: string;
49
43
  }[] | undefined;
44
+ method?: string | undefined;
45
+ body?: {
46
+ type: "string";
47
+ value: string;
48
+ } | {
49
+ type: "base64";
50
+ value: string;
51
+ } | undefined;
50
52
  headers?: {
51
53
  value: {
52
54
  type: "string";
@@ -57,8 +59,6 @@ export declare namespace Network {
57
59
  };
58
60
  name: string;
59
61
  }[] | undefined;
60
- method?: string | undefined;
61
- url?: string | undefined;
62
62
  };
63
63
  function parseContinueResponseParameters(params: unknown): Protocol.Network.ContinueResponseParameters;
64
64
  function parseContinueWithAuthParameters(params: unknown): {
@@ -17,6 +17,7 @@
17
17
  export declare class Deferred<T> implements Promise<T> {
18
18
  #private;
19
19
  get isFinished(): boolean;
20
+ get result(): T;
20
21
  constructor();
21
22
  then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
22
23
  catch<TResult = never>(onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
@@ -20,11 +20,18 @@ exports.Deferred = void 0;
20
20
  class Deferred {
21
21
  #isFinished = false;
22
22
  #promise;
23
+ #result;
23
24
  #resolve;
24
25
  #reject;
25
26
  get isFinished() {
26
27
  return this.#isFinished;
27
28
  }
29
+ get result() {
30
+ if (!this.#isFinished) {
31
+ throw new Error('Deferred is not finished yet');
32
+ }
33
+ return this.#result;
34
+ }
28
35
  constructor() {
29
36
  this.#promise = new Promise((resolve, reject) => {
30
37
  this.#resolve = resolve;
@@ -43,6 +50,7 @@ class Deferred {
43
50
  return this.#promise.catch(onRejected);
44
51
  }
45
52
  resolve(value) {
53
+ this.#result = value;
46
54
  if (!this.#isFinished) {
47
55
  this.#isFinished = true;
48
56
  this.#resolve(value);
@@ -1 +1 @@
1
- {"version":3,"file":"Deferred.js","sourceRoot":"","sources":["../../../src/utils/Deferred.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,MAAa,QAAQ;IACnB,WAAW,GAAG,KAAK,CAAC;IACpB,QAAQ,CAAa;IACrB,QAAQ,CAAsB;IAC9B,OAAO,CAA6B;IAEpC,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;YACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,2EAA2E;QAC3E,uCAAuC;QACvC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7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DD,4BA+DC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns an array of distinct values. Order is not guaranteed.
3
+ * @param values - The values to filter. Should be JSON-serializable.
4
+ * @return - An array of distinct values.
5
+ */
6
+ export declare function distinctValues<T>(values: T[]): T[];
7
+ /**
8
+ * Returns a stringified version of the object with keys sorted. This is required to
9
+ * ensure that the stringified version of an object is deterministic independent of the
10
+ * order of keys.
11
+ * @param obj
12
+ * @return {string}
13
+ */
14
+ export declare function deterministicJSONStringify(obj: unknown): string;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 Google LLC.
4
+ * Copyright (c) Microsoft Corporation.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.deterministicJSONStringify = exports.distinctValues = void 0;
20
+ /**
21
+ * Returns an array of distinct values. Order is not guaranteed.
22
+ * @param values - The values to filter. Should be JSON-serializable.
23
+ * @return - An array of distinct values.
24
+ */
25
+ function distinctValues(values) {
26
+ const map = new Map();
27
+ for (const value of values) {
28
+ map.set(deterministicJSONStringify(value), value);
29
+ }
30
+ return Array.from(map.values());
31
+ }
32
+ exports.distinctValues = distinctValues;
33
+ /**
34
+ * Returns a stringified version of the object with keys sorted. This is required to
35
+ * ensure that the stringified version of an object is deterministic independent of the
36
+ * order of keys.
37
+ * @param obj
38
+ * @return {string}
39
+ */
40
+ function deterministicJSONStringify(obj) {
41
+ return JSON.stringify(normalizeObject(obj));
42
+ }
43
+ exports.deterministicJSONStringify = deterministicJSONStringify;
44
+ function normalizeObject(obj) {
45
+ if (obj === undefined ||
46
+ obj === null ||
47
+ Array.isArray(obj) ||
48
+ typeof obj !== 'object') {
49
+ return obj;
50
+ }
51
+ // Copy the original object key and values to a new object in sorted order.
52
+ const newObj = {};
53
+ for (const key of Object.keys(obj).sort()) {
54
+ const value = obj[key];
55
+ newObj[key] = normalizeObject(value); // Recursively sort nested objects
56
+ }
57
+ return newObj;
58
+ }
59
+ //# sourceMappingURL=DistinctValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DistinctValues.js","sourceRoot":"","sources":["../../../src/utils/DistinctValues.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;;;GAIG;AACH,SAAgB,cAAc,CAAI,MAAW;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAa,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAClC,CAAC;AAND,wCAMC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CAAC,GAAY;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAFD,gEAEC;AAED,SAAS,eAAe,CAAC,GAAQ;IAC/B,IACE,GAAG,KAAK,SAAS;QACjB,GAAG,KAAK,IAAI;QACZ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAClB,OAAO,GAAG,KAAK,QAAQ,EACvB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,2EAA2E;IAC3E,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,kCAAkC;IAC1E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check if the given string is a single complex grapheme. A complex grapheme is one that
3
+ * is made up of multiple characters.
4
+ */
5
+ export declare function isSingleComplexGrapheme(value: string): boolean;
6
+ /**
7
+ * Check if the given string is a single grapheme.
8
+ */
9
+ export declare function isSingleGrapheme(value: string): boolean;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 Google LLC.
4
+ * Copyright (c) Microsoft Corporation.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.isSingleGrapheme = exports.isSingleComplexGrapheme = void 0;
20
+ /**
21
+ * Check if the given string is a single complex grapheme. A complex grapheme is one that
22
+ * is made up of multiple characters.
23
+ */
24
+ function isSingleComplexGrapheme(value) {
25
+ return isSingleGrapheme(value) && value.length > 1;
26
+ }
27
+ exports.isSingleComplexGrapheme = isSingleComplexGrapheme;
28
+ /**
29
+ * Check if the given string is a single grapheme.
30
+ */
31
+ function isSingleGrapheme(value) {
32
+ // Theoretically there can be some strings considered a grapheme in some locales, like
33
+ // slovak "ch" digraph. Use english locale for consistency.
34
+ // https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
35
+ const segmenter = new Intl.Segmenter('en', { granularity: 'grapheme' });
36
+ return [...segmenter.segment(value)].length === 1;
37
+ }
38
+ exports.isSingleGrapheme = isSingleGrapheme;
39
+ //# sourceMappingURL=GraphemeTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphemeTools.js","sourceRoot":"","sources":["../../../src/utils/GraphemeTools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,KAAa;IACnD,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACrD,CAAC;AAFD,0DAEC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,sFAAsF;IACtF,2DAA2D;IAC3D,oEAAoE;IACpE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAC,WAAW,EAAE,UAAU,EAAC,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACpD,CAAC;AAND,4CAMC"}