mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-10-28 09:44:53 +00:00
Meta: Import a WPT resource for both the test and its reference page
Downloads were de-duplicated by source URL, so a reference page sharing a relative resource with its test, such as css-pseudo's selection helper script, never got its own copy under the expected directory.
This commit is contained in:
1 parent
b7025c2c39
commit
b52a795407
2 files changed
+12
-14
Notes:
github-actions[bot]
2026-09-11 14:01:44 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/b52a7954076 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/11695
No files matched your search
@@ -5,5 +5,6 @@ Tests/LibJS/Runtime/unicode-identifier-escape.js
|
||||
Tests/LibJS/Runtime/modules/failing.mjs
|
||||
|
||||
Tests/LibWeb/Crash/wpt-import/
|
||||
Tests/LibWeb/Ref/expected/wpt-import
|
||||
Tests/LibWeb/Ref/input/wpt-import
|
||||
Tests/LibWeb/Text/input/wpt-import
|
||||
+11
-14
@@ -29,7 +29,7 @@ download_exclude_list = {
|
||||
# Modified to use a relative path, which the importer can't rewrite.
|
||||
"/fonts/ahem.css",
|
||||
}
|
||||
visited_paths = set()
|
||||
visited_destinations = set()
|
||||
|
||||
|
||||
class TestType(Enum):
|
||||
@@ -259,23 +259,23 @@ def download_files(filepaths, wpt_base_url, skip_existing):
|
||||
for file in filepaths:
|
||||
normalized_path = remove_repeated_url_slashes(file.source)
|
||||
print(f"Source {normalized_path}, Destination {file.destination}")
|
||||
if normalized_path in visited_paths:
|
||||
continue
|
||||
if normalized_path in download_exclude_list:
|
||||
print(f"Skipping {file.source} as it is in the exclude list")
|
||||
visited_paths.add(normalized_path)
|
||||
continue
|
||||
|
||||
source = urljoin(wpt_base_url, normalized_path)
|
||||
destination = Path(os.path.normpath(file.destination))
|
||||
|
||||
# A test and its reference page can share a relative resource, which then has to exist next to each of
|
||||
# them, so what has been downloaded is tracked by destination rather than by source.
|
||||
if destination in visited_destinations:
|
||||
continue
|
||||
visited_destinations.add(destination)
|
||||
|
||||
if skip_existing and destination.exists():
|
||||
print(f"Skipping {destination} as it already exists")
|
||||
visited_paths.add(normalized_path)
|
||||
continue
|
||||
|
||||
visited_paths.add(normalized_path)
|
||||
|
||||
print(f"Downloading {source} to {destination}")
|
||||
|
||||
connection = urlopen(source)
|
||||
@@ -297,20 +297,17 @@ def download_headers_files(filepaths, wpt_base_url, skip_existing):
|
||||
for file in filepaths:
|
||||
normalized_path = remove_repeated_url_slashes(file.source)
|
||||
headers_path = normalized_path + ".headers"
|
||||
|
||||
if headers_path in visited_paths:
|
||||
continue
|
||||
|
||||
source = urljoin(wpt_base_url, headers_path)
|
||||
destination = Path(os.path.normpath(str(file.destination) + ".headers"))
|
||||
|
||||
if destination in visited_destinations:
|
||||
continue
|
||||
visited_destinations.add(destination)
|
||||
|
||||
if skip_existing and destination.exists():
|
||||
print(f"Skipping {destination} as it already exists")
|
||||
visited_paths.add(headers_path)
|
||||
continue
|
||||
|
||||
visited_paths.add(headers_path)
|
||||
|
||||
try:
|
||||
connection = urlopen(source)
|
||||
except HTTPError:
|
||||
|
||||
Reference in new issue
Block a user