Skip to content

Commit 69c82c3

Browse files
authored
Merge branch 'trunk' into bump-prism
2 parents b6bfc9c + 4fa3952 commit 69c82c3

File tree

7 files changed

+52
-36
lines changed

7 files changed

+52
-36
lines changed

common/repositories.bzl

Lines changed: 12 additions & 12 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/145.0b1/linux-x86_64/en-US/firefox-145.0b1.tar.xz",
54-
sha256 = "f92c1704ab741bd2d663ae3bed8178a8ad00c84b664bef6fe4fdf486d3edaa4d",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/145.0b2/linux-x86_64/en-US/firefox-145.0b2.tar.xz",
54+
sha256 = "2299c53a2cea673194324c7e696986f0f319f5ac7b0ed0c08ff141b8dd95b2b5",
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/145.0b1/mac/en-US/Firefox%20145.0b1.dmg",
76-
sha256 = "be24adf3ec50c911b2b1ee5b66e0c42418d981e2c484f4d09db7e7dd29563479",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/145.0b2/mac/en-US/Firefox%20145.0b2.dmg",
76+
sha256 = "3f4da534b1f443a83d2c96e91a1ff9d953534054096fe8c8272cda6f614fa74c",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -277,8 +277,8 @@ js_library(
277277

278278
http_archive(
279279
name = "linux_beta_chrome",
280-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/linux64/chrome-linux64.zip",
281-
sha256 = "8cfb9247d87419bd750c68b6f29424ad91474e0ee848c3f3cde04da76fbf9c2e",
280+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.34/linux64/chrome-linux64.zip",
281+
sha256 = "332faacf49d45f6d6c5f50a3407b70e908304e7944d60bc6fd1c0ed11062d9a0",
282282
build_file_content = """
283283
load("@aspect_rules_js//js:defs.bzl", "js_library")
284284
package(default_visibility = ["//visibility:public"])
@@ -298,8 +298,8 @@ js_library(
298298
)
299299
http_archive(
300300
name = "mac_beta_chrome",
301-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/mac-x64/chrome-mac-x64.zip",
302-
sha256 = "2024bc564c4e7e26514b8cb4740d9f3760b2f8545d573c0ba08bd2ed3f6fd85f",
301+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.34/mac-x64/chrome-mac-x64.zip",
302+
sha256 = "3745e1a1eba0287cb1762145a3a6abeefe98579b6de5715215854f92eee26d04",
303303
strip_prefix = "chrome-mac-x64",
304304
patch_cmds = [
305305
"mv 'Google Chrome for Testing.app' Chrome.app",
@@ -319,8 +319,8 @@ js_library(
319319
)
320320
http_archive(
321321
name = "linux_beta_chromedriver",
322-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/linux64/chromedriver-linux64.zip",
323-
sha256 = "6309f4601340d2a0c8df04e239a4696f1f5427be8e53545a2a321b640be2a0de",
322+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.34/linux64/chromedriver-linux64.zip",
323+
sha256 = "33850b3337bc92c6621e013af03323e0d6ae1e450aa1ff6b5776d47dd4d9b600",
324324
strip_prefix = "chromedriver-linux64",
325325
build_file_content = """
326326
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -337,8 +337,8 @@ js_library(
337337

338338
http_archive(
339339
name = "mac_beta_chromedriver",
340-
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.23/mac-x64/chromedriver-mac-x64.zip",
341-
sha256 = "695d4c4d71f31df7ea9d8bfccd19075662212b7fed9f9487fa2fa2aaa790faa6",
340+
url = "https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.34/mac-x64/chromedriver-mac-x64.zip",
341+
sha256 = "840101066642b930b937ba5e8d7506d9a71bbb6a9a45b5a4c11c05d83aace12c",
342342
strip_prefix = "chromedriver-mac-x64",
343343
build_file_content = """
344344
load("@aspect_rules_js//js:defs.bzl", "js_library")

java/src/org/openqa/selenium/bidi/permissions/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//java:defs.bzl", "java_library")
1+
load("//java:defs.bzl", "artifact", "java_library")
22

33
java_library(
44
name = "permissions",
@@ -14,4 +14,7 @@ java_library(
1414
"//java/test/org/openqa/selenium/bidi:__subpackages__",
1515
"//java/test/org/openqa/selenium/grid:__subpackages__",
1616
],
17+
deps = [
18+
artifact("org.jspecify:jspecify"),
19+
],
1720
)

java/src/org/openqa/selenium/bidi/permissions/PermissionState.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
package org.openqa.selenium.bidi.permissions;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
22+
23+
@NullMarked
2024
public enum PermissionState {
2125
GRANTED("granted"),
2226
DENIED("denied"),
@@ -33,7 +37,7 @@ public String toString() {
3337
return state;
3438
}
3539

36-
public static PermissionState findByName(String name) {
40+
public static @Nullable PermissionState findByName(String name) {
3741
PermissionState result = null;
3842
for (PermissionState state : values()) {
3943
if (state.toString().equalsIgnoreCase(name)) {

java/src/org/openqa/selenium/grid/jmx/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//java:defs.bzl", "java_library")
1+
load("//java:defs.bzl", "artifact", "java_library")
22

33
java_library(
44
name = "jmx",
@@ -8,4 +8,7 @@ java_library(
88
"//java/src/org/openqa/selenium/grid/session:__pkg__",
99
"//java/test/org/openqa/selenium/grid:__subpackages__",
1010
],
11+
deps = [
12+
artifact("org.jspecify:jspecify"),
13+
],
1114
)

java/src/org/openqa/selenium/grid/jmx/JMXHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
import javax.management.InstanceAlreadyExistsException;
2323
import javax.management.MBeanServer;
2424
import javax.management.ObjectName;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527

28+
@NullMarked
2629
public class JMXHelper {
2730

2831
private static final Logger LOG = Logger.getLogger(JMXHelper.class.getName());
2932

30-
public MBean register(Object bean) {
33+
public @Nullable MBean register(Object bean) {
3134
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
3235
MBean mBean = new MBean(bean);
3336
try {

py/test/selenium/webdriver/common/webserver.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import re
2525
import threading
2626

27+
import filetype
28+
2729
try:
2830
from urllib import request as urllib_request
2931
except ImportError:
@@ -70,8 +72,20 @@ def _serve_page(self, page_number):
7072

7173
def _serve_file(self, file_path):
7274
"""Serve a file from the HTML root directory."""
73-
with open(file_path, encoding="latin-1") as f:
74-
return f.read().encode("utf-8")
75+
with open(file_path, "rb") as f:
76+
content = f.read()
77+
78+
kind = filetype.guess(content)
79+
if kind is not None:
80+
return content, kind.mime
81+
82+
# fallback for text files that filetype can't detect
83+
if file_path.endswith(".txt"):
84+
return content, "text/plain"
85+
elif file_path.endswith(".json"):
86+
return content, "application/json"
87+
else:
88+
return content, "text/html"
7589

7690
def _send_response(self, content_type="text/html"):
7791
"""Send a response."""
@@ -89,8 +103,7 @@ def do_GET(self):
89103
self._send_response("text/html")
90104
self.wfile.write(html)
91105
elif os.path.isfile(file_path):
92-
content_type = "application/json" if file_path.endswith(".json") else "text/html"
93-
content = self._serve_file(file_path)
106+
content, content_type = self._serve_file(file_path)
94107
self._send_response(content_type)
95108
self.wfile.write(content)
96109
else:

py/test/selenium/webdriver/remote/remote_downloads_tests.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
def test_get_downloadable_files(driver, pages):
2929
_browser_downloads(driver, pages)
3030
file_names = driver.get_downloadable_files()
31-
# TODO: why is Chrome downloading files as .html???
32-
# assert "file_1.txt" in file_names
33-
# assert "file_2.jpg" in file_names
34-
assert any(f in file_names for f in ("file_1.txt", "file_1.htm", "file_1.html"))
35-
assert any(f in file_names for f in ("file_2.jpg", "file_2.htm", "file_2.html"))
31+
32+
assert "file_1.txt" in file_names
33+
assert "file_2.jpg" in file_names
3634
assert type(file_names) is list
3735

3836

@@ -42,12 +40,8 @@ def test_download_file(driver, pages):
4240

4341
# Get a list of downloadable files and find the txt file
4442
downloadable_files = driver.get_downloadable_files()
45-
# TODO: why is Chrome downloading files as .html???
46-
# text_file_name = next((file for file in downloadable_files if file.endswith(".txt")), None)
47-
text_file_name = next(
48-
(f for f in downloadable_files if all((f.endswith((".txt", ".htm", ".html")), f.startswith("file_1")))), None
49-
)
50-
assert text_file_name is not None, "Could not find file in downloadable files"
43+
text_file_name = next((file for file in downloadable_files if file.endswith(".txt")), None)
44+
assert text_file_name is not None, "Could not find a .txt file in downloadable files"
5145

5246
with tempfile.TemporaryDirectory() as target_directory:
5347
driver.download_file(text_file_name, target_directory)
@@ -69,8 +63,4 @@ def _browser_downloads(driver, pages):
6963
pages.load("downloads/download.html")
7064
driver.find_element(By.ID, "file-1").click()
7165
driver.find_element(By.ID, "file-2").click()
72-
# TODO: why is Chrome downloading files as .html???
73-
# WebDriverWait(driver, 5).until(lambda d: "file_2.jpg" in d.get_downloadable_files())
74-
WebDriverWait(driver, 5).until(
75-
lambda d: any(f in d.get_downloadable_files() for f in ("file_2.jpg", "file_2.htm", "file_2.html"))
76-
)
66+
WebDriverWait(driver, 3).until(lambda d: "file_2.jpg" in d.get_downloadable_files())

0 commit comments

Comments
 (0)