Bug 1452301 [wpt PR 10292] - Cookie Store: disallow '=' in cookies with empty names, a=testonly
authorJoshua Bell <jsbell@chromium.org>
Mon, 09 Apr 2018 22:19:36 +0000
changeset 413767 f6d3dafa1fad3636d5c3ce55e8407f80bb2abb0b
parent 413766 70a68ef1022db7a54765dcaf665776f60534d69b
child 413768 283af2ec0e269a1c07888995615eba997d81bf81
push id33850
push userapavel@mozilla.com
push dateMon, 16 Apr 2018 09:53:48 +0000
treeherdermozilla-central@6276ec7ebbf3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1452301, 10292, 729800, 994145, 548563
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 1452301 [wpt PR 10292] - Cookie Store: disallow '=' in cookies with empty names, a=testonly Automatic update from web-platform-testsCookie Store: disallow '=' in cookies with empty names Per the explainer[1] and tests: "Cookies with an empty name cannot be set using values containing = as this would result in ambiguous serializations in the majority of current browsers." Also, fix a test glitch now that this restriction is implemented. [1] https://github.com/WICG/cookie-store/blob/gh-pages/explainer.md Bug: 729800 Change-Id: I9ed02885c217cbdb4c86d8fd236d49c6c56b6e96 Reviewed-on: https://chromium-review.googlesource.com/994145 Commit-Queue: Joshua Bell <jsbell@chromium.org> Reviewed-by: Victor Costan <pwnall@chromium.org> Cr-Commit-Position: refs/heads/master@{#548563} wpt-commits: dac87dcf26778f497afbcd3706868b598be29564 wpt-pr: 10292 wpt-commits: dac87dcf26778f497afbcd3706868b598be29564 wpt-pr: 10292
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/cookie-store/resources/no_name_equals_in_value.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -424201,17 +424201,17 @@
    "12e0d0f889bbc298e47c2450b20df0fe86ffb566",
    "support"
   ],
   "cookie-store/resources/no_name_and_no_value.js": [
    "907b6f8568f43f6f41fcaa3ec6876a512bcf6fec",
    "support"
   ],
   "cookie-store/resources/no_name_equals_in_value.js": [
-   "37b510261b203717fccaf6917c38ea3d0f24151f",
+   "8a5b87568d36dde7093b1bc6aae02ffe556887ca",
    "support"
   ],
   "cookie-store/resources/no_name_multiple_values.js": [
    "028a1c2e9b82299eef5f383886f2a1cb008c65ee",
    "support"
   ],
   "cookie-store/resources/ordering.js": [
    "822567b7eb113c809379dff5b62a2e24c9e9e171",
--- a/testing/web-platform/tests/cookie-store/resources/no_name_equals_in_value.js
+++ b/testing/web-platform/tests/cookie-store/resources/no_name_equals_in_value.js
@@ -1,46 +1,41 @@
 'use strict';
 
 cookie_test(async t => {
   let eventPromise = observeNextCookieChangeEvent();
   await cookieStore.set('', 'first-value');
-  const actual1 =
-      (await cookieStore.getAll('')).map(({ value }) => value).join(';');
-  const expected1 = 'first-value';
-  assert_equals(actual1, expected1);
+  assert_equals(
+    (await cookieStore.getAll('')).map(({ value }) => value).join(';'),
+    'first-value',
+    'Cookie with no name and normal value should have been set');
   await verifyCookieChangeEvent(
     eventPromise, {changed: [{name: '', value: 'first-value'}]},
     'Observed no-name change');
 
   await promise_rejects(
     t,
     new TypeError(),
     cookieStore.set('', 'suspicious-value=resembles-name-and-value'),
     'Expected promise rejection when setting a cookie with' +
-      ' no name and "=" in value');
+      ' no name and "=" in value (via arguments)');
 
-  const actual2 =
-        (await cookieStore.getAll('')).map(({ value }) => value).join(';');
-  const expected2 = 'first-value';
-  assert_equals(actual2, expected2);
+  await promise_rejects(
+    t,
+    new TypeError(),
+    cookieStore.set(
+      {name: '', value: 'suspicious-value=resembles-name-and-value'}),
+    'Expected promise rejection when setting a cookie with' +
+      ' no name and "=" in value (via options)');
+
   assert_equals(
-    await getCookieString(),
+    (await cookieStore.getAll('')).map(({ value }) => value).join(';'),
     'first-value',
-    'Earlier cookie jar after rejected');
+    'Cookie with no name should still have previous value');
 
   eventPromise = observeNextCookieChangeEvent();
   await cookieStore.delete('');
   await verifyCookieChangeEvent(
-    eventPromise, {deleted: [{name: '', value: ''}]},
+    eventPromise, {deleted: [{name: ''}]},
     'Observed no-name deletion');
 
-  assert_equals(
-    await getCookieString(),
-    undefined,
-    'Empty cookie jar after cleanup');
-  assert_equals(
-    await getCookieStringHttp(),
-    undefined,
-    'Empty HTTP cookie jar after cleanup');
-
 }, "Verify that attempting to set a cookie with no name and with '=' in" +
              " the value does not work.");