From 9f01a06e5e507e109b6b6a6999970826c48dc4ab Mon Sep 17 00:00:00 2001 From: Tom McKee Date: Wed, 25 Jul 2018 21:16:11 +0000 Subject: [PATCH] Bug 1477877 [wpt PR 12149] - Adding tests against and fixes for tabs in Server-Timing headers, a=testonly Automatic update from web-platform-testsAdding tests against and fixes for tabs in Server-Timing headers According to the spec (https://w3c.github.io/server-timing/#the-server-timing-header-field), optional whitespace is allowed amongst parameter names and values. We should be discarding this whitespace during parsing but, when there are tabs, we were treating it like an error and discarding the whole value. Changed the code that tokenizes HTTP headers to skip tabs and spaces when consuming optional whitespace. BUG=798446 Change-Id: If776761e5ea199e662ec7b2b5aa245e4581131fd Reviewed-on: https://chromium-review.googlesource.com/1147258 Reviewed-by: Emil A Eklund Commit-Queue: Tom McKee Cr-Commit-Position: refs/heads/master@{#577325} -- wpt-commits: 4ec913040882c7bb28846a65e7e086785dcf2ab6 wpt-pr: 12149 --- testing/web-platform/meta/MANIFEST.json | 22 +++++++++++++++++-- .../server-timing/resources/parsing/84.js | 1 + .../resources/parsing/84.js.sub.headers | 1 + .../server_timing_header-parsing.html | 2 +- .../server_timing_header-parsing.https.html | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 testing/web-platform/tests/server-timing/resources/parsing/84.js create mode 100644 testing/web-platform/tests/server-timing/resources/parsing/84.js.sub.headers diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 3956357180c8..ea6908d89ea8 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -294449,6 +294449,16 @@ {} ] ], + "server-timing/resources/parsing/84.js": [ + [ + {} + ] + ], + "server-timing/resources/parsing/84.js.sub.headers": [ + [ + {} + ] + ], "server-timing/resources/parsing/9.js": [ [ {} @@ -613988,6 +613998,14 @@ "ba24e1d89104fb25d5100dfa0b38388ca19ee9c1", "support" ], + "server-timing/resources/parsing/84.js": [ + "aa4b60a397c4704689621874403329c705598c9c", + "support" + ], + "server-timing/resources/parsing/84.js.sub.headers": [ + "94fd8cac84f6fdc22d8b46786ac690f788e657f4", + "support" + ], "server-timing/resources/parsing/9.js": [ "5660bb21eb42f322a58f80c6c001d14c6e0fc0c9", "support" @@ -613997,11 +614015,11 @@ "support" ], "server-timing/server_timing_header-parsing.html": [ - "7ec595af5a8c240c0fe0a4b10469fd11e2f56cbf", + "8df39d7b393cb0ae6dac1997b2d8755210a97ea5", "testharness" ], "server-timing/server_timing_header-parsing.https.html": [ - "7ec595af5a8c240c0fe0a4b10469fd11e2f56cbf", + "8df39d7b393cb0ae6dac1997b2d8755210a97ea5", "testharness" ], "server-timing/service_worker_idl.https.html": [ diff --git a/testing/web-platform/tests/server-timing/resources/parsing/84.js b/testing/web-platform/tests/server-timing/resources/parsing/84.js new file mode 100644 index 000000000000..30515fd8b1b8 --- /dev/null +++ b/testing/web-platform/tests/server-timing/resources/parsing/84.js @@ -0,0 +1 @@ +testServerTiming(document.currentScript, [{"name":"metric", "desc":"tabs-should-get-trimmed", "dur": 42.0}]) diff --git a/testing/web-platform/tests/server-timing/resources/parsing/84.js.sub.headers b/testing/web-platform/tests/server-timing/resources/parsing/84.js.sub.headers new file mode 100644 index 000000000000..ae864b539bbb --- /dev/null +++ b/testing/web-platform/tests/server-timing/resources/parsing/84.js.sub.headers @@ -0,0 +1 @@ +Server-Timing: metric; desc= tabs-should-get-trimmed ;dur= 42 diff --git a/testing/web-platform/tests/server-timing/server_timing_header-parsing.html b/testing/web-platform/tests/server-timing/server_timing_header-parsing.html index f74ffeba0f89..156dfcd344f3 100644 --- a/testing/web-platform/tests/server-timing/server_timing_header-parsing.html +++ b/testing/web-platform/tests/server-timing/server_timing_header-parsing.html @@ -43,7 +43,7 @@ tests generated by: }) done() } - for (let i = 0; i <= 83; i++) { + for (let i = 0; i <= 84; i++) { const script = document.createElement('script') script.src = `./resources/parsing/${i}.js` document.getElementsByTagName('head')[0].appendChild(script) diff --git a/testing/web-platform/tests/server-timing/server_timing_header-parsing.https.html b/testing/web-platform/tests/server-timing/server_timing_header-parsing.https.html index f74ffeba0f89..156dfcd344f3 100644 --- a/testing/web-platform/tests/server-timing/server_timing_header-parsing.https.html +++ b/testing/web-platform/tests/server-timing/server_timing_header-parsing.https.html @@ -43,7 +43,7 @@ tests generated by: }) done() } - for (let i = 0; i <= 83; i++) { + for (let i = 0; i <= 84; i++) { const script = document.createElement('script') script.src = `./resources/parsing/${i}.js` document.getElementsByTagName('head')[0].appendChild(script)