Skip to content

Commit

Permalink
Merge branch 'trunk' into renovate/react-router-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
harsha509 authored Jan 6, 2025
2 parents 76baab4 + 81f435d commit 05ab01c
Show file tree
Hide file tree
Showing 21 changed files with 609 additions and 139 deletions.
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ maven.install(
"com.graphql-java:graphql-java:22.3",
"dev.failsafe:failsafe:3.3.2",
"io.grpc:grpc-context:1.69.0",
"io.lettuce:lettuce-core:6.5.1.RELEASE",
"io.lettuce:lettuce-core:6.5.2.RELEASE",
"io.netty:netty-buffer",
"io.netty:netty-codec-http",
"io.netty:netty-codec-http2",
Expand All @@ -201,10 +201,10 @@ maven.install(
"io.opentelemetry.semconv:opentelemetry-semconv:1.28.0-alpha",
"it.ozimov:embedded-redis:0.7.3",
"net.bytebuddy:byte-buddy:1.15.11",
"org.htmlunit:htmlunit-core-js:4.6.0",
"org.htmlunit:htmlunit-core-js:4.7.0",
"org.apache.commons:commons-exec:1.4.0",
"org.apache.logging.log4j:log4j-core:2.24.3",
"org.assertj:assertj-core:3.27.1",
"org.assertj:assertj-core:3.27.2",
"org.bouncycastle:bcpkix-jdk18on:1.79",
"org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5",
"org.hsqldb:hsqldb:2.7.4",
Expand Down
40 changes: 40 additions & 0 deletions common/src/web/fedcm/fedcm_async_js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<title>FedCM Example</title>
</head>
<body>
<button id="triggerButton" onclick="triggerFedCm()">Trigger FedCM</button>
<div id="result"></div>

<script>
// Use a relative path for the configURL
let configURL = `http://${location.host}/common/fedcm/config.json`;
console.log(configURL)
let result = null;

async function triggerFedCm() {
console.log("Config URL:", configURL);
try {
let promise = await navigator.credentials.get({
identity: {
providers: [{
configURL: configURL,
clientId: '1',
}]
}
});
result = promise;

console.log("Promised!")
console.log(result)
document.getElementById('result').innerText = JSON.stringify(result);
} catch (error) {
console.error("FedCM Error:", error);
result = { error: error.message };
document.getElementById('result').innerText = JSON.stringify(result);
}
}
</script>
</body>
</html>
11 changes: 5 additions & 6 deletions dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private async Task<HttpResponseInfo> MakeHttpRequest(HttpRequestInfo requestInfo

private Response CreateResponse(HttpResponseInfo responseInfo)
{
Response response = new Response();
Response response;
string body = responseInfo.Body;
if ((int)responseInfo.StatusCode < 200 || (int)responseInfo.StatusCode > 299)
{
Expand All @@ -326,8 +326,7 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
}
else
{
response.Status = WebDriverResult.UnknownError;
response.Value = body;
response = new Response(sessionId: null, body, WebDriverResult.UnknownError);
}
}
else if (responseInfo.ContentType != null && responseInfo.ContentType.StartsWith(JsonMimeType, StringComparison.OrdinalIgnoreCase))
Expand All @@ -336,12 +335,12 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
}
else
{
response.Value = body;
response = new Response(sessionId: null, body, WebDriverResult.Success);
}

if (response.Value is string)
if (response.Value is string valueString)
{
response.Value = ((string)response.Value).Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
response.Value = valueString.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
}

return response;
Expand Down
99 changes: 54 additions & 45 deletions dotnet/src/webdriver/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium
{
/// <summary>
Expand All @@ -48,88 +50,98 @@ public Response()
/// Initializes a new instance of the <see cref="Response"/> class
/// </summary>
/// <param name="sessionId">Session ID in use</param>
public Response(SessionId sessionId)
public Response(SessionId? sessionId)
{
if (sessionId != null)
{
this.SessionId = sessionId.ToString();
}
this.SessionId = sessionId?.ToString();
}

/// <summary>
/// Initializes a new instance of the <see cref="Response"/> class
/// </summary>
/// <param name="sessionId">The Session ID in use, if any.</param>
/// <param name="value">The JSON payload of the response.</param>
/// <param name="status">The WebDriver result status of the response.</param>
public Response(string? sessionId, object? value, WebDriverResult status)
{
this.SessionId = sessionId;
this.Value = value;
this.Status = status;
}

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

var response = new Response();
object? contents;
string? sessionId = null;

if (rawResponse.ContainsKey("sessionId"))
if (rawResponse.TryGetValue("sessionId", out object? s) && s is not null)
{
if (rawResponse["sessionId"] != null)
{
response.SessionId = rawResponse["sessionId"].ToString();
}
sessionId = s.ToString();
}

if (rawResponse.TryGetValue("value", out object valueObj))
if (rawResponse.TryGetValue("value", out object? valueObj))
{
response.Value = valueObj;
contents = valueObj;
}

// If the returned object does *not* have a "value" property
// the response value should be the entirety of the response.
// TODO: Remove this if statement altogether; there should
// never be a spec-compliant response that does not contain a
// value property.
if (!rawResponse.ContainsKey("value") && response.Value == null)
else
{
// If the returned object does *not* have a "value" property
// the response value should be the entirety of the response.
// TODO: Remove this if statement altogether; there should
// never be a spec-compliant response that does not contain a
// value property.

// Special-case for the new session command, where the "capabilities"
// property of the response is the actual value we're interested in.
if (rawResponse.ContainsKey("capabilities"))
if (rawResponse.TryGetValue("capabilities", out object? capabilities))
{
response.Value = rawResponse["capabilities"];
contents = capabilities;
}
else
{
response.Value = rawResponse;
contents = rawResponse;
}
}

if (response.Value is Dictionary<string, object> valueDictionary)
if (contents is Dictionary<string, object?> valueDictionary)
{
// Special case code for the new session command. If the response contains
// sessionId and capabilities properties, fix up the session ID and value members.
if (valueDictionary.ContainsKey("sessionId"))
if (valueDictionary.TryGetValue("sessionId", out object? session))
{
response.SessionId = valueDictionary["sessionId"].ToString();
if (valueDictionary.TryGetValue("capabilities", out object capabilities))
sessionId = session.ToString();
if (valueDictionary.TryGetValue("capabilities", out object? capabilities))
{
response.Value = capabilities;
contents = capabilities;
}
else
{
response.Value = valueDictionary["value"];
contents = valueDictionary["value"];
}
}
}

return response;
return new Response(sessionId, contents, WebDriverResult.Success);
}

/// <summary>
/// Gets or sets the value from JSON.
/// </summary>
public object Value { get; set; }
public object? Value { get; set; }

/// <summary>
/// Gets or sets the session ID.
/// </summary>
public string SessionId { get; set; }
public string? SessionId { get; set; }

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

var response = new Response();

if (!deserializedResponse.TryGetValue("value", out var valueObject))
if (!deserializedResponse.TryGetValue("value", out object? valueObject))
{
throw new WebDriverException($"The 'value' property was not found in the response:{Environment.NewLine}{value}");
}

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

response.Value = valueDictionary;

if (!valueDictionary.TryGetValue("error", out var errorObject))
if (!valueDictionary.TryGetValue("error", out object? errorObject))
{
throw new WebDriverException($"The 'value > error' property was not found in the response:{Environment.NewLine}{value}");
}
Expand All @@ -171,11 +182,9 @@ public static Response FromErrorJson(string value)
throw new WebDriverException($"The 'value > error' property is not a string{Environment.NewLine}{value}");
}

response.Value = deserializedResponse["value"];

response.Status = WebDriverError.ResultFromError(errorString);
WebDriverResult status = WebDriverError.ResultFromError(errorString);

return response;
return new Response(sessionId: null, valueDictionary, status);
}

/// <summary>
Expand Down
22 changes: 11 additions & 11 deletions java/maven_install.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": -1069673593,
"__RESOLVED_ARTIFACTS_HASH": -1004221368,
"__INPUT_ARTIFACTS_HASH": 1132645732,
"__RESOLVED_ARTIFACTS_HASH": 1947623231,
"artifacts": {
"com.beust:jcommander": {
"shasums": {
Expand Down Expand Up @@ -228,10 +228,10 @@
},
"io.lettuce:lettuce-core": {
"shasums": {
"jar": "ff26c28351becdaf6d5abe25d97ea799a986b1746bfe5f70659d1e53745b6f1a",
"sources": "383337d6e56a97563c31f2d06838c85f8295662a5f7f72408bef5d59329cf98a"
"jar": "59f6a591a631d844b355b831ee723bf6ce98d92f7a775de6b0690f0eb81480e7",
"sources": "e9d835ed5b0583fbf01deabdb2c4ab370ac73166a4011aac5f1e2ca397914912"
},
"version": "6.5.1.RELEASE"
"version": "6.5.2.RELEASE"
},
"io.netty:netty-buffer": {
"shasums": {
Expand Down Expand Up @@ -550,10 +550,10 @@
},
"org.assertj:assertj-core": {
"shasums": {
"jar": "ab4ab885146bc5dfbdd4cdfb06f1ae72ec6b5e8139f0ccdabcbe51374aebac0d",
"sources": "0c9a7b4a85f3609bf700ad13f4173cde85cadcdd8feb829e059a000a5b9aa932"
"jar": "a8079b4cb67dca1dc5c7650bf27bd59277834c63280b661475986de3b602e3ae",
"sources": "fc96972d63cc234226a10b5a434acb085033f2bc68035df92abc3331595aa73d"
},
"version": "3.27.1"
"version": "3.27.2"
},
"org.bouncycastle:bcpkix-jdk18on": {
"shasums": {
Expand Down Expand Up @@ -606,10 +606,10 @@
},
"org.htmlunit:htmlunit-core-js": {
"shasums": {
"jar": "709c43eaab5b407468239b49ba990a7170ee582cbaa6a11c09a6118da22fdedc",
"sources": "458acacd14d851ad0ad20310787b35d3224d0c31155bd6b17d41de2b352bb1b7"
"jar": "4f0c609fbfd2ca2ca9163cc63e9b947b13a57b5644400e2b1902c1335d160888",
"sources": "5834536abb3402f859cbb31f48d113e36c2dc6bc7dd7e01eca6478a61d00c70c"
},
"version": "4.6.0"
"version": "4.7.0"
},
"org.jodd:jodd-util": {
"shasums": {
Expand Down
14 changes: 13 additions & 1 deletion java/src/org/openqa/selenium/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public enum Platform {

/** Never returned, but can be used to request a browser running on any version of Windows. */
WINDOWS("") {
WINDOWS("windows") {
@Override
public Platform family() {
return null;
Expand Down Expand Up @@ -302,6 +302,18 @@ public String toString() {
}
},

SEQUOIA("sequoia", "os x 15.0", "macos 15.0") {
@Override
public Platform family() {
return MAC;
}

@Override
public String toString() {
return "macOS 15.0";
}
},

/** Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD. */
UNIX("solaris", "bsd") {
@Override
Expand Down
Loading

0 comments on commit 05ab01c

Please sign in to comment.