Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

test(wpt): include compression streams in the semantic baseline

ldm06630605680ac
diff --git a/moli-benchmark/README.md b/moli-benchmark/README.md
index dc4e87b4b..c8939b2cf 100644
--- a/moli-benchmark/README.md
+++ b/moli-benchmark/README.md
@@ -45,6 +45,24 @@ uv run moli-benchmark synthetic \
--runs 5
```
+### Script-authored semantic WPT
+
+The default semantic profile includes both Window and DedicatedWorker variants
+of `streams/` and `compression/`, plus their `.window.js` and `.worker.js`
+cases. Secure-context `.any.js` cases use the fixture's trustworthy loopback
+origin. To run the complete compression suite through the CLI path:
+
+```bash
+uv run python -m moli_benchmark.wpt_cross \
+ --wpt-root ../../wpt \
+ --engine moli --mode cli \
+ --dir-prefix compression \
+ --output-dir /tmp/moli-compression-wpt
+```
+
+Use `--mode cdp` to check the same cases through CDP. Unsupported formats
+remain failures in the report; they are not filtered out of this suite.
+
### Cross-engine layout WPT
The standalone cross-engine runner has separate layout profiles, so its
diff --git a/moli-benchmark/moli_benchmark/wpt_cross/__main__.py b/moli-benchmark/moli_benchmark/wpt_cross/__main__.py
index 6daea45d0..e915449ba 100644
--- a/moli-benchmark/moli_benchmark/wpt_cross/__main__.py
+++ b/moli-benchmark/moli_benchmark/wpt_cross/__main__.py
@@ -187,7 +187,7 @@ def _build_parser() -> argparse.ArgumentParser:
"Include .any.js cases during --dir-prefix enumeration for the "
"selected global: window, dedicatedworker, both, or none "
"(default). The broad baseline includes both supported globals "
- "for Streams automatically. Explicit --case path.any.js still "
+ "for Streams and Compression automatically. Explicit --case path.any.js still "
"runs the window variant by default."
),
)
diff --git a/moli-benchmark/moli_benchmark/wpt_cross/any_js.py b/moli-benchmark/moli_benchmark/wpt_cross/any_js.py
index 7c1b67c31..fb29ec8d2 100644
--- a/moli-benchmark/moli_benchmark/wpt_cross/any_js.py
+++ b/moli-benchmark/moli_benchmark/wpt_cross/any_js.py
@@ -54,9 +54,9 @@ def normalize_any_js_window_case_path(case_path: str) -> str:
"""Return an explicit case path that asks the fixture server for a wrapper.
WPT ``.any.js`` files are script resources, not directly navigable test
- pages. The benchmark keeps default enumeration HTML-only, but an explicit
- ``--case path.any.js`` should run the window-global variant because that is
- the common WPT translation and keeps wasm/jsapi coverage measurable.
+ pages. The benchmark opts selected semantic suites into script enumeration;
+ an explicit ``--case path.any.js`` also runs the window-global variant so
+ other suites, such as wasm/jsapi, remain measurable in focused runs.
"""
case_path = case_path.lstrip("/")
diff --git a/moli-benchmark/moli_benchmark/wpt_cross/case_set.py b/moli-benchmark/moli_benchmark/wpt_cross/case_set.py
index 294d4cedf..ce4c1d560 100644
--- a/moli-benchmark/moli_benchmark/wpt_cross/case_set.py
+++ b/moli-benchmark/moli_benchmark/wpt_cross/case_set.py
@@ -295,9 +295,10 @@ ANY_JS_GLOBAL_CHOICES: tuple[str, ...] = (
# of the runner contract. A non-``none`` ``--any-js-global`` remains an
# explicit override for focused investigations.
DEFAULT_ANY_JS_GLOBALS_BY_DIR_PREFIX: tuple[tuple[str, str], ...] = (
+ ("compression", "both"),
("streams", "both"),
)
-DEFAULT_SCRIPT_CASE_DIR_PREFIXES: tuple[str, ...] = ("streams",)
+DEFAULT_SCRIPT_CASE_DIR_PREFIXES: tuple[str, ...] = ("compression", "streams")
# The initial layout baseline deliberately starts with the CSS areas that are
# both high-value for Moli and predominantly made up of deterministic, static
@@ -992,6 +993,10 @@ def _is_excluded_by_substring(
continue
if token == ".any." and include_any_js:
continue
+ # Opted-in script suites also include secure-context IDL cases. The
+ # runner routes these wrappers through its trustworthy loopback origin.
+ if token == ".https." and include_any_js:
+ continue
if token in {".window.", ".worker."} and include_script_js:
continue
if token in {".sub.", ".https.", ".serviceworker."} and include_sub_https:
diff --git a/moli-benchmark/tests/test_wpt_cross.py b/moli-benchmark/tests/test_wpt_cross.py
index bf04c2970..fff7a1a8a 100644
--- a/moli-benchmark/tests/test_wpt_cross.py
+++ b/moli-benchmark/tests/test_wpt_cross.py
@@ -3219,6 +3219,46 @@ done();
],
)
+ def test_default_enumeration_includes_compression_script_cases(self) -> None:
+ with tempfile.TemporaryDirectory() as temp_dir:
+ wpt_root = Path(temp_dir)
+ sources = {
+ "compression/compression-stream.any.js": "// META: global=window,worker\n",
+ "compression/idlharness.https.any.js": "// META: global=window,dedicatedworker\n",
+ "compression/compression-with-detach.window.js": "",
+ "compression/decompression-with-detach.window.js": "",
+ "compression/feature.tentative.any.js": "",
+ "compression/testdriver.any.js": "// META: script=/resources/testdriver.js\n",
+ "compression/resources/helper.any.js": "",
+ "compression-other/excluded.any.js": "",
+ "compression-other/excluded.window.js": "",
+ }
+ for name, meta in sources.items():
+ path = wpt_root / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(meta + 'test(() => {}, "case");', encoding="utf-8")
+
+ cases = enumerate_cases(wpt_root)
+ focused_cases = enumerate_cases(
+ wpt_root, dir_prefixes=("compression",), any_js_global="both"
+ )
+ window_cases = enumerate_cases(wpt_root, any_js_global="window")
+
+ expected = [
+ "compression/compression-stream.any.js?moli-wpt-any=dedicatedworker",
+ "compression/compression-stream.any.js?moli-wpt-any=window",
+ "compression/compression-with-detach.window.js?moli-wpt-script=window",
+ "compression/decompression-with-detach.window.js?moli-wpt-script=window",
+ "compression/idlharness.https.any.js?moli-wpt-any=dedicatedworker",
+ "compression/idlharness.https.any.js?moli-wpt-any=window",
+ ]
+ self.assertEqual([case.case_path for case in cases], expected)
+ self.assertEqual([case.case_path for case in focused_cases], expected)
+ self.assertEqual(
+ [case.case_path for case in window_cases if case.case_path.startswith("compression/")],
+ [path for path in expected if "dedicatedworker" not in path],
+ )
+
def test_dir_prefix_expands_any_js_variants_and_respects_globals(self) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
wpt_root = Path(temp_dir)
diff --git a/moli-benchmark/wpt-cross-current/failed-cases.txt b/moli-benchmark/wpt-cross-current/failed-cases.txt
index b2b294f6d..0f5e46d89 100644
--- a/moli-benchmark/wpt-cross-current/failed-cases.txt
+++ b/moli-benchmark/wpt-cross-current/failed-cases.txt
@@ -8,6 +8,34 @@ close-watcher/frame-removal.html
compat/webkit-box-item-shrink-001.html
compat/webkit-box-item-shrink-002.html
compat/webkit-box-vertically-centered.html
+compression/compression-bad-chunks.any.js?moli-wpt-any=dedicatedworker
+compression/compression-bad-chunks.any.js?moli-wpt-any=window
+compression/compression-including-empty-chunk.any.js?moli-wpt-any=dedicatedworker
+compression/compression-including-empty-chunk.any.js?moli-wpt-any=window
+compression/compression-large-flush-output.any.js?moli-wpt-any=dedicatedworker
+compression/compression-large-flush-output.any.js?moli-wpt-any=window
+compression/compression-multiple-chunks.any.js?moli-wpt-any=dedicatedworker
+compression/compression-multiple-chunks.any.js?moli-wpt-any=window
+compression/compression-output-length.any.js?moli-wpt-any=dedicatedworker
+compression/compression-output-length.any.js?moli-wpt-any=window
+compression/compression-stream.any.js?moli-wpt-any=dedicatedworker
+compression/compression-stream.any.js?moli-wpt-any=window
+compression/decompression-bad-chunks.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-bad-chunks.any.js?moli-wpt-any=window
+compression/decompression-buffersource.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-buffersource.any.js?moli-wpt-any=window
+compression/decompression-correct-input.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-correct-input.any.js?moli-wpt-any=window
+compression/decompression-corrupt-input.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-corrupt-input.any.js?moli-wpt-any=window
+compression/decompression-empty-input.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-empty-input.any.js?moli-wpt-any=window
+compression/decompression-extra-input.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-extra-input.any.js?moli-wpt-any=window
+compression/decompression-split-chunk.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-split-chunk.any.js?moli-wpt-any=window
+compression/decompression-uint8array-output.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-uint8array-output.any.js?moli-wpt-any=window
content-security-policy/frame-ancestors/frame-ancestors-nested-cross-in-cross-star-allow.html
content-security-policy/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-allow.html
content-security-policy/frame-ancestors/frame-ancestors-nested-same-in-cross-star-allow.html
diff --git a/moli-benchmark/wpt-cross-current/passed-cases.txt b/moli-benchmark/wpt-cross-current/passed-cases.txt
index 218e01234..59d504a75 100644
--- a/moli-benchmark/wpt-cross-current/passed-cases.txt
+++ b/moli-benchmark/wpt-cross-current/passed-cases.txt
@@ -27,6 +27,14 @@ compat/webkit-gradient-sign.html
compat/webkit-mask-box-enumeration.html
compat/webkit-radial-gradient-radii.html
compat/webkit-text-fill-color-currentColor.html
+compression/compression-constructor-error.any.js?moli-wpt-any=dedicatedworker
+compression/compression-constructor-error.any.js?moli-wpt-any=window
+compression/compression-with-detach.window.js?moli-wpt-script=window
+compression/decompression-constructor-error.any.js?moli-wpt-any=dedicatedworker
+compression/decompression-constructor-error.any.js?moli-wpt-any=window
+compression/decompression-with-detach.window.js?moli-wpt-script=window
+compression/idlharness.https.any.js?moli-wpt-any=dedicatedworker
+compression/idlharness.https.any.js?moli-wpt-any=window
content-security-policy/default-src/default-src-strict_dynamic_and_unsafe_inline.html
content-security-policy/embedded-enforcement/iframe-csp-attribute.html
content-security-policy/font-src/font-self-allowed.html