mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
Automatic update from web-platform-testsCookie Store API: Add test showing BOMs are not stripped The cookie RFC[1] does not define an encoding for cookie names/values; they are treated as a sequence of octets. The Cookie Store spec[2] mandates treating the octets as UTF-8 encoded. When decoding octet sequences into strings, the decode should be done without treating a leading U+FEFF as a BOM. Add a test to verify this. [1] https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02 [2] https://wicg.github.io/cookie-store/ Bug: 729800 Change-Id: I23b7eb82b35862b8797a203ae6ea86cbd69001d2 Reviewed-on: https://chromium-review.googlesource.com/1159336 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Victor Costan <pwnall@chromium.org> Cr-Commit-Position: refs/heads/master@{#579985} -- wpt-commits: 2c4d441493daa04906619978f4d1e9838d6b12d1 wpt-pr: 12264
17 lines
581 B
JavaScript
17 lines
581 B
JavaScript
// META: script=resources/cookie-test-helpers.js
|
|
|
|
'use strict';
|
|
|
|
cookie_test(async t => {
|
|
await setCookieStringHttp('\uFEFFcookie=value; path=/');
|
|
const cookie = await cookieStore.get('\uFEFFcookie');
|
|
assert_equals(cookie.name, '\uFEFFcookie');
|
|
assert_equals(cookie.value, 'value');
|
|
}, 'BOM not stripped from name');
|
|
|
|
cookie_test(async t => {
|
|
await setCookieStringHttp('cookie=\uFEFFvalue; path=/');
|
|
const cookie = await cookieStore.get('cookie');
|
|
assert_equals(cookie.name, 'cookie');
|
|
assert_equals(cookie.value, '\uFEFFvalue');
|
|
}, 'BOM not stripped from value');
|