Skip to content

Commit 6f046ab

Browse files
committed
fix storage module instance checks
1 parent 05ab017 commit 6f046ab

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

javascript/node/selenium-webdriver/bidi/partitionDescriptor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class StorageKeyPartitionDescriptor extends PartitionDescriptor {
7171

7272
constructor() {
7373
super(Type.STORAGE_KEY)
74+
this.#map.set('type', Type.STORAGE_KEY)
7475
}
7576

7677
/**

javascript/node/selenium-webdriver/bidi/storage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Storage {
5555

5656
if (
5757
partition !== undefined &&
58-
!(partition instanceof (BrowsingContextPartitionDescriptor || StorageKeyPartitionDescriptor))
58+
!(partition instanceof BrowsingContextPartitionDescriptor || partition instanceof StorageKeyPartitionDescriptor)
5959
) {
6060
throw new Error(`Params must be an instance of PartitionDescriptor. Received:'${partition}'`)
6161
}
@@ -118,7 +118,7 @@ class Storage {
118118

119119
if (
120120
partition !== undefined &&
121-
!(partition instanceof (BrowsingContextPartitionDescriptor || StorageKeyPartitionDescriptor))
121+
!(partition instanceof BrowsingContextPartitionDescriptor || partition instanceof StorageKeyPartitionDescriptor)
122122
) {
123123
throw new Error(`Params must be an instance of PartitionDescriptor. Received:'${partition}'`)
124124
}
@@ -158,7 +158,7 @@ class Storage {
158158

159159
if (
160160
partition !== undefined &&
161-
!(partition instanceof (BrowsingContextPartitionDescriptor || StorageKeyPartitionDescriptor))
161+
!(partition instanceof BrowsingContextPartitionDescriptor || partition instanceof StorageKeyPartitionDescriptor)
162162
) {
163163
throw new Error(`Params must be an instance of PartitionDescriptor. Received:'${partition}'`)
164164
}

javascript/node/selenium-webdriver/lib/test/fileserver.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ function sendIndex(request, response) {
331331
response.end(data)
332332
}
333333

334+
/**
335+
* Detects the hostname.
336+
* @return {string} The detected hostname or 'localhost' if not found.
337+
*/
338+
function getHostName() {
339+
const hostnameFromEnv = process.env.HOSTNAME
340+
return hostnameFromEnv ? hostnameFromEnv : 'localhost'
341+
}
342+
334343
// PUBLIC application
335344

336345
/**
@@ -372,6 +381,8 @@ exports.whereIs = function (filePath) {
372381
return server.url(filePath)
373382
}
374383

384+
exports.getHostName = getHostName;
385+
375386
exports.Pages = Pages
376387

377388
if (require.main === module) {

0 commit comments

Comments
 (0)