Skip to content

Commit 16dc775

Browse files
authored
Merge branch 'trunk' into select-parity
2 parents bf4a4de + 0345a23 commit 16dc775

38 files changed

+298
-103
lines changed

.bazelrc.remote

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test:remote --test_env=PATH=/bin:/usr/bin:/usr/local/bin
4343
test:remote --test_env=HOME=/home/dev
4444

4545
# Make sure we sniff credentials properly
46-
build:remote --credential_helper=%workspace%/scripts/credential-helper.sh
46+
build:remote --credential_helper=gypsum.cluster.engflow.com=%workspace%/scripts/credential-helper.sh
4747

4848
# Use pinned browsers when running remotely
4949
build:remote --//common:pin_browsers

MODULE.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ use_repo(pip, "py_dev_requirements")
124124

125125
register_toolchains("@pythons_hub//:all")
126126

127+
# https://github.com/bazelbuild/rules_jvm_external/pull/1079
128+
archive_override(
129+
module_name = "rules_jvm_external",
130+
integrity = "sha256-yS8Qes1PLbYbe10b1WSgl0Auqn/1Wlxg8O3wSr7a/Sg=",
131+
patch_strip = 1,
132+
patches = ["//java:rules_jvm_external_javadoc.patch"],
133+
strip_prefix = "rules_jvm_external-f572a26116c7ef71d8842dd056c2605782f7be8d",
134+
urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/f572a26116c7ef71d8842dd056c2605782f7be8d.tar.gz"],
135+
)
136+
127137
java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
128138
use_repo(
129139
java_toolchains,

common/repositories.bzl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/linux-x86_64/en-US/firefox-126.0b8.tar.bz2",
54-
sha256 = "75198959b1eeedc81be229ad3066ee6d49ecde985ce5d5d11d61f0914e288517",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b9/linux-x86_64/en-US/firefox-126.0b9.tar.bz2",
54+
sha256 = "053e60089c6ab85507dca96ad8c9d32e3fc6d21ac5bdf7e616c673327804565f",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/mac/en-US/Firefox%20126.0b8.dmg",
76-
sha256 = "ca247dbfa1b092f36c75ab785acb0c54e608545b76dc06fbac9a9034df0daf8a",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b9/mac/en-US/Firefox%20126.0b9.dmg",
76+
sha256 = "67806b532db26059fbe747ec3fc2f6306d9bb4b09e1b264c49461c4d613b5366",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/8325266a-e5ef-4b92-b110-6e387417723c/MicrosoftEdge-124.0.2478.67.pkg",
127-
sha256 = "4c79de91852bda6a779761d06cfa00d48ae4f08dfe3903543f3674b973bd780b",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/e6f7f9ba-499c-44cb-9c19-28daeaa82dc6/MicrosoftEdge-124.0.2478.80.pkg",
127+
sha256 = "fc667b0401c05bbe0e4d337cc593641e2b653107fafd363b401cd32baa8a4f53",
128128
move = {
129-
"MicrosoftEdge-124.0.2478.67.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-124.0.2478.80.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.67-1_amd64.deb",
147-
sha256 = "3d12f66a279b0a82b478625696f23e1ac935e0596d57e19a41da232ee0c58a65",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.80-1_amd64.deb",
147+
sha256 = "a7eb75d95730c520eec998f755fcc427a9b4ac6a150bbb267b21e8383b6dc105",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.azureedge.net/124.0.2478.67/edgedriver_linux64.zip",
169-
sha256 = "25a169807beb4fc2485cf601f04c76cfffcc2c1e23a875941bc8aa41bee0587c",
168+
url = "https://msedgedriver.azureedge.net/124.0.2478.80/edgedriver_linux64.zip",
169+
sha256 = "4c9192c8e42ac1e1d779784ba95a0b28807cc75ae1be07be740f40bc20410670",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.azureedge.net/124.0.2478.67/edgedriver_mac64.zip",
186-
sha256 = "571d910bc662e2dfcf10e47cf40d11f76568b893abbde877f2beb487693ed983",
185+
url = "https://msedgedriver.azureedge.net/124.0.2478.80/edgedriver_mac64.zip",
186+
sha256 = "f8d8b0eaacb884196e5f368a64cad246a86e5a92941b0d37c5d7aa8ebb0fec1f",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])

java/src/org/openqa/selenium/devtools/CdpClientGenerator.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -913,18 +913,23 @@ public TypeDeclaration<?> toTypeDeclaration() {
913913
fromJson.getBody().get().addStatement(String.format("return new %s(%s);", name, getMapper()));
914914

915915
MethodDeclaration toJson = classDecl.addMethod("toJson").setPublic(true);
916-
if (type.equals("object")) {
917-
toJson.setType("java.util.Map<String, Object>");
918-
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
919-
} else if (type.equals("number")) {
920-
toJson.setType(Number.class);
921-
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
922-
} else if (type.equals("integer")) {
923-
toJson.setType(Integer.class);
924-
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
925-
} else {
926-
toJson.setType(String.class);
927-
toJson.getBody().get().addStatement(String.format("return %s.toString();", propertyName));
916+
switch (type) {
917+
case "object":
918+
toJson.setType("java.util.Map<String, Object>");
919+
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
920+
break;
921+
case "number":
922+
toJson.setType(Number.class);
923+
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
924+
break;
925+
case "integer":
926+
toJson.setType(Integer.class);
927+
toJson.getBody().get().addStatement(String.format("return %s;", propertyName));
928+
break;
929+
default:
930+
toJson.setType(String.class);
931+
toJson.getBody().get().addStatement(String.format("return %s.toString();", propertyName));
932+
break;
928933
}
929934

930935
MethodDeclaration toString = classDecl.addMethod("toString").setPublic(true);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package org.openqa.selenium.devtools;
19+
20+
import org.openqa.selenium.WebDriverException;
21+
import org.openqa.selenium.remote.http.Filter;
22+
import org.openqa.selenium.remote.http.HttpHandler;
23+
24+
/**
25+
* This exception is thrown by the final {@link HttpHandler} in a {@link Filter} chain when the
26+
* browser fails to send a HTTP request. It can be caught in a {@link Filter} to handle the error
27+
* by, for example, returning a custom HTTP response.
28+
*/
29+
public class RequestFailedException extends WebDriverException {}

java/src/org/openqa/selenium/devtools/idealized/Network.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.openqa.selenium.devtools.DevToolsException;
4646
import org.openqa.selenium.devtools.Event;
4747
import org.openqa.selenium.devtools.NetworkInterceptor;
48+
import org.openqa.selenium.devtools.RequestFailedException;
4849
import org.openqa.selenium.internal.Either;
4950
import org.openqa.selenium.internal.Require;
5051
import org.openqa.selenium.remote.http.Contents;
@@ -202,8 +203,12 @@ public void prepareToInterceptTraffic() {
202203
String id = getRequestId(pausedRequest);
203204

204205
if (hasErrorResponse(pausedRequest)) {
205-
pendingResponses.remove(id);
206-
devTools.send(continueWithoutModification(pausedRequest));
206+
CompletableFuture<HttpResponse> future = pendingResponses.remove(id);
207+
if (future == null) {
208+
devTools.send(continueWithoutModification(pausedRequest));
209+
} else {
210+
future.completeExceptionally(new RequestFailedException());
211+
}
207212
return;
208213
}
209214

@@ -244,6 +249,11 @@ public void prepareToInterceptTraffic() {
244249
pendingResponses.remove(id);
245250
return STOP_PROCESSING;
246251
} catch (ExecutionException e) {
252+
if (e.getCause() instanceof RequestFailedException) {
253+
// Throwing here will give the user's filter a chance to intercept
254+
// the failure and handle it.
255+
throw (RequestFailedException) e.getCause();
256+
}
247257
if (fetchEnabled.get()) {
248258
LOG.log(WARNING, e, () -> "Unable to process request");
249259
}
@@ -261,6 +271,10 @@ public void prepareToInterceptTraffic() {
261271
}
262272

263273
devTools.send(fulfillRequest(pausedRequest, forBrowser));
274+
} catch (RequestFailedException e) {
275+
// If the exception reaches here, we know the user's filter has not handled it and the
276+
// browser should continue its normal error handling.
277+
devTools.send(continueWithoutModification(pausedRequest));
264278
} catch (TimeoutException e) {
265279
if (fetchEnabled.get()) {
266280
throw e;

java/src/org/openqa/selenium/grid/data/NodeStatus.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class NodeStatus {
4242
private final Set<Slot> slots;
4343
private final Availability availability;
4444
private final Duration heartbeatPeriod;
45+
private final Duration sessionTimeout;
4546
private final String version;
4647
private final Map<String, String> osInfo;
4748

@@ -52,6 +53,7 @@ public NodeStatus(
5253
Set<Slot> slots,
5354
Availability availability,
5455
Duration heartbeatPeriod,
56+
Duration sessionTimeout,
5557
String version,
5658
Map<String, String> osInfo) {
5759
this.nodeId = Require.nonNull("Node id", nodeId);
@@ -62,6 +64,7 @@ public NodeStatus(
6264
this.slots = unmodifiableSet(new HashSet<>(Require.nonNull("Slots", slots)));
6365
this.availability = Require.nonNull("Availability", availability);
6466
this.heartbeatPeriod = heartbeatPeriod;
67+
this.sessionTimeout = sessionTimeout;
6568
this.version = Require.nonNull("Grid Node version", version);
6669
this.osInfo = Require.nonNull("Node host OS info", osInfo);
6770
}
@@ -73,6 +76,7 @@ public static NodeStatus fromJson(JsonInput input) {
7376
Set<Slot> slots = null;
7477
Availability availability = null;
7578
Duration heartbeatPeriod = null;
79+
Duration sessionTimeout = null;
7680
String version = null;
7781
Map<String, String> osInfo = null;
7882

@@ -87,6 +91,10 @@ public static NodeStatus fromJson(JsonInput input) {
8791
heartbeatPeriod = Duration.ofMillis(input.read(Long.class));
8892
break;
8993

94+
case "sessionTimeout":
95+
sessionTimeout = Duration.ofMillis(input.read(Long.class));
96+
break;
97+
9098
case "nodeId":
9199
nodeId = input.read(NodeId.class);
92100
break;
@@ -119,7 +127,15 @@ public static NodeStatus fromJson(JsonInput input) {
119127
input.endObject();
120128

121129
return new NodeStatus(
122-
nodeId, externalUri, maxSessions, slots, availability, heartbeatPeriod, version, osInfo);
130+
nodeId,
131+
externalUri,
132+
maxSessions,
133+
slots,
134+
availability,
135+
heartbeatPeriod,
136+
sessionTimeout,
137+
version,
138+
osInfo);
123139
}
124140

125141
public boolean hasCapability(Capabilities caps, SlotMatcher slotMatcher) {
@@ -162,6 +178,10 @@ public Duration getHeartbeatPeriod() {
162178
return heartbeatPeriod;
163179
}
164180

181+
public Duration getSessionTimeout() {
182+
return sessionTimeout;
183+
}
184+
165185
public String getVersion() {
166186
return version;
167187
}
@@ -212,6 +232,7 @@ private Map<String, Object> toJson() {
212232
toReturn.put("slots", slots);
213233
toReturn.put("availability", availability);
214234
toReturn.put("heartbeatPeriod", heartbeatPeriod.toMillis());
235+
toReturn.put("sessionTimeout", sessionTimeout.toMillis());
215236
toReturn.put("version", version);
216237
toReturn.put("osInfo", osInfo);
217238

java/src/org/openqa/selenium/grid/distributor/AddNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public HttpResponse execute(HttpRequest req) {
6565
status.getNodeId(),
6666
status.getExternalUri(),
6767
registrationSecret,
68+
status.getSessionTimeout(),
6869
status.getSlots().stream().map(Slot::getStereotype).collect(Collectors.toSet()));
6970

7071
distributor.add(node);

java/src/org/openqa/selenium/grid/distributor/GridModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ private NodeStatus rewrite(NodeStatus status, Availability availability) {
367367
status.getSlots(),
368368
availability,
369369
status.getHeartbeatPeriod(),
370+
status.getSessionTimeout(),
370371
status.getVersion(),
371372
status.getOsInfo());
372373
}
@@ -508,6 +509,7 @@ private void amend(Availability availability, NodeStatus status, Slot slot) {
508509
newSlots,
509510
availability,
510511
status.getHeartbeatPeriod(),
512+
status.getSessionTimeout(),
511513
status.getVersion(),
512514
status.getOsInfo()));
513515
} finally {

java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ private void register(NodeStatus status) {
314314
status.getNodeId(),
315315
status.getExternalUri(),
316316
registrationSecret,
317+
status.getSessionTimeout(),
317318
capabilities);
318319

319320
add(remoteNode);

0 commit comments

Comments
 (0)