selenium-webdriver 4.19.0 → 4.21.0

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 (61) hide show
  1. package/CHANGES.md +21 -0
  2. package/README.md +1 -1
  3. package/bidi/addInterceptParameters.js +28 -2
  4. package/bidi/browser.js +17 -0
  5. package/bidi/browsingContext.js +206 -39
  6. package/bidi/browsingContextInspector.js +51 -0
  7. package/bidi/browsingContextTypes.js +31 -0
  8. package/bidi/captureScreenshotParameters.js +96 -0
  9. package/bidi/clipRectangle.js +127 -0
  10. package/bidi/continueRequestParameters.js +39 -0
  11. package/bidi/continueResponseParameters.js +40 -0
  12. package/bidi/cookieFilter.js +60 -0
  13. package/bidi/createContextParameters.js +73 -0
  14. package/bidi/evaluateResult.js +17 -0
  15. package/bidi/index.js +0 -1
  16. package/bidi/input.js +27 -3
  17. package/bidi/interceptPhase.js +4 -0
  18. package/bidi/logEntries.js +66 -0
  19. package/bidi/network.js +102 -0
  20. package/bidi/networkTypes.js +346 -1
  21. package/bidi/partialCookie.js +48 -0
  22. package/bidi/partitionDescriptor.js +33 -0
  23. package/bidi/partitionKey.js +17 -0
  24. package/bidi/protocolType.js +20 -0
  25. package/bidi/protocolValue.js +129 -2
  26. package/bidi/provideResponseParameters.js +40 -0
  27. package/bidi/realmInfo.js +27 -0
  28. package/bidi/resultOwnership.js +4 -0
  29. package/bidi/scriptManager.js +119 -1
  30. package/bidi/scriptTypes.js +36 -0
  31. package/bidi/storage.js +30 -0
  32. package/bidi/urlPattern.js +35 -0
  33. package/bin/linux/selenium-manager +0 -0
  34. package/bin/macos/selenium-manager +0 -0
  35. package/bin/windows/selenium-manager.exe +0 -0
  36. package/chromium.js +12 -9
  37. package/common/driverFinder.js +36 -4
  38. package/common/seleniumManager.js +7 -39
  39. package/eslint.config.js +107 -0
  40. package/firefox.js +20 -6
  41. package/http/index.js +6 -6
  42. package/ie.js +8 -4
  43. package/index.js +11 -0
  44. package/io/exec.js +1 -1
  45. package/io/index.js +3 -2
  46. package/io/zip.js +1 -1
  47. package/lib/atoms/find-elements.js +2 -2
  48. package/lib/http.js +5 -4
  49. package/lib/input.js +0 -1
  50. package/lib/pinnedScript.js +1 -1
  51. package/lib/select.js +102 -60
  52. package/lib/until.js +3 -3
  53. package/lib/util.js +1 -0
  54. package/lib/webdriver.js +2 -2
  55. package/net/index.js +1 -1
  56. package/net/portprober.js +1 -1
  57. package/package.json +13 -7
  58. package/remote/index.js +1 -1
  59. package/remote/util.js +2 -2
  60. package/safari.js +3 -3
  61. package/testing/index.js +12 -8
@@ -17,9 +17,21 @@
17
17
 
18
18
  const { BytesValue } = require('./networkTypes')
19
19
 
20
+ /**
21
+ * Represents a partial cookie used to set cookies.
22
+ * Described in https://w3c.github.io/webdriver-bidi/#command-storage-setCookie.
23
+ * @class
24
+ */
20
25
  class PartialCookie {
21
26
  #map = new Map()
22
27
 
28
+ /**
29
+ * Represents a partial cookie.
30
+ * @class
31
+ * @param {string} name - The name of the cookie.
32
+ * @param {BytesValue} value - The value of the cookie as an instance of BytesValue.
33
+ * @param {string} domain - The domain of the cookie.
34
+ */
23
35
  constructor(name, value, domain) {
24
36
  this.#map.set('name', name)
25
37
  if (!(value instanceof BytesValue)) {
@@ -29,31 +41,67 @@ class PartialCookie {
29
41
  this.#map.set('domain', domain)
30
42
  }
31
43
 
44
+ /**
45
+ * Sets the path for the cookie.
46
+ *
47
+ * @param {string} path - The path for the cookie.
48
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
49
+ */
32
50
  path(path) {
33
51
  this.#map.set('path', path)
34
52
  return this
35
53
  }
36
54
 
55
+ /**
56
+ * Sets the size of the cookie.
57
+ *
58
+ * @param {number} size - The size of the cookie.
59
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
60
+ */
37
61
  size(size) {
38
62
  this.#map.set('size', size)
39
63
  return this
40
64
  }
41
65
 
66
+ /**
67
+ * Sets the `httpOnly` flag for the cookie.
68
+ *
69
+ * @param {boolean} httpOnly - The value to set for the `httpOnly` flag.
70
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
71
+ */
42
72
  httpOnly(httpOnly) {
43
73
  this.#map.set('httpOnly', httpOnly)
44
74
  return this
45
75
  }
46
76
 
77
+ /**
78
+ * Sets the secure flag for the cookie.
79
+ *
80
+ * @param {boolean} secure - Indicates whether the cookie should only be sent over secure connections.
81
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
82
+ */
47
83
  secure(secure) {
48
84
  this.#map.set('secure', secure)
49
85
  return this
50
86
  }
51
87
 
88
+ /**
89
+ * Sets the SameSite attribute for the cookie.
90
+ *
91
+ * @param {SameSite} sameSite - The SameSite attribute value for the cookie.
92
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
93
+ */
52
94
  sameSite(sameSite) {
53
95
  this.#map.set('sameSite', sameSite)
54
96
  return this
55
97
  }
56
98
 
99
+ /**
100
+ * Sets the expiry for the cookie.
101
+ *
102
+ * @param {number} expiry - The expiry time of the cookie.
103
+ * @returns {PartialCookie} - The updated PartialCookie instance for chaining.
104
+ */
57
105
  expiry(expiry) {
58
106
  this.#map.set('expiry', expiry)
59
107
  return this
@@ -15,19 +15,37 @@
15
15
  // specific language governing permissions and limitations
16
16
  // under the License.
17
17
 
18
+ /**
19
+ * Represents the types of partition descriptors.
20
+ * @enum {string}
21
+ * Described in https://w3c.github.io/webdriver-bidi/#command-storage-getCookies.
22
+ */
18
23
  const Type = {
19
24
  CONTEXT: 'context',
20
25
  STORAGE_KEY: 'storageKey',
21
26
  }
22
27
 
28
+ /**
29
+ * Represents a partition descriptor.
30
+ * Described in https://w3c.github.io/webdriver-bidi/#command-storage-getCookies.
31
+ */
23
32
  class PartitionDescriptor {
33
+ /*eslint no-unused-private-class-members: "off"*/
24
34
  #type
25
35
 
36
+ /**
37
+ * Constructs a new PartitionDescriptor instance.
38
+ * @param {Type} type - The type of the partition.
39
+ */
26
40
  constructor(type) {
27
41
  this.#type = type
28
42
  }
29
43
  }
30
44
 
45
+ /**
46
+ * Represents a partition descriptor for a browsing context.
47
+ * @extends PartitionDescriptor
48
+ */
31
49
  class BrowsingContextPartitionDescriptor extends PartitionDescriptor {
32
50
  #context = null
33
51
 
@@ -44,6 +62,10 @@ class BrowsingContextPartitionDescriptor extends PartitionDescriptor {
44
62
  }
45
63
  }
46
64
 
65
+ /**
66
+ * Represents a partition descriptor for storage key.
67
+ * @extends PartitionDescriptor
68
+ */
47
69
  class StorageKeyPartitionDescriptor extends PartitionDescriptor {
48
70
  #map = new Map()
49
71
 
@@ -51,11 +73,22 @@ class StorageKeyPartitionDescriptor extends PartitionDescriptor {
51
73
  super(Type.STORAGE_KEY)
52
74
  }
53
75
 
76
+ /**
77
+ * Sets the user context for the partition descriptor.
78
+ * @param {any} userContext - The user context to set.
79
+ * @returns {PartitionDescriptor} - The updated partition descriptor instance for chaining.
80
+ */
54
81
  userContext(userContext) {
55
82
  this.#map.set('userContext', userContext)
56
83
  return this
57
84
  }
58
85
 
86
+ /**
87
+ * Sets the source origin for the partition descriptor.
88
+ *
89
+ * @param {string} sourceOrigin - The source origin to set.
90
+ * @returns {PartitionDescriptor} - The updated PartitionDescriptor instance for chaining.
91
+ */
59
92
  sourceOrigin(sourceOrigin) {
60
93
  this.#map.set('sourceOrigin', sourceOrigin)
61
94
  return this
@@ -15,19 +15,36 @@
15
15
  // specific language governing permissions and limitations
16
16
  // under the License.
17
17
 
18
+ /**
19
+ * Represents a partition key of cookie storage.
20
+ * Described in https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey.
21
+ */
18
22
  class PartitionKey {
19
23
  #userContext
20
24
  #sourceOrigin
21
25
 
26
+ /**
27
+ * Constructs a new PartitionKey object.
28
+ * @param {string} userContext - The user context.
29
+ * @param {string} sourceOrigin - The source origin.
30
+ */
22
31
  constructor(userContext, sourceOrigin) {
23
32
  this.#userContext = userContext
24
33
  this.#sourceOrigin = sourceOrigin
25
34
  }
26
35
 
36
+ /**
37
+ * Gets the user context.
38
+ * @returns {string} The user context.
39
+ */
27
40
  get userContext() {
28
41
  return this.#userContext
29
42
  }
30
43
 
44
+ /**
45
+ * Gets the source origin.
46
+ * @returns {string} The source origin.
47
+ */
31
48
  get sourceOrigin() {
32
49
  return this.#sourceOrigin
33
50
  }
@@ -15,6 +15,11 @@
15
15
  // specific language governing permissions and limitations
16
16
  // under the License.
17
17
 
18
+ /**
19
+ * Represents a primitive type.
20
+ * @enum
21
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
22
+ */
18
23
  const PrimitiveType = {
19
24
  UNDEFINED: 'undefined',
20
25
  NULL: 'null',
@@ -33,6 +38,11 @@ const PrimitiveType = {
33
38
  },
34
39
  }
35
40
 
41
+ /**
42
+ * Represents a non-primitive type.
43
+ * @enum
44
+ * Described inhttps://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
45
+ */
36
46
  const NonPrimitiveType = {
37
47
  ARRAY: 'array',
38
48
  DATE: 'date',
@@ -51,6 +61,11 @@ const NonPrimitiveType = {
51
61
  },
52
62
  }
53
63
 
64
+ /**
65
+ * Represents a remote value type.
66
+ * @enum
67
+ * Described inhttps://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
68
+ */
54
69
  const RemoteType = {
55
70
  SYMBOL: 'symbol',
56
71
  FUNCTION: 'function',
@@ -77,6 +92,11 @@ const RemoteType = {
77
92
  },
78
93
  }
79
94
 
95
+ /**
96
+ * Represents a speacial number type.
97
+ * @enum
98
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
99
+ */
80
100
  const SpecialNumberType = {
81
101
  NAN: 'NaN',
82
102
  MINUS_ZERO: '-0',
@@ -19,11 +19,20 @@ const { PrimitiveType, NonPrimitiveType, RemoteType } = require('./protocolType'
19
19
 
20
20
  const TYPE_CONSTANT = 'type'
21
21
  const VALUE_CONSTANT = 'value'
22
+ /**
23
+ * Represents the types of remote reference.
24
+ * @enum {string}
25
+ */
22
26
  const RemoteReferenceType = {
23
27
  HANDLE: 'handle',
24
28
  SHARED_ID: 'sharedId',
25
29
  }
26
30
 
31
+ /**
32
+ * Represents a local value with a specified type and optional value.
33
+ * @class
34
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-LocalValue
35
+ */
27
36
  class LocalValue {
28
37
  constructor(type, value = null) {
29
38
  if (type === PrimitiveType.UNDEFINED || type === PrimitiveType.NULL) {
@@ -34,42 +43,97 @@ class LocalValue {
34
43
  }
35
44
  }
36
45
 
46
+ /**
47
+ * Creates a new LocalValue object with a string value.
48
+ *
49
+ * @param {string} value - The string value to be stored in the LocalValue object.
50
+ * @returns {LocalValue} - The created LocalValue object.
51
+ */
37
52
  static createStringValue(value) {
38
53
  return new LocalValue(PrimitiveType.STRING, value)
39
54
  }
40
55
 
56
+ /**
57
+ * Creates a new LocalValue object with a number value.
58
+ *
59
+ * @param {number} value - The number value.
60
+ * @returns {LocalValue} - The created LocalValue object.
61
+ */
41
62
  static createNumberValue(value) {
42
63
  return new LocalValue(PrimitiveType.NUMBER, value)
43
64
  }
44
65
 
66
+ /**
67
+ * Creates a new LocalValue object with a special number value.
68
+ *
69
+ * @param {number} value - The value of the special number.
70
+ * @returns {LocalValue} - The created LocalValue object.
71
+ */
45
72
  static createSpecialNumberValue(value) {
46
73
  return new LocalValue(PrimitiveType.SPECIAL_NUMBER, value)
47
74
  }
48
75
 
76
+ /**
77
+ * Creates a new LocalValue object with an undefined value.
78
+ * @returns {LocalValue} - The created LocalValue object.
79
+ */
49
80
  static createUndefinedValue() {
50
81
  return new LocalValue(PrimitiveType.UNDEFINED)
51
82
  }
52
83
 
84
+ /**
85
+ * Creates a new LocalValue object with a null value.
86
+ * @returns {LocalValue} - The created LocalValue object.
87
+ */
53
88
  static createNullValue() {
54
89
  return new LocalValue(PrimitiveType.NULL)
55
90
  }
56
91
 
92
+ /**
93
+ * Creates a new LocalValue object with a boolean value.
94
+ *
95
+ * @param {boolean} value - The boolean value.
96
+ * @returns {LocalValue} - The created LocalValue object.
97
+ */
57
98
  static createBooleanValue(value) {
58
99
  return new LocalValue(PrimitiveType.BOOLEAN, value)
59
100
  }
60
101
 
102
+ /**
103
+ * Creates a new LocalValue object with a BigInt value.
104
+ *
105
+ * @param {BigInt} value - The BigInt value.
106
+ * @returns {LocalValue} - The created LocalValue object.
107
+ */
61
108
  static createBigIntValue(value) {
62
109
  return new LocalValue(PrimitiveType.BIGINT, value)
63
110
  }
64
111
 
112
+ /**
113
+ * Creates a new LocalValue object with an array.
114
+ *
115
+ * @param {Array} value - The array.
116
+ * @returns {LocalValue} - The created LocalValue object.
117
+ */
65
118
  static createArrayValue(value) {
66
119
  return new LocalValue(NonPrimitiveType.ARRAY, value)
67
120
  }
68
121
 
122
+ /**
123
+ * Creates a new LocalValue object with date value.
124
+ *
125
+ * @param {string} value - The date.
126
+ * @returns {LocalValue} - The created LocalValue object.
127
+ */
69
128
  static createDateValue(value) {
70
129
  return new LocalValue(NonPrimitiveType.DATE, value)
71
130
  }
72
131
 
132
+ /**
133
+ * Creates a new LocalValue object of map value.
134
+ * @param {Map} map - The map.
135
+ * @returns {LocalValue} - The created LocalValue object.
136
+ */
73
137
  static createMapValue(map) {
74
138
  let value = []
75
139
  Object.entries(map).forEach((entry) => {
@@ -78,22 +142,45 @@ class LocalValue {
78
142
  return new LocalValue(NonPrimitiveType.MAP, value)
79
143
  }
80
144
 
81
- static createObjectValue(map) {
145
+ /**
146
+ * Creates a new LocalValue object from the passed object.
147
+ *
148
+ * @param {Object} map - The object.
149
+ * @returns {LocalValue} - The created LocalValue object.
150
+ */
151
+ static createObjectValue(object) {
82
152
  let value = []
83
- Object.entries(map).forEach((entry) => {
153
+ Object.entries(object).forEach((entry) => {
84
154
  value.push(entry)
85
155
  })
86
156
  return new LocalValue(NonPrimitiveType.OBJECT, value)
87
157
  }
88
158
 
159
+ /**
160
+ * Creates a new LocalValue object of regular expression value.
161
+ *
162
+ * @param {string} value - The value of the regular expression.
163
+ * @returns {LocalValue} - The created LocalValue object.
164
+ */
89
165
  static createRegularExpressionValue(value) {
90
166
  return new LocalValue(NonPrimitiveType.REGULAR_EXPRESSION, value)
91
167
  }
92
168
 
169
+ /**
170
+ * Creates a new LocalValue object with the specified value.
171
+ * @param {Set} value - The value to be set.
172
+ * @returns {LocalValue} - The created LocalValue object.
173
+ */
93
174
  static createSetValue(value) {
94
175
  return new LocalValue(NonPrimitiveType.SET, value)
95
176
  }
96
177
 
178
+ /**
179
+ * Creates a new LocalValue object with the given channel value
180
+ *
181
+ * @param {ChannelValue} value - The channel value.
182
+ * @returns {LocalValue} - The created LocalValue object.
183
+ */
97
184
  static createChannelValue(value) {
98
185
  return new LocalValue(NonPrimitiveType.CHANNEL, value)
99
186
  }
@@ -109,6 +196,11 @@ class LocalValue {
109
196
  }
110
197
  }
111
198
 
199
+ /**
200
+ * Represents a remote value.
201
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
202
+ * @class
203
+ */
112
204
  class RemoteValue {
113
205
  constructor(remoteValue) {
114
206
  this.type = null
@@ -159,9 +251,19 @@ class RemoteValue {
159
251
  }
160
252
  }
161
253
 
254
+ /**
255
+ * Represents a reference value in the protocol.
256
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteReference.
257
+ */
162
258
  class ReferenceValue {
163
259
  #handle
164
260
  #sharedId
261
+
262
+ /**
263
+ * Constructs a new ReferenceValue object.
264
+ * @param {string} handle - The handle value.
265
+ * @param {string} sharedId - The shared ID value.
266
+ */
165
267
  constructor(handle, sharedId) {
166
268
  if (handle === RemoteReferenceType.HANDLE) {
167
269
  this.#handle = sharedId
@@ -187,14 +289,34 @@ class ReferenceValue {
187
289
  }
188
290
  }
189
291
 
292
+ /**
293
+ * Represents a regular expression value.
294
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-LocalValue.
295
+ */
190
296
  class RegExpValue {
297
+ /**
298
+ * Constructs a new RegExpValue object.
299
+ * @param {string} pattern - The pattern of the regular expression.
300
+ * @param {string|null} [flags=null] - The flags of the regular expression.
301
+ */
191
302
  constructor(pattern, flags = null) {
192
303
  this.pattern = pattern
193
304
  this.flags = flags
194
305
  }
195
306
  }
196
307
 
308
+ /**
309
+ * Represents serialization options.
310
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-SerializationOptions.
311
+ */
197
312
  class SerializationOptions {
313
+ /**
314
+ * Constructs a new instance of SerializationOptions.
315
+ * @param {number} [maxDomDepth=0] - The maximum depth to serialize the DOM.
316
+ * @param {number|null} [maxObjectDepth=null] - The maximum depth to serialize objects.
317
+ * @param {'none'|'open'|'all'} [includeShadowTree='none'] - The inclusion level of the shadow tree.
318
+ * @throws {Error} If the `includeShadowTree` value is not one of 'none', 'open', or 'all'.
319
+ */
198
320
  constructor(maxDomDepth = 0, maxObjectDepth = null, includeShadowTree = 'none') {
199
321
  this._maxDomDepth = maxDomDepth
200
322
  this._maxObjectDepth = maxObjectDepth
@@ -206,6 +328,11 @@ class SerializationOptions {
206
328
  }
207
329
  }
208
330
 
331
+ /**
332
+ * Represents a channel value.
333
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-ChannelValue.
334
+ * @class
335
+ */
209
336
  class ChannelValue {
210
337
  constructor(channel, options = undefined, resultOwnership = undefined) {
211
338
  this.channel = channel
@@ -17,6 +17,11 @@
17
17
 
18
18
  const { BytesValue, Header } = require('./networkTypes')
19
19
 
20
+ /**
21
+ * Represents parameters for providingResponse command.
22
+ * Described in https://w3c.github.io/webdriver-bidi/#command-network-provideResponse.
23
+ * @class
24
+ */
20
25
  class ProvideResponseParameters {
21
26
  #map = new Map()
22
27
 
@@ -24,6 +29,13 @@ class ProvideResponseParameters {
24
29
  this.#map.set('request', request)
25
30
  }
26
31
 
32
+ /**
33
+ * Sets the body value for the response parameters.
34
+ *
35
+ * @param {BytesValue} value - The value to set as the body. Must be an instance of BytesValue.
36
+ * @returns {ProvideResponseParameters} - Returns the ProvideResponseParameters object for chaining.
37
+ * @throws {Error} - Throws an error if the value is not an instance of BytesValue.
38
+ */
27
39
  body(value) {
28
40
  if (!(value instanceof BytesValue)) {
29
41
  throw new Error(`Value must be an instance of BytesValue. Received: ${typeof value} with value: ${value}`)
@@ -32,6 +44,13 @@ class ProvideResponseParameters {
32
44
  return this
33
45
  }
34
46
 
47
+ /**
48
+ * Sets the cookie headers for the response.
49
+ *
50
+ * @param {Header[]} cookieHeaders - An array of cookie headers.
51
+ * @returns {ProvideResponseParameters} - Returns the ProvideResponseParameters object for chaining.
52
+ * @throws {Error} - Throws an error if a cookie header is not an instance of Header.
53
+ */
35
54
  cookies(cookieHeaders) {
36
55
  const cookies = []
37
56
  cookieHeaders.forEach((header) => {
@@ -45,6 +64,13 @@ class ProvideResponseParameters {
45
64
  return this
46
65
  }
47
66
 
67
+ /**
68
+ * Sets the headers for the response.
69
+ *
70
+ * @param {Header[]} headers - The headers to be set.
71
+ * @returns {ProvideResponseParameters} - Returns the ProvideResponseParameters object for chaining.
72
+ * @throws {Error} - If the provided header is not an instance of Header.
73
+ */
48
74
  headers(headers) {
49
75
  const headerList = []
50
76
  headers.forEach((header) => {
@@ -58,6 +84,13 @@ class ProvideResponseParameters {
58
84
  return this
59
85
  }
60
86
 
87
+ /**
88
+ * Sets the reason phrase for the response.
89
+ *
90
+ * @param {string} reasonPhrase - The reason phrase to set.
91
+ * @returns {ProvideResponseParameters} - Returns the ProvideResponseParameters object for chaining.
92
+ * @throws {Error} - If the reason phrase is not a string.
93
+ */
61
94
  reasonPhrase(reasonPhrase) {
62
95
  if (typeof reasonPhrase !== 'string') {
63
96
  throw new Error(`Reason phrase must be a string. Received: '${reasonPhrase})'`)
@@ -66,6 +99,13 @@ class ProvideResponseParameters {
66
99
  return this
67
100
  }
68
101
 
102
+ /**
103
+ * Sets the status code for the response.
104
+ *
105
+ * @param {number} statusCode - The status code to set.
106
+ * @returns {ProvideResponseParameters} - Returns the ProvideResponseParameters object for chaining.
107
+ * @throws {Error} - If the status code is not an integer.
108
+ */
69
109
  statusCode(statusCode) {
70
110
  if (!Number.isInteger(statusCode)) {
71
111
  throw new Error(`Status must be an integer. Received:'${statusCode}'`)
package/bidi/realmInfo.js CHANGED
@@ -15,6 +15,11 @@
15
15
  // specific language governing permissions and limitations
16
16
  // under the License.
17
17
 
18
+ /**
19
+ * Represents the types of realms.
20
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-RealmType.
21
+ * @enum
22
+ */
18
23
  const RealmType = {
19
24
  AUDIO_WORKLET: 'audio-worklet',
20
25
  DEDICATED_WORKER: 'dedicated-worker',
@@ -34,7 +39,17 @@ const RealmType = {
34
39
  },
35
40
  }
36
41
 
42
+ /**
43
+ * Represents information about a realm.
44
+ * Described in https://w3c.github.io/webdriver-bidi/#type-script-RealmInfo.
45
+ */
37
46
  class RealmInfo {
47
+ /**
48
+ * Constructs a new RealmInfo object.
49
+ * @param {string} realmId - The ID of the realm.
50
+ * @param {string} origin - The origin of the realm.
51
+ * @param {string} realmType - The type of the realm.
52
+ */
38
53
  constructor(realmId, origin, realmType) {
39
54
  this.realmId = realmId
40
55
  this.origin = origin
@@ -77,7 +92,19 @@ class RealmInfo {
77
92
  }
78
93
  }
79
94
 
95
+ /**
96
+ * Represents information about a window realm.
97
+ * @extends RealmInfo
98
+ */
80
99
  class WindowRealmInfo extends RealmInfo {
100
+ /**
101
+ * Constructs a new instance of the WindowRealmInfo class.
102
+ * @param {string} realmId - The ID of the realm.
103
+ * @param {string} origin - The origin of the realm.
104
+ * @param {string} realmType - The type of the realm.
105
+ * @param {string} browsingContext - The browsing context of the realm.
106
+ * @param {string|null} sandbox - The sandbox of the realm (optional).
107
+ */
81
108
  constructor(realmId, origin, realmType, browsingContext, sandbox = null) {
82
109
  super(realmId, origin, realmType)
83
110
  this.browsingContext = browsingContext
@@ -15,6 +15,10 @@
15
15
  // specific language governing permissions and limitations
16
16
  // under the License.
17
17
 
18
+ /**
19
+ * Enum representing the ownership types.
20
+ * @enum {string}
21
+ */
18
22
  const ResultOwnership = {
19
23
  ROOT: 'root',
20
24
  NONE: 'none',