Bug 1760741 [wpt PR 33296] - Add WPT for Early Hints with arbitrary header, a=testonly
authorKenichi Ishibashi <bashi@chromium.org>
Thu, 24 Mar 2022 12:20:13 +0000
changeset 687326 6015893a838a396e23a015e928a26b7eee2340c4
parent 687325 eff90f125d0b23220ca67bd7cf9ceeb825d13d9e
child 687327 87bad8070d68fac2dcd63a99777fdd1f1b8827b7
push id2831
push userffxbld-merge
push dateMon, 25 Apr 2022 15:51:01 +0000
treeherdermozilla-release@bad8853d0c21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1760741, 33296, 1305896, 3539727, 984026
milestone100.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1760741 [wpt PR 33296] - Add WPT for Early Hints with arbitrary header, a=testonly Automatic update from web-platform-tests Add WPT for Early Hints with arbitrary header It should have no effect. Bug: 1305896 Change-Id: I088f0aa4dd8f992140c3a62fabff2bd1d4dd1f95 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3539727 Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Cr-Commit-Position: refs/heads/main@{#984026} -- wpt-commits: aa4c1758f854c7c7954d2a3240d55bdaa24361d7 wpt-pr: 33296
testing/web-platform/tests/loading/early-hints/arbitrary-header-in-early-hints.h2.window.js
testing/web-platform/tests/loading/early-hints/resources/arbitrary-header-in-early-hints.h2.py
testing/web-platform/tests/loading/early-hints/resources/arbitrary-header-in-early-hints.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/loading/early-hints/arbitrary-header-in-early-hints.h2.window.js
@@ -0,0 +1,4 @@
+test(() => {
+    const test_url = "resources/arbitrary-header-in-early-hints.h2.py";
+    window.location.replace(new URL(test_url, window.location));
+});
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/loading/early-hints/resources/arbitrary-header-in-early-hints.h2.py
@@ -0,0 +1,24 @@
+import os
+
+
+def handle_headers(frame, request, response):
+    # Send an early hints response with an unsupported header.
+    # User agents should ignore it.
+    early_hints = [
+        (b":status", b"103"),
+        (b"x-arbitrary-header", b"foobar"),
+    ]
+    response.writer.write_raw_header_frame(headers=early_hints,
+                                           end_headers=True)
+
+    response.status = 200
+    response.headers[b"content-type"] = "text/html"
+    response.write_status_headers()
+
+
+def main(request, response):
+    current_dir = os.path.dirname(os.path.realpath(__file__))
+    file_path = os.path.join(current_dir, "arbitrary-header-in-early-hints.html")
+    with open(file_path, "r") as f:
+        test_content = f.read()
+    response.writer.write_data(item=test_content, last=True)
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/loading/early-hints/resources/arbitrary-header-in-early-hints.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+promise_test(async (t) => {
+    // Pass when the page is successfully loaded.
+}, "An Early hints response contains an arbitrary header and it should have no effect.");
+</script>
+</body>