Skip to content

Commit f1bace1

Browse files
Merge branch 'SeleniumHQ:trunk' into pattern_improvements
2 parents b504bb3 + 8f09638 commit f1bace1

File tree

9 files changed

+45
-16
lines changed

9 files changed

+45
-16
lines changed

java/src/org/openqa/selenium/html5/AppCacheStatus.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
package org.openqa.selenium.html5;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** Represents the application cache status. */
2124
@Deprecated
25+
@NullMarked
2226
public enum AppCacheStatus {
2327
UNCACHED(0),
2428
IDLE(1),
@@ -43,7 +47,7 @@ public int value() {
4347
* @param value The input value
4448
* @return {@link AppCacheStatus} The corresponding appcache status
4549
*/
46-
public static AppCacheStatus getEnum(int value) {
50+
public static @Nullable AppCacheStatus getEnum(int value) {
4751
for (AppCacheStatus status : AppCacheStatus.values()) {
4852
if (value == status.value()) {
4953
return status;
@@ -52,7 +56,7 @@ public static AppCacheStatus getEnum(int value) {
5256
return null;
5357
}
5458

55-
public static AppCacheStatus getEnum(String value) {
59+
public static @Nullable AppCacheStatus getEnum(String value) {
5660
for (AppCacheStatus status : AppCacheStatus.values()) {
5761
if (status.toString().equalsIgnoreCase(value)) {
5862
return status;

java/src/org/openqa/selenium/interactions/Coordinates.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717

1818
package org.openqa.selenium.interactions;
1919

20+
import org.jspecify.annotations.NullMarked;
2021
import org.openqa.selenium.Point;
2122

2223
/**
2324
* Provides coordinates of an element for advanced interactions. Note that some coordinates (such as
2425
* screen coordinates) are evaluated lazily since the element may have to be scrolled into view.
2526
*/
27+
@NullMarked
2628
public interface Coordinates {
2729

2830
/**

java/src/org/openqa/selenium/interactions/Interactive.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
package org.openqa.selenium.interactions;
1919

2020
import java.util.Collection;
21+
import org.jspecify.annotations.NullMarked;
2122

2223
/**
2324
* Indicates that a class can be used with the W3C WebDriver <a
2425
* href="https://www.w3.org/TR/webdriver/#actions">Actions commands</a>.
2526
*/
27+
@NullMarked
2628
public interface Interactive {
2729
void perform(Collection<Sequence> actions);
2830

java/src/org/openqa/selenium/interactions/SourceType.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@
1717

1818
package org.openqa.selenium.interactions;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
2023
/** One of the allowing types for an {@link InputSource}. */
24+
@NullMarked
2125
public enum SourceType {
2226
KEY("key"),
2327
NONE(null),
2428
POINTER("pointer"),
2529
WHEEL("wheel");
2630

27-
private final String type;
31+
private final @Nullable String type;
2832

29-
SourceType(String type) {
33+
SourceType(@Nullable String type) {
3034
this.type = type;
3135
}
3236

33-
public String getType() {
37+
public @Nullable String getType() {
3438
return type;
3539
}
3640
}

java/src/org/openqa/selenium/internal/Either.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
import java.util.Iterator;
2222
import java.util.function.Function;
2323
import java.util.stream.Stream;
24+
import org.jspecify.annotations.NullMarked;
25+
import org.jspecify.annotations.Nullable;
2426

25-
public class Either<A, B> implements Iterable<B> {
27+
@NullMarked
28+
public class Either<A extends @Nullable Object, B extends @Nullable Object> implements Iterable<B> {
2629
private final A left;
2730
private final B right;
2831

@@ -31,11 +34,11 @@ private Either(A a, B b) {
3134
right = b;
3235
}
3336

34-
public static <A, B> Either<A, B> left(A a) {
37+
public static <A extends @Nullable Object, B extends @Nullable Object> Either<A, B> left(A a) {
3538
return new Either<>(a, null);
3639
}
3740

38-
public static <A, B> Either<A, B> right(B b) {
41+
public static <A extends @Nullable Object, B extends @Nullable Object> Either<A, B> right(B b) {
3942
return new Either<>(null, b);
4043
}
4144

java/src/org/openqa/selenium/virtualauthenticator/Credential.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,21 @@ public static Credential createResidentCredential(
6363

6464
/** Creates a credential from a map. */
6565
public static Credential fromMap(Map<String, Object> map) {
66+
Object credentialId = Require.nonNull("credentialId", map.get("credentialId"));
67+
Object isResidentCredential =
68+
Require.nonNull("isResidentCredential", map.get("isResidentCredential"));
69+
Object rpId = Require.nonNull("rpId", map.get("rpId"));
70+
Object privateKey = Require.nonNull("privateKey", map.get("privateKey"));
71+
Object userHandle = map.get("userHandle");
72+
Object signCount = Require.nonNull("signCount", map.get("signCount"));
6673
Base64.Decoder decoder = Base64.getUrlDecoder();
6774
return new Credential(
68-
decoder.decode((String) map.get("credentialId")),
69-
(boolean) map.get("isResidentCredential"),
70-
(String) map.get("rpId"),
71-
new PKCS8EncodedKeySpec(decoder.decode((String) map.get("privateKey"))),
72-
map.get("userHandle") == null ? null : decoder.decode((String) map.get("userHandle")),
73-
((Long) map.get("signCount")).intValue());
75+
decoder.decode((String) credentialId),
76+
(boolean) isResidentCredential,
77+
(String) rpId,
78+
new PKCS8EncodedKeySpec(decoder.decode((String) privateKey)),
79+
userHandle == null ? null : decoder.decode((String) userHandle),
80+
((Long) signCount).intValue());
7481
}
7582

7683
private Credential(

rb/lib/selenium/webdriver/remote/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def add_cookie(cookie)
323323
end
324324

325325
def delete_cookie(name)
326-
raise ArgumentError, 'Cookie name cannot be null or empty' if name.nil? || name.strip.empty?
326+
raise ArgumentError, 'Cookie name cannot be null or empty' if name.nil? || name.to_s.strip.empty?
327327

328328
execute :delete_cookie, name: name
329329
end

rb/spec/integration/selenium/webdriver/manager_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ module WebDriver
268268
expect { driver.manage.delete_cookie(nil) }
269269
.to raise_error(ArgumentError, /Cookie name cannot be null or empty/)
270270
end
271+
272+
it 'allows deleting a cookies using a symbol' do
273+
driver.manage.add_cookie name: :foo, value: 'bar'
274+
driver.manage.delete_cookie(:foo)
275+
expect(driver.manage.all_cookies).to be_empty
276+
end
271277
end
272278
end # Options
273279
end # WebDriver

rust/tests/browser_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use crate::common::{assert_output, get_selenium_manager, get_stdout};
2020
use exitcode::DATAERR;
2121
use rstest::rstest;
2222
use std::env::consts::OS;
23+
use std::path::Path;
2324

2425
mod common;
2526

@@ -134,7 +135,7 @@ fn invalid_geckodriver_version_test() {
134135
r"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
135136
)]
136137
fn browser_path_test(#[case] os: String, #[case] browser: String, #[case] browser_path: String) {
137-
if OS.eq(&os) {
138+
if OS.eq(&os) && Path::new(&browser_path).exists() {
138139
let mut cmd = get_selenium_manager();
139140
cmd.args(["--browser", &browser, "--browser-path", &browser_path])
140141
.assert()

0 commit comments

Comments
 (0)