Skip to content

Commit 8c96a6c

Browse files
authored
Merge branch 'trunk' into pinned-browser-updates
2 parents ee7eafa + eaf4fa7 commit 8c96a6c

29 files changed

+653
-156
lines changed

.skipped-tests

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest
66
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest-edge
77
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest-remote
8-
-//java/test/org/openqa/selenium/federatedcredentialmanagement:FederatedCredentialManagementTest
98
-//java/test/org/openqa/selenium/firefox:FirefoxDriverBuilderTest
109
-//java/test/org/openqa/selenium/grid/gridui:OverallGridTest
1110
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"accounts_endpoint": "accounts.json",
33
"client_metadata_endpoint": "client_metadata.json",
4-
"id_assertion_endpoint": "id_assertion",
5-
"signin_url": "/signin",
6-
"login_url": "/login"
4+
"id_assertion_endpoint": "id_assertion.json",
5+
"signin_url": "signin",
6+
"login_url": "login"
77
}

common/src/web/fedcm/fedcm.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<script>
33

4-
let configURL = `http://${location.host}/fedcm/fedcm.json`;
4+
let configURL = `http://${location.host}/fedcm/config.json`;
55
let promise = null;
66

77
function triggerFedCm() {
@@ -17,4 +17,4 @@
1717
return promise;
1818
}
1919

20-
</script>
20+
</script>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 = `https://${location.host}/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+
document.getElementById('result').innerText = JSON.stringify(result);
29+
} catch (error) {
30+
console.error("FedCM Error:", error);
31+
result = { error: error.message };
32+
document.getElementById('result').innerText = JSON.stringify(result);
33+
}
34+
}
35+
</script>
36+
</body>
37+
</html>

common/src/web/fedcm/login.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Login</title>
5+
</head>
6+
<body>
7+
<h1>Login Page</h1>
8+
<p>Login successful! This is a placeholder for the login process.</p>
9+
<a href="/">Return to Home</a>
10+
</body>
11+
</html>

common/src/web/fedcm/signin.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Sign In</title>
5+
</head>
6+
<body>
7+
<h1>Sign In Page</h1>
8+
<p>This is a placeholder for the sign-in page.</p>
9+
<form action="/signin" method="post">
10+
<label for="username">Username:</label>
11+
<input type="text" id="username" name="username" required>
12+
<br><br>
13+
<label for="password">Password:</label>
14+
<input type="password" id="password" name="password" required>
15+
<br><br>
16+
<button type="submit">Sign In</button>
17+
</form>
18+
</body>
19+
</html>

dotnet/src/webdriver/Firefox/Internal/IniFileReader.cs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,23 @@
2222
using System.Collections.ObjectModel;
2323
using System.IO;
2424

25+
#nullable enable
26+
2527
namespace OpenQA.Selenium.Firefox.Internal
2628
{
2729
/// <summary>
2830
/// Parses and reads an INI file.
2931
/// </summary>
30-
internal class IniFileReader
32+
internal sealed class IniFileReader
3133
{
32-
private Dictionary<string, Dictionary<string, string>> iniFileStore = new Dictionary<string, Dictionary<string, string>>();
34+
private readonly Dictionary<string, Dictionary<string, string>> iniFileStore = new Dictionary<string, Dictionary<string, string>>();
3335

3436
/// <summary>
3537
/// Initializes a new instance of the <see cref="IniFileReader"/> class.
3638
/// </summary>
3739
/// <param name="fileName">The full path to the .INI file to be read.</param>
40+
/// <exception cref="ArgumentNullException">If <paramref name="fileName"/> is <see langword="null"/> or <see cref="string.Empty"/>.</exception>
41+
/// <exception cref="FileNotFoundException">If no file exists at file path <paramref name="fileName"/>.</exception>
3842
public IniFileReader(string fileName)
3943
{
4044
if (string.IsNullOrEmpty(fileName))
@@ -53,7 +57,7 @@ public IniFileReader(string fileName)
5357
string[] iniFileContent = File.ReadAllLines(fileName);
5458
foreach (string iniFileLine in iniFileContent)
5559
{
56-
if (!string.IsNullOrEmpty(iniFileLine.Trim()) && !iniFileLine.StartsWith(";", StringComparison.OrdinalIgnoreCase))
60+
if (!string.IsNullOrWhiteSpace(iniFileLine) && !iniFileLine.StartsWith(";", StringComparison.OrdinalIgnoreCase))
5761
{
5862
if (iniFileLine.StartsWith("[", StringComparison.OrdinalIgnoreCase) && iniFileLine.EndsWith("]", StringComparison.OrdinalIgnoreCase))
5963
{
@@ -86,21 +90,24 @@ public IniFileReader(string fileName)
8690
/// <summary>
8791
/// Gets a <see cref="ReadOnlyCollection{T}"/> containing the names of the sections in the .INI file.
8892
/// </summary>
89-
public ReadOnlyCollection<string> SectionNames
90-
{
91-
get
92-
{
93-
List<string> keyList = new List<string>(this.iniFileStore.Keys);
94-
return new ReadOnlyCollection<string>(keyList);
95-
}
96-
}
93+
public ReadOnlyCollection<string> SectionNames => new ReadOnlyCollection<string>(new List<string>(this.iniFileStore.Keys));
9794

9895
/// <summary>
9996
/// Gets a value from the .INI file.
10097
/// </summary>
10198
/// <param name="sectionName">The section in which to find the key-value pair.</param>
10299
/// <param name="valueName">The key of the key-value pair.</param>
103100
/// <returns>The value associated with the given section and key.</returns>
101+
/// <exception cref="ArgumentNullException">
102+
/// <para>If <paramref name="sectionName"/> is <see langword="null"/> or <see cref="string.Empty"/>.</para>
103+
/// <para>-or-</para>
104+
/// <para>If <paramref name="valueName"/> is <see langword="null"/> or <see cref="string.Empty"/>.</para>
105+
/// </exception>
106+
/// <exception cref="ArgumentException">
107+
/// <para>If no section named <paramref name="sectionName"/> exists.</para>
108+
/// <para>-or-</para>
109+
///<para>If the section does not contain a value named <paramref name="valueName"/>.</para>
110+
/// </exception>
104111
public string GetValue(string sectionName, string valueName)
105112
{
106113
if (string.IsNullOrEmpty(sectionName))
@@ -117,19 +124,17 @@ public string GetValue(string sectionName, string valueName)
117124

118125
string lowerCaseValueName = valueName.ToUpperInvariant();
119126

120-
if (!this.iniFileStore.ContainsKey(lowerCaseSectionName))
127+
if (!this.iniFileStore.TryGetValue(lowerCaseSectionName, out Dictionary<string, string>? section))
121128
{
122129
throw new ArgumentException("Section does not exist: " + sectionName, nameof(sectionName));
123130
}
124131

125-
Dictionary<string, string> section = this.iniFileStore[lowerCaseSectionName];
126-
127-
if (!section.ContainsKey(lowerCaseValueName))
132+
if (!section.TryGetValue(lowerCaseValueName, out string? value))
128133
{
129134
throw new ArgumentException("Value does not exist: " + valueName, nameof(valueName));
130135
}
131136

132-
return section[lowerCaseValueName];
137+
return value;
133138
}
134139
}
135140
}

dotnet/src/webdriver/Remote/HttpCommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
326326
}
327327
else
328328
{
329-
response.Status = WebDriverResult.UnhandledError;
329+
response.Status = WebDriverResult.UnknownError;
330330
response.Value = body;
331331
}
332332
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// <copyright file="UnknownErrorException.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
using System;
21+
22+
#nullable enable
23+
24+
namespace OpenQA.Selenium
25+
{
26+
/// <summary>
27+
/// An unknown error occurred in the remote end while processing the command.
28+
/// </summary>
29+
[Serializable]
30+
public class UnknownErrorException : WebDriverException
31+
{
32+
/// <summary>
33+
/// Initializes a new instance of the <see cref="UnknownErrorException"/> class with the specified message.
34+
/// </summary>
35+
/// <param name="message">The message of the exception.</param>
36+
public UnknownErrorException(string? message)
37+
: base(message)
38+
{
39+
}
40+
41+
/// <summary>
42+
/// Initializes a new instance of the <see cref="UnknownErrorException"/> class with the specified message and inner exception.
43+
/// </summary>
44+
/// <param name="message">The message of the exception.</param>
45+
/// <param name="innerException">The inner exception for this exception.</param>
46+
public UnknownErrorException(string? message, Exception? innerException)
47+
: base(message, innerException)
48+
{
49+
}
50+
}
51+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// <copyright file="UnknownMethodException.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
using System;
21+
22+
#nullable enable
23+
24+
namespace OpenQA.Selenium
25+
{
26+
/// <summary>
27+
/// Exception that is thrown when the requested command matched a known URL but did not match any method for that URL.
28+
/// </summary>
29+
[Serializable]
30+
public class UnknownMethodException : WebDriverException
31+
{
32+
/// <summary>
33+
/// Initializes a new instance of the <see cref="UnknownMethodException"/> class with the specified message.
34+
/// </summary>
35+
/// <param name="message">The message of the exception.</param>
36+
public UnknownMethodException(string? message) : base(message)
37+
{
38+
}
39+
40+
/// <summary>
41+
/// Initializes a new instance of the <see cref="UnknownMethodException"/> class with the specified message and inner exception.
42+
/// </summary>
43+
/// <param name="message">The message of the exception.</param>
44+
/// <param name="innerException">The inner exception for this exception.</param>
45+
public UnknownMethodException(string? message, Exception? innerException) : base(message, innerException)
46+
{
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)