Skip to content

Commit a2d43e9

Browse files
authored
Merge branch 'trunk' into pinned-browser-updates
2 parents c45ed61 + a9348cf commit a2d43e9

File tree

27 files changed

+53
-39
lines changed

27 files changed

+53
-39
lines changed

java/src/org/openqa/selenium/Capabilities.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
import java.util.Optional;
2525
import java.util.Set;
2626
import java.util.stream.Stream;
27+
import org.jspecify.annotations.NullMarked;
28+
import org.jspecify.annotations.Nullable;
2729

2830
/** Describes a series of key/value pairs that encapsulate aspects of a browser. */
31+
@NullMarked
2932
public interface Capabilities extends Serializable {
3033

3134
default String getBrowserName() {
3235
return String.valueOf(Optional.ofNullable(getCapability("browserName")).orElse(""));
3336
}
3437

35-
default Platform getPlatformName() {
38+
default @Nullable Platform getPlatformName() {
3639
return Stream.of("platformName")
3740
.map(this::getCapability)
3841
.filter(Objects::nonNull)
@@ -67,7 +70,7 @@ default String getBrowserVersion() {
6770
* @return The value, or null if not set.
6871
* @see org.openqa.selenium.remote.CapabilityType
6972
*/
70-
Object getCapability(String capabilityName);
73+
@Nullable Object getCapability(String capabilityName);
7174

7275
/**
7376
* @param capabilityName The capability to check.

java/src/org/openqa/selenium/HasCapabilities.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
2022
/**
2123
* Used by classes to indicate that they can describe the {@link org.openqa.selenium.Capabilities}
2224
* they possess. This can be used for run-time detection of features.
2325
*/
26+
@NullMarked
2427
public interface HasCapabilities {
2528
/**
2629
* @return The capabilities of the current driver.

java/src/org/openqa/selenium/ImmutableCapabilities.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.Collections;
2323
import java.util.Map;
2424
import java.util.TreeMap;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class ImmutableCapabilities implements Capabilities {
2831

2932
private final Map<String, Object> delegate;
@@ -145,18 +148,17 @@ public ImmutableCapabilities(Map<?, ?> capabilities) {
145148
capabilities.forEach(
146149
(key, value) -> {
147150
Require.argument("Capability key", key).instanceOf(String.class);
148-
Object v = capabilities.get(key);
149151
Require.nonNull("Capability value", value);
150152

151-
setCapability(delegate, (String) key, v);
153+
setCapability(delegate, (String) key, value);
152154
});
153155

154156
this.delegate = Collections.unmodifiableMap(delegate);
155157
this.hashCode = SharedCapabilitiesMethods.hashCode(this);
156158
}
157159

158160
@Override
159-
public Object getCapability(String capabilityName) {
161+
public @Nullable Object getCapability(String capabilityName) {
160162
Require.nonNull("Capability name", capabilityName);
161163
return delegate.get(capabilityName);
162164
}
@@ -172,7 +174,7 @@ public int hashCode() {
172174
}
173175

174176
@Override
175-
public boolean equals(Object o) {
177+
public boolean equals(@Nullable Object o) {
176178
if (!(o instanceof Capabilities)) {
177179
return false;
178180
}

java/src/org/openqa/selenium/MutableCapabilities.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.Map;
2323
import java.util.Set;
2424
import java.util.TreeMap;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class MutableCapabilities implements Capabilities {
2831

2932
private static final Set<String> OPTION_KEYS;
@@ -81,7 +84,7 @@ public void setCapability(String capabilityName, Platform value) {
8184
setCapability(capabilityName, (Object) value);
8285
}
8386

84-
public void setCapability(String key, Object value) {
87+
public void setCapability(String key, @Nullable Object value) {
8588
Require.nonNull("Capability name", key);
8689

8790
// We have to special-case some keys and values because of the popular idiom of calling
@@ -107,7 +110,7 @@ public Map<String, Object> asMap() {
107110
}
108111

109112
@Override
110-
public Object getCapability(String capabilityName) {
113+
public @Nullable Object getCapability(String capabilityName) {
111114
return caps.get(capabilityName);
112115
}
113116

@@ -126,7 +129,7 @@ public int hashCode() {
126129
}
127130

128131
@Override
129-
public boolean equals(Object o) {
132+
public boolean equals(@Nullable Object o) {
130133
if (!(o instanceof Capabilities)) {
131134
return false;
132135
}

java/src/org/openqa/selenium/PersistentCapabilities.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.function.Function;
2323
import java.util.stream.Collectors;
2424
import java.util.stream.Stream;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class PersistentCapabilities implements Capabilities {
2831

2932
private final ImmutableCapabilities caps;
@@ -60,7 +63,7 @@ public Map<String, Object> asMap() {
6063
}
6164

6265
@Override
63-
public Object getCapability(String capabilityName) {
66+
public @Nullable Object getCapability(String capabilityName) {
6467
Require.nonNull("Capability name", capabilityName);
6568
Object capability = overrides.getCapability(capabilityName);
6669
if (capability != null) {
@@ -93,7 +96,7 @@ public int hashCode() {
9396
}
9497

9598
@Override
96-
public boolean equals(Object o) {
99+
public boolean equals(@Nullable Object o) {
97100
if (!(o instanceof Capabilities)) {
98101
return false;
99102
}

javascript/atoms/html5/database.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bot.storage.database.executeSql = function(databaseName, query, args,
109109
bot.storage.database.ResultSet = function(sqlResultSet) {
110110

111111
/**
112-
* The database rows retuned from the SQL query.
112+
* The database rows returned from the SQL query.
113113
* @type {!Array.<*>}
114114
*/
115115
this.rows = [];

javascript/atoms/html5/html5_browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ bot.html5.isSupported = function(api, opt_window) {
142142
return false;
143143
}
144144
return goog.isDefAndNotNull(win.sessionStorage) &&
145-
// To avoid browsers that only support this API partically
145+
// To avoid browsers that only support this API partially
146146
// like some versions of FF.
147147
goog.isDefAndNotNull(win.sessionStorage.clear);
148148

javascript/atoms/html5/storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ goog.require('bot.html5');
4040
* We use bot.window() from bot.js instead to keep track of the window or frame
4141
* is currently being used for command execution. The implementation is
4242
* otherwise similar to the implementation in the Closure library
43-
* (goog.storage.mechansim.HTML5LocalStorage).
43+
* (goog.storage.mechanism.HTML5LocalStorage).
4444
*
4545
* @param {Window=} opt_window The window whose storage to access;
4646
* defaults to the main window.

javascript/atoms/test/html5/database_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
var onTxSuccess = onQueryResult;
122122
var onTxFailure = success;
123123

124-
// WITH is errorneously used instead of WHERE
124+
// WITH is erroneously used instead of WHERE
125125
bot.storage.database.executeSql('testDB',
126126
'SELECT * from docids WITH id = 1', [],
127127
onQueryResult,

javascript/atoms/test/opacity_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<!-- opacity test fixture -->
9494
<p>
9595
To determine opacity, it is not enough to simply read a property
96-
value but some visual inpection is needed in order to verify if
96+
value but some visual inspection is needed in order to verify if
9797
the property is applied. This is specially true in IE which is
9898
vey sensible to the syntax of the filter property.
9999
</p>

0 commit comments

Comments
 (0)