Skip to content

Commit 4683d52

Browse files
Merge branch 'trunk' into devtools-json
2 parents c914ea2 + 335c14c commit 4683d52

File tree

39 files changed

+1381
-475
lines changed

39 files changed

+1381
-475
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2024 Software Freedom Conservancy (SFC)
190+
Copyright 2025 Software Freedom Conservancy (SFC)
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

MODULE.bazel

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bazel_dep(name = "rules_dotnet", version = "0.17.5")
2121
bazel_dep(name = "rules_java", version = "7.12.4")
2222
bazel_dep(name = "rules_jvm_external", version = "6.6")
2323
bazel_dep(name = "rules_nodejs", version = "6.3.2")
24-
bazel_dep(name = "rules_oci", version = "1.7.6")
24+
bazel_dep(name = "rules_oci", version = "1.8.0")
2525
bazel_dep(name = "rules_pkg", version = "0.10.1")
2626
bazel_dep(name = "rules_python", version = "0.33.0")
2727
bazel_dep(name = "rules_proto", version = "6.0.2")
@@ -173,15 +173,15 @@ maven.install(
173173
"com.github.spotbugs:spotbugs:4.8.6",
174174
"com.github.stephenc.jcip:jcip-annotations:1.0-1",
175175
"com.google.code.gson:gson:2.11.0",
176-
"com.google.guava:guava:33.3.1-jre",
176+
"com.google.guava:guava:33.4.0-jre",
177177
"com.google.auto:auto-common:1.2.2",
178178
"com.google.auto.service:auto-service:1.1.1",
179179
"com.google.auto.service:auto-service-annotations:1.1.1",
180180
"com.google.googlejavaformat:google-java-format:1.25.2:1.25.0",
181181
"com.graphql-java:graphql-java:22.3",
182182
"dev.failsafe:failsafe:3.3.2",
183-
"io.grpc:grpc-context:1.68.1",
184-
"io.lettuce:lettuce-core:6.5.1.RELEASE",
183+
"io.grpc:grpc-context:1.69.0",
184+
"io.lettuce:lettuce-core:6.5.2.RELEASE",
185185
"io.netty:netty-buffer",
186186
"io.netty:netty-codec-http",
187187
"io.netty:netty-codec-http2",
@@ -201,10 +201,10 @@ maven.install(
201201
"io.opentelemetry.semconv:opentelemetry-semconv:1.28.0-alpha",
202202
"it.ozimov:embedded-redis:0.7.3",
203203
"net.bytebuddy:byte-buddy:1.15.11",
204-
"org.htmlunit:htmlunit-core-js:4.6.0",
204+
"org.htmlunit:htmlunit-core-js:4.7.0",
205205
"org.apache.commons:commons-exec:1.4.0",
206206
"org.apache.logging.log4j:log4j-core:2.24.3",
207-
"org.assertj:assertj-core:3.26.3",
207+
"org.assertj:assertj-core:3.27.2",
208208
"org.bouncycastle:bcpkix-jdk18on:1.79",
209209
"org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5",
210210
"org.hsqldb:hsqldb:2.7.4",

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Copyright 2011-2024 Software Freedom Conservancy
1+
Copyright 2011-2025 Software Freedom Conservancy
22
Copyright 2004-2011 Selenium committers

common/mirror/selenium

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
[
22
{
33
"tag_name": "nightly",
4-
"assets": [
5-
{
6-
"browser_download_url": "https://github.com/SeleniumHQ/selenium/releases/download/nightly/selenium-java-4.28.0-SNAPSHOT.zip"
7-
},
8-
{
9-
"browser_download_url": "https://github.com/SeleniumHQ/selenium/releases/download/nightly/selenium-server-4.28.0-SNAPSHOT.jar"
10-
},
11-
{
12-
"browser_download_url": "https://github.com/SeleniumHQ/selenium/releases/download/nightly/selenium-server-4.28.0-SNAPSHOT.zip"
13-
}
14-
]
4+
"assets": []
155
},
166
{
177
"tag_name": "selenium-4.27.0",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>FedCM Example</title>
5+
</head>
6+
<body>
7+
<button id="triggerButton" onclick="triggerFedCm()">Trigger FedCM</button>
8+
<div id="result"></div>
9+
10+
<script>
11+
// Use a relative path for the configURL
12+
let configURL = `http://${location.host}/common/fedcm/config.json`;
13+
console.log(configURL)
14+
let result = null;
15+
16+
async function triggerFedCm() {
17+
console.log("Config URL:", configURL);
18+
try {
19+
let promise = await navigator.credentials.get({
20+
identity: {
21+
providers: [{
22+
configURL: configURL,
23+
clientId: '1',
24+
}]
25+
}
26+
});
27+
result = promise;
28+
29+
console.log("Promised!")
30+
console.log(result)
31+
document.getElementById('result').innerText = JSON.stringify(result);
32+
} catch (error) {
33+
console.error("FedCM Error:", error);
34+
result = { error: error.message };
35+
document.getElementById('result').innerText = JSON.stringify(result);
36+
}
37+
}
38+
</script>
39+
</body>
40+
</html>

dotnet/src/webdriver/Remote/HttpCommandExecutor.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ private async Task<HttpResponseInfo> MakeHttpRequest(HttpRequestInfo requestInfo
316316

317317
private Response CreateResponse(HttpResponseInfo responseInfo)
318318
{
319-
Response response = new Response();
319+
Response response;
320320
string body = responseInfo.Body;
321321
if ((int)responseInfo.StatusCode < 200 || (int)responseInfo.StatusCode > 299)
322322
{
@@ -326,8 +326,7 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
326326
}
327327
else
328328
{
329-
response.Status = WebDriverResult.UnknownError;
330-
response.Value = body;
329+
response = new Response(sessionId: null, body, WebDriverResult.UnknownError);
331330
}
332331
}
333332
else if (responseInfo.ContentType != null && responseInfo.ContentType.StartsWith(JsonMimeType, StringComparison.OrdinalIgnoreCase))
@@ -336,12 +335,12 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
336335
}
337336
else
338337
{
339-
response.Value = body;
338+
response = new Response(sessionId: null, body, WebDriverResult.Success);
340339
}
341340

342-
if (response.Value is string)
341+
if (response.Value is string valueString)
343342
{
344-
response.Value = ((string)response.Value).Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
343+
response.Value = valueString.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
345344
}
346345

347346
return response;

dotnet/src/webdriver/Response.cs

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
using System.Text.Json;
2525
using System.Text.Json.Serialization;
2626

27+
#nullable enable
28+
2729
namespace OpenQA.Selenium
2830
{
2931
/// <summary>
@@ -48,88 +50,98 @@ public Response()
4850
/// Initializes a new instance of the <see cref="Response"/> class
4951
/// </summary>
5052
/// <param name="sessionId">Session ID in use</param>
51-
public Response(SessionId sessionId)
53+
public Response(SessionId? sessionId)
5254
{
53-
if (sessionId != null)
54-
{
55-
this.SessionId = sessionId.ToString();
56-
}
55+
this.SessionId = sessionId?.ToString();
56+
}
57+
58+
/// <summary>
59+
/// Initializes a new instance of the <see cref="Response"/> class
60+
/// </summary>
61+
/// <param name="sessionId">The Session ID in use, if any.</param>
62+
/// <param name="value">The JSON payload of the response.</param>
63+
/// <param name="status">The WebDriver result status of the response.</param>
64+
public Response(string? sessionId, object? value, WebDriverResult status)
65+
{
66+
this.SessionId = sessionId;
67+
this.Value = value;
68+
this.Status = status;
5769
}
5870

5971
/// <summary>
6072
/// Returns a new <see cref="Response"/> from a JSON-encoded string.
6173
/// </summary>
6274
/// <param name="value">The JSON string to deserialize into a <see cref="Response"/>.</param>
6375
/// <returns>A <see cref="Response"/> object described by the JSON string.</returns>
76+
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is <see langword="null"/>.</exception>
77+
/// <exception cref="JsonException">If <paramref name="value"/> is not a valid JSON object.</exception>
6478
public static Response FromJson(string value)
6579
{
66-
Dictionary<string, object> rawResponse = JsonSerializer.Deserialize<Dictionary<string, object>>(value, s_jsonSerializerOptions)
80+
Dictionary<string, object?> rawResponse = JsonSerializer.Deserialize<Dictionary<string, object?>>(value, s_jsonSerializerOptions)
6781
?? throw new WebDriverException("JSON success response returned \"null\" value");
6882

69-
var response = new Response();
83+
object? contents;
84+
string? sessionId = null;
7085

71-
if (rawResponse.ContainsKey("sessionId"))
86+
if (rawResponse.TryGetValue("sessionId", out object? s) && s is not null)
7287
{
73-
if (rawResponse["sessionId"] != null)
74-
{
75-
response.SessionId = rawResponse["sessionId"].ToString();
76-
}
88+
sessionId = s.ToString();
7789
}
7890

79-
if (rawResponse.TryGetValue("value", out object valueObj))
91+
if (rawResponse.TryGetValue("value", out object? valueObj))
8092
{
81-
response.Value = valueObj;
93+
contents = valueObj;
8294
}
83-
84-
// If the returned object does *not* have a "value" property
85-
// the response value should be the entirety of the response.
86-
// TODO: Remove this if statement altogether; there should
87-
// never be a spec-compliant response that does not contain a
88-
// value property.
89-
if (!rawResponse.ContainsKey("value") && response.Value == null)
95+
else
9096
{
97+
// If the returned object does *not* have a "value" property
98+
// the response value should be the entirety of the response.
99+
// TODO: Remove this if statement altogether; there should
100+
// never be a spec-compliant response that does not contain a
101+
// value property.
102+
91103
// Special-case for the new session command, where the "capabilities"
92104
// property of the response is the actual value we're interested in.
93-
if (rawResponse.ContainsKey("capabilities"))
105+
if (rawResponse.TryGetValue("capabilities", out object? capabilities))
94106
{
95-
response.Value = rawResponse["capabilities"];
107+
contents = capabilities;
96108
}
97109
else
98110
{
99-
response.Value = rawResponse;
111+
contents = rawResponse;
100112
}
101113
}
102114

103-
if (response.Value is Dictionary<string, object> valueDictionary)
115+
if (contents is Dictionary<string, object?> valueDictionary)
104116
{
105117
// Special case code for the new session command. If the response contains
106118
// sessionId and capabilities properties, fix up the session ID and value members.
107-
if (valueDictionary.ContainsKey("sessionId"))
119+
if (valueDictionary.TryGetValue("sessionId", out object? session))
108120
{
109-
response.SessionId = valueDictionary["sessionId"].ToString();
110-
if (valueDictionary.TryGetValue("capabilities", out object capabilities))
121+
sessionId = session.ToString();
122+
if (valueDictionary.TryGetValue("capabilities", out object? capabilities))
111123
{
112-
response.Value = capabilities;
124+
contents = capabilities;
113125
}
114126
else
115127
{
116-
response.Value = valueDictionary["value"];
128+
contents = valueDictionary["value"];
117129
}
118130
}
119131
}
120132

121-
return response;
133+
return new Response(sessionId, contents, WebDriverResult.Success);
122134
}
123135

124136
/// <summary>
125137
/// Gets or sets the value from JSON.
126138
/// </summary>
127-
public object Value { get; set; }
139+
public object? Value { get; set; }
128140

129141
/// <summary>
130142
/// Gets or sets the session ID.
131143
/// </summary>
132-
public string SessionId { get; set; }
144+
public string? SessionId { get; set; }
133145

134146
/// <summary>
135147
/// Gets or sets the status value of the response.
@@ -142,26 +154,25 @@ public static Response FromJson(string value)
142154
/// </summary>
143155
/// <param name="value">The JSON string to deserialize into a <see cref="Response"/>.</param>
144156
/// <returns>A <see cref="Response"/> object described by the JSON string.</returns>
157+
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is <see langword="null"/>.</exception>
158+
/// <exception cref="JsonException">If <paramref name="value"/> is not a valid JSON object.</exception>
159+
/// <exception cref="WebDriverException">If the JSON dictionary is not in the expected state, per spec.</exception>
145160
public static Response FromErrorJson(string value)
146161
{
147-
var deserializedResponse = JsonSerializer.Deserialize<Dictionary<string, object>>(value, s_jsonSerializerOptions)
162+
Dictionary<string, object?> deserializedResponse = JsonSerializer.Deserialize<Dictionary<string, object?>>(value, s_jsonSerializerOptions)
148163
?? throw new WebDriverException("JSON error response returned \"null\" value");
149164

150-
var response = new Response();
151-
152-
if (!deserializedResponse.TryGetValue("value", out var valueObject))
165+
if (!deserializedResponse.TryGetValue("value", out object? valueObject))
153166
{
154167
throw new WebDriverException($"The 'value' property was not found in the response:{Environment.NewLine}{value}");
155168
}
156169

157-
if (valueObject is not Dictionary<string, object> valueDictionary)
170+
if (valueObject is not Dictionary<string, object?> valueDictionary)
158171
{
159172
throw new WebDriverException($"The 'value' property is not a dictionary of <string, object>{Environment.NewLine}{value}");
160173
}
161174

162-
response.Value = valueDictionary;
163-
164-
if (!valueDictionary.TryGetValue("error", out var errorObject))
175+
if (!valueDictionary.TryGetValue("error", out object? errorObject))
165176
{
166177
throw new WebDriverException($"The 'value > error' property was not found in the response:{Environment.NewLine}{value}");
167178
}
@@ -171,11 +182,9 @@ public static Response FromErrorJson(string value)
171182
throw new WebDriverException($"The 'value > error' property is not a string{Environment.NewLine}{value}");
172183
}
173184

174-
response.Value = deserializedResponse["value"];
175-
176-
response.Status = WebDriverError.ResultFromError(errorString);
185+
WebDriverResult status = WebDriverError.ResultFromError(errorString);
177186

178-
return response;
187+
return new Response(sessionId: null, valueDictionary, status);
179188
}
180189

181190
/// <summary>

0 commit comments

Comments
 (0)