Bug 1458086 [wpt PR 10719] - Add web platform test for malformed client hints header, a=testonly
authorTarun Bansal <tbansal@chromium.org>
Tue, 01 May 2018 17:23:24 +0000
changeset 472722 437b381bc3adf8c1e98dc8cb8a3f1f1feaf8ef74
parent 472721 78af959b8dbc43881f5fbb0ac50474ef03c9490a
child 472723 c07362c50c09d20b07baea9a13af346f929a3dda
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1458086, 10719, 817049, 1035914, 554860
milestone61.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 1458086 [wpt PR 10719] - Add web platform test for malformed client hints header, a=testonly Automatic update from web-platform-testsAdd web platform test for malformed client hints header Bug: 817049 Change-Id: I06eba99526dfd5b0a3f7fdc8fca60355abf93326 Reviewed-on: https://chromium-review.googlesource.com/1035914 Reviewed-by: Robert Ma <robertma@chromium.org> Commit-Queue: Tarun Bansal <tbansal@chromium.org> Cr-Commit-Position: refs/heads/master@{#554860} -- wpt-commits: b112fb2a9f891d2391782786ad54058b794b7312 wpt-pr: 10719
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/client-hints/accept_ch_malformed_header.https.html
testing/web-platform/tests/client-hints/accept_ch_malformed_header.https.html.headers
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -192360,16 +192360,21 @@
      {}
     ]
    ],
    "client-hints/accept_ch.sub.https.html.headers": [
     [
      {}
     ]
    ],
+   "client-hints/accept_ch_malformed_header.https.html.headers": [
+    [
+     {}
+    ]
+   ],
    "client-hints/echo_client_hints_received.py": [
     [
      {}
     ]
    ],
    "clipboard-apis/OWNERS": [
     [
      {}
@@ -311380,16 +311385,22 @@
     ]
    ],
    "client-hints/accept_ch.sub.https.html": [
     [
      "/client-hints/accept_ch.sub.https.html",
      {}
     ]
    ],
+   "client-hints/accept_ch_malformed_header.https.html": [
+    [
+     "/client-hints/accept_ch_malformed_header.https.html",
+     {}
+    ]
+   ],
    "clipboard-apis/async-interfaces.https.html": [
     [
      "/clipboard-apis/async-interfaces.https.html",
      {}
     ]
    ],
    "clipboard-apis/async-navigator-clipboard-basics.https.html": [
     [
@@ -407833,16 +407844,24 @@
   "client-hints/accept_ch.sub.https.html": [
    "7d5a8d7d6ffb78f99d17fc0c41abf26718c6b6b0",
    "testharness"
   ],
   "client-hints/accept_ch.sub.https.html.headers": [
    "25cd8622db940411b0e8eb39921e6086916e4f36",
    "support"
   ],
+  "client-hints/accept_ch_malformed_header.https.html": [
+   "d0c116ce2a1f8d775bb8d9b800eae05f0bee12f9",
+   "testharness"
+  ],
+  "client-hints/accept_ch_malformed_header.https.html.headers": [
+   "e57611a23dbd0763e1d318af602f05a2593b149e",
+   "support"
+  ],
   "client-hints/echo_client_hints_received.py": [
    "a6cf24dc7d02b044a27813f50737bb3aff4af8bf",
    "support"
   ],
   "clipboard-apis/OWNERS": [
    "bae753666bda85e9805a5e2fad80ba71459b8aba",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/accept_ch_malformed_header.https.html
@@ -0,0 +1,23 @@
+<html>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+
+promise_test(t => {
+  return fetch("/client-hints/echo_client_hints_received.py").then(r => {
+    assert_equals(r.status, 200)
+    // Verify that the browser does not include client hints in the headers
+    // since Accept-CH is malformed (includes whitespace between attributes
+    // instead of comma).
+    assert_false(r.headers.has("device-memory-received"), "device-memory-received");
+    assert_false(r.headers.has("dpr-received"), "dpr-received");
+    assert_false(r.headers.has("viewport-width-received"), "viewport-width-received");
+  });
+}, "Accept-CH header test");
+
+</script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/client-hints/accept_ch_malformed_header.https.html.headers
@@ -0,0 +1,1 @@
+Accept-CH: device-memory dpr
\ No newline at end of file