Bug 1472106 [wpt PR 11724] - Async Cookies: Update Cookie Store API to match spec., a=testonly
authorVictor Costan <pwnall@chromium.org>
Fri, 06 Jul 2018 23:55:46 +0000
changeset 426060 cb257b6be6c5059e8f0864561d2d6ee46c2f18a6
parent 426059 82e492bb2e6b9e25bff86950fe3ae1e699bc577f
child 426061 88745ede32dd2974ef76b0ae26f89f887f4bec1f
push id105141
push userjames@hoppipolla.co.uk
push dateWed, 11 Jul 2018 07:44:38 +0000
treeherdermozilla-inbound@b06fa226ba6d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1472106, 11724, 729800, 1117868, 571736
milestone63.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 1472106 [wpt PR 11724] - Async Cookies: Update Cookie Store API to match spec., a=testonly Automatic update from web-platform-testsAsync Cookies: Update Cookie Store API to match spec. This CL changes the signatures of cookieStore.{get,getAll,set,delete} and introduces the CookieStoreDeleteOptions and CookieStoreSetExtraOptions dictionary. The CL also updates the CookieListItem dictionary. TBR=haraken Bug: 729800 Change-Id: Iaa62b5a51cc79b19cb567be30a2f0dda54e326d8 Reviewed-on: https://chromium-review.googlesource.com/1117868 Commit-Queue: Victor Costan <pwnall@chromium.org> Reviewed-by: Joshua Bell <jsbell@chromium.org> Cr-Commit-Position: refs/heads/master@{#571736} -- wpt-commits: 0e96b1f8627cf798ebea0c2a0cdf6b5d8cb8825e wpt-pr: 11724
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/cookie-store/cookieListItem_attributes.tentative.https.window.js
testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js
testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js
testing/web-platform/tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js
testing/web-platform/tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js
testing/web-platform/tests/interfaces/cookie-store.idl
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -440844,21 +440844,21 @@
    "b0d8c58c78cfd2dcc8a81b83fb17afadeabfb375",
    "support"
   ],
   "cookie-store/README.md": [
    "40595162d15dec7e315ef16f94646045596d7b1c",
    "support"
   ],
   "cookie-store/cookieListItem_attributes.tentative.https.window.js": [
-   "773ad9b5ea3636497f9f90c57e5bc5a2fa63c289",
+   "4b90ff7956f16f2f829829cda1047c3eec48ae93",
    "testharness"
   ],
   "cookie-store/cookieStore_delete_arguments.tentative.https.window.js": [
-   "740fccd53713d8ffdd84aa388580630025fc016c",
+   "1ade936aa42802c4fc1672b5ababd9eb15e2b4a9",
    "testharness"
   ],
   "cookie-store/cookieStore_delete_basic.tentative.https.window.js": [
    "c0a5c01ffcdd3755eb3db3dc4a6ec398fd2aba37",
    "testharness"
   ],
   "cookie-store/cookieStore_event_arguments.tenative.https.window.js": [
    "a61074b6062928c29a83e0f7d456fdce9e3a3d47",
@@ -440872,45 +440872,45 @@
    "b492c6567ef91ea0def4195b049f9553bbc8271d",
    "testharness"
   ],
   "cookie-store/cookieStore_event_overwrite.tentative.https.window.js": [
    "cd238bae3c79a5f3c6e385466fe29487bf0e4c70",
    "testharness"
   ],
   "cookie-store/cookieStore_getAll_arguments.tentative.https.window.js": [
-   "ea9bc48ed9d2da2523b97d92de84c65226206211",
+   "8af46d4d9a1b30fa742ce674fff4a6e84325b2eb",
    "testharness"
   ],
   "cookie-store/cookieStore_getAll_multiple.tentative.https.window.js": [
    "f54045073f8db4f16682da3a4cabc98feb6bdd2e",
    "testharness"
   ],
   "cookie-store/cookieStore_getAll_set_basic.tentative.https.window.js": [
    "d3c3430fa08d8573e6d95c56e0b91604286eb632",
    "testharness"
   ],
   "cookie-store/cookieStore_get_arguments.tentative.https.window.js": [
-   "ea197608e10369f700585066bb91e6846df2fe73",
+   "f189edac32de86822bd9f1dfaa11e1a3dd507e21",
    "testharness"
   ],
   "cookie-store/cookieStore_get_delete_basic.tentative.https.window.js": [
    "a5f91a2bbe6c619b01a9e3deb473645a36c85b44",
    "testharness"
   ],
   "cookie-store/cookieStore_get_set_basic.tentative.https.window.js": [
    "475f0cdc18f63a0b3a710800a7a4ed82fd7b8ee8",
    "testharness"
   ],
   "cookie-store/cookieStore_in_detached_frame.tentative.https.html": [
    "600452c1a496b8335b27bd24943b8834e37bf4d5",
    "testharness"
   ],
   "cookie-store/cookieStore_set_arguments.tentative.https.window.js": [
-   "832b25b61626d3c9656731470ea06e0f95028958",
+   "d017d31481f73c3e83af7ae6560869e05026239a",
    "testharness"
   ],
   "cookie-store/cookieStore_special_names.tentative.https.window.js": [
    "36bcdc14981a5d71f5e46f1cef4ee2031434bc62",
    "testharness"
   ],
   "cookie-store/document_cookie.tentative.https.html": [
    "447ba96e7bb23a0def44817e584891097bb81998",
@@ -593484,17 +593484,17 @@
    "e674e142d1348afd587b566d86b9390ad8bc56a0",
    "support"
   ],
   "interfaces/console.idl": [
    "43ced34008dc73d05c79140d8dc33c60e2d9df3a",
    "support"
   ],
   "interfaces/cookie-store.idl": [
-   "427e33a156cad6978e1c9c5ef5a9f906aa67a4c4",
+   "468487d9aee05767b52a112275155fa883720aa0",
    "support"
   ],
   "interfaces/cors-rfc1918.idl": [
    "d7f133c8dd6e1656f82c077d9795714827b9c869",
    "support"
   ],
   "interfaces/credential-management.idl": [
    "29a0bcde9ddd6629c7bf05757cea45c831fe9a6b",
--- a/testing/web-platform/tests/cookie-store/cookieListItem_attributes.tentative.https.window.js
+++ b/testing/web-platform/tests/cookie-store/cookieListItem_attributes.tentative.https.window.js
@@ -124,112 +124,106 @@ promise_test(async testCase => {
   assert_equals(cookie.sameSite, 'strict');
   assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'CookieListItem - cookieStore.set with name and value in options and ' +
    'expires set to a future Date');
 
 promise_test(async testCase => {
-  await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
+  await cookieStore.delete({ name: 'cookie-name', domain: kCurrentHostname });
 
   await cookieStore.set('cookie-name', 'cookie-value',
                         { domain: kCurrentHostname });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
   assert_equals(cookie.domain, kCurrentHostname);
   assert_equals(cookie.path, '/');
   assert_equals(cookie.expires, null);
   assert_equals(cookie.secure, true);
   assert_equals(cookie.sameSite, 'strict');
   assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
+    await cookieStore.delete({ name: 'cookie-name', domain: kCurrentHostname });
   });
 }, 'CookieListItem - cookieStore.set with domain set to the current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentPath = currentUrl.pathname;
   const currentDirectory =
       currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
-  await cookieStore.delete('cookie-name', { path: currentDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
 
   await cookieStore.set('cookie-name', 'cookie-value',
                         { path: currentDirectory });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
   assert_equals(cookie.domain, null);
   assert_equals(cookie.path, currentDirectory);
   assert_equals(cookie.expires, null);
   assert_equals(cookie.secure, true);
   assert_equals(cookie.sameSite, 'strict');
   assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { path: currentDirectory });
+    await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
   });
 }, 'CookieListItem - cookieStore.set with path set to the current directory');
 
 promise_test(async testCase => {
-  await cookieStore.delete('cookie-name', { secure: false });
+  await cookieStore.delete('cookie-name');
 
   await cookieStore.set('cookie-name', 'cookie-value', { secure: false });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
   assert_equals(cookie.domain, null);
   assert_equals(cookie.path, '/');
   assert_equals(cookie.expires, null);
   assert_equals(cookie.secure, false);
   assert_equals(cookie.sameSite, 'strict');
   assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
-  await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { secure: false });
-  });
+  await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'CookieListItem - cookieStore.set with secure set to false');
 
 ['strict', 'lax', 'unrestricted'].forEach(sameSiteValue => {
   promise_test(async testCase => {
-    await cookieStore.delete('cookie-name', { sameSite: sameSiteValue });
+    await cookieStore.delete('cookie-name');
 
     await cookieStore.set({
         name: 'cookie-name', value: 'cookie-value', sameSite: sameSiteValue });
     const cookie = await cookieStore.get('cookie-name');
     assert_equals(cookie.name, 'cookie-name');
     assert_equals(cookie.value, 'cookie-value');
     assert_equals(cookie.domain, null);
     assert_equals(cookie.path, '/');
     assert_equals(cookie.expires, null);
     assert_equals(cookie.secure, true);
     assert_equals(cookie.sameSite, sameSiteValue);
     assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
-    await async_cleanup(async () => {
-      await cookieStore.delete('cookie-name', { secure: sameSiteValue });
-    });
+    await async_cleanup(() => cookieStore.delete('cookie-name'));
   }, `CookieListItem - cookieStore.set with sameSite set to ${sameSiteValue}`);
 
   promise_test(async testCase => {
-    await cookieStore.delete('cookie-name', { sameSite: sameSiteValue });
+    await cookieStore.delete('cookie-name');
 
     await cookieStore.set('cookie-name', 'cookie-value',
                           { sameSite: sameSiteValue });
     const cookie = await cookieStore.get('cookie-name');
     assert_equals(cookie.name, 'cookie-name');
     assert_equals(cookie.value, 'cookie-value');
     assert_equals(cookie.domain, null);
     assert_equals(cookie.path, '/');
     assert_equals(cookie.expires, null);
     assert_equals(cookie.secure, true);
     assert_equals(cookie.sameSite, sameSiteValue);
     assert_array_equals(Object.keys(cookie).sort(), kCookieListItemKeys);
 
-    await async_cleanup(async () => {
-      await cookieStore.delete('cookie-name', { secure: sameSiteValue });
-    });
+    await async_cleanup(() => cookieStore.delete('cookie-name'));
   }, 'CookieListItem - cookieStore.set with positional name and value and ' +
      `sameSite set to ${sameSiteValue}`);
 });
--- a/testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js
+++ b/testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.window.js
@@ -26,100 +26,71 @@ promise_test(async testCase => {
   assert_equals(cookie, null);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.delete with name in options');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
-  await promise_rejects(testCase, new TypeError(), cookieStore.delete(
-      'cookie-name', { name: 'cookie-name' }));
+  await cookieStore.delete('cookie-name', { name: 'wrong-cookie-name' });
   const cookie = await cookieStore.get('cookie-name');
-  assert_equals(cookie.name, 'cookie-name');
-  assert_equals(cookie.value, 'cookie-value');
+  assert_equals(cookie, null);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.delete with name in both positional arguments and options');
 
 promise_test(async testCase => {
-  await cookieStore.set('cookie-name', 'cookie-value');
-
-  await promise_rejects(testCase, new TypeError(), cookieStore.delete(
-      'cookie-name', { value: 'cookie-value' }));
-  const cookie = await cookieStore.get('cookie-name');
-  assert_equals(cookie.name, 'cookie-name');
-  assert_equals(cookie.value, 'cookie-value');
-
-  await async_cleanup(() => cookieStore.delete('cookie-name'));
-}, 'cookieStore.delete with value in options');
-
-promise_test(async testCase => {
-  await cookieStore.set('cookie-name', 'cookie-value');
-
-  const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;
-  const tenYearsAgo = Date.now() - tenYears;
-
-  await promise_rejects(testCase, new TypeError(), cookieStore.delete(
-      'cookie-name', { expires: tenYearsAgo }));
-  const cookie = await cookieStore.get('cookie-name');
-  assert_equals(cookie.name, 'cookie-name');
-  assert_equals(cookie.value, 'cookie-value');
-
-  await async_cleanup(() => cookieStore.delete('cookie-name'));
-}, 'cookieStore.delete with expires in options');
-
-promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   await cookieStore.set(
       'cookie-name', 'cookie-value', { domain: currentDomain });
 
-  await cookieStore.delete('cookie-name', { domain: currentDomain });
+  await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie, null);
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { domain: currentDomain })
+    await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   });
 }, 'cookieStore.delete with domain set to the current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   const subDomain = `sub.${currentDomain}`;
 
   await promise_rejects(testCase, new TypeError(), cookieStore.delete(
-      'cookie-name', 'cookie-value', { domain: subDomain }));
+      { name: 'cookie-name', domain: subDomain }));
 }, 'cookieStore.delete with domain set to a subdomain of the current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   assert_not_equals(currentDomain[0] === '.',
       'this test assumes that the current hostname does not start with .');
   const domainSuffix = currentDomain.substr(1);
 
   await promise_rejects(testCase, new TypeError(), cookieStore.delete(
-      'cookie-name', { domain: domainSuffix }));
+      { name: 'cookie-name', domain: domainSuffix }));
 }, 'cookieStore.delete with domain set to a non-domain-matching suffix of ' +
    'the current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   await cookieStore.set(
       'cookie-name', 'cookie-value', { domain: currentDomain });
 
   await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie, null);
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { domain: currentDomain })
+    await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   });
 }, 'cookieStore.delete with name in options and domain set to the current ' +
    'hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   const subDomain = `sub.${currentDomain}`;
@@ -144,35 +115,49 @@ promise_test(async testCase => {
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentPath = currentUrl.pathname;
   const currentDirectory =
       currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
   await cookieStore.set(
       'cookie-name', 'cookie-value', { path: currentDirectory });
 
-  await cookieStore.delete('cookie-name', { path: currentDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie, null);
 
   async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { path: currentDirectory })
+    await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
   });
 }, 'cookieStore.delete with path set to the current directory');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentPath = currentUrl.pathname;
   const currentDirectory =
       currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
   const subDirectory = currentDirectory + "subdir/";
   await cookieStore.set(
       'cookie-name', 'cookie-value', { path: currentDirectory });
 
-  await cookieStore.delete('cookie-name', { path: subDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: subDirectory });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { path: currentDirectory })
+    await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
   });
 }, 'cookieStore.delete with path set to subdirectory of the current directory');
+
+promise_test(async testCase => {
+  await cookieStore.set('cookie-name', 'cookie-value');
+
+  const cookie_attributes = await cookieStore.get('cookie-name');
+  assert_equals(cookie_attributes.name, 'cookie-name');
+  assert_equals(cookie_attributes.value, 'cookie-value');
+
+  await cookieStore.delete(cookie_attributes);
+  const cookie = await cookieStore.get('cookie-name');
+  assert_equals(cookie, null);
+
+  await async_cleanup(() => cookieStore.delete('cookie-name'));
+}, 'cookieStore.delete with get result');
--- a/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js
+++ b/testing/web-platform/tests/cookie-store/cookieStore_getAll_arguments.tentative.https.window.js
@@ -51,69 +51,80 @@ promise_test(async testCase => {
   await async_cleanup(() => cookieStore.delete('cookie-name'));
   await async_cleanup(() => cookieStore.delete('cookie-name-2'));
 }, 'cookieStore.getAll with name in options');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
   await cookieStore.set('cookie-name-2', 'cookie-value-2');
 
-  await promise_rejects(testCase, new TypeError(), cookieStore.get(
-      'cookie-name', { name: 'cookie-name' }));
+  const cookies = await cookieStore.getAll('cookie-name',
+                                           { name: 'wrong-cookie-name' });
+  assert_equals(cookies.length, 1);
+  assert_equals(cookies[0].name, 'cookie-name');
+  assert_equals(cookies[0].value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
   await async_cleanup(() => cookieStore.delete('cookie-name-2'));
 }, 'cookieStore.getAll with name in both positional arguments and options');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
-  const cookies = await cookieStore.getAll(
-      'cookie-name', { matchType: 'equals' });
+  const cookies = await cookieStore.getAll({ name: 'cookie-name',
+                                             matchType: 'equals' });
   assert_equals(cookies.length, 1);
   assert_equals(cookies[0].name, 'cookie-name');
   assert_equals(cookies[0].value, 'cookie-value');
 
   const no_cookies = await cookieStore.getAll(
       'cookie-na', { matchType: 'equals' });
   assert_equals(no_cookies.length, 0);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.getAll with matchType explicitly set to equals');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
   await cookieStore.set('cookie-name-2', 'cookie-value-2');
 
-  const cookies = await cookieStore.getAll(
-      'cookie-name-', { matchType: 'starts-with' });
+  const cookies = await cookieStore.getAll({ name: 'cookie-name-',
+                                             matchType: 'starts-with' });
   assert_equals(cookies.length, 1);
   assert_equals(cookies[0].name, 'cookie-name-2');
   assert_equals(cookies[0].value, 'cookie-value-2');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
   await async_cleanup(() => cookieStore.delete('cookie-name-2'));
 }, 'cookieStore.getAll with matchType set to starts-with');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
   await cookieStore.set('cookie-name-2', 'cookie-value-2');
 
   await promise_rejects(testCase, new TypeError(), cookieStore.getAll(
-      'cookie-name', { matchType: 'invalid' }));
+      { name: 'cookie-name', matchType: 'invalid' }));
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
   await async_cleanup(() => cookieStore.delete('cookie-name-2'));
 }, 'cookieStore.getAll with invalid matchType');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
-  await cookieStore.set('cookie-name-2', 'cookie-value-2');
 
-  const cookies = await cookieStore.getAll(
-      { matchType: 'starts-with', name: 'cookie-name-' });
+  const cookies = await cookieStore.getAll({ matchType: 'equals' });
   assert_equals(cookies.length, 1);
-  assert_equals(cookies[0].name, 'cookie-name-2');
-  assert_equals(cookies[0].value, 'cookie-value-2');
+  assert_equals(cookies[0].name, 'cookie-name');
+  assert_equals(cookies[0].value, 'cookie-value');
+
+  async_cleanup(() => cookieStore.delete('cookie-name'));
+}, 'cookieStore.getAll with matchType set to equals and missing name');
 
-  await async_cleanup(() => cookieStore.delete('cookie-name'));
-  await async_cleanup(() => cookieStore.delete('cookie-name-2'));
-}, 'cookieStore.getAll with matchType set to starts-with and name in options');
+promise_test(async testCase => {
+  await cookieStore.set('cookie-name', 'cookie-value');
+
+  const cookies = await cookieStore.getAll({ matchType: 'starts-with' });
+  assert_equals(cookies.length, 1);
+  assert_equals(cookies[0].name, 'cookie-name');
+  assert_equals(cookies[0].value, 'cookie-value');
+
+  async_cleanup(() => cookieStore.delete('cookie-name'));
+}, 'cookieStore.getAll with matchType set to starts-with and missing name');
--- a/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js
+++ b/testing/web-platform/tests/cookie-store/cookieStore_get_arguments.tentative.https.window.js
@@ -8,16 +8,26 @@ async function async_cleanup(cleanup_fun
   } catch (e) {
     // Errors in cleanup functions shouldn't result in test failures.
   }
 }
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
+  const cookie = await cookieStore.get();
+  assert_equals(cookie.name, 'cookie-name');
+  assert_equals(cookie.value, 'cookie-value');
+
+  await async_cleanup(() => cookieStore.delete('cookie-name'));
+}, 'cookieStore.get with no arguments');
+
+promise_test(async testCase => {
+  await cookieStore.set('cookie-name', 'cookie-value');
+
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with positional name');
 
 promise_test(async testCase => {
@@ -28,59 +38,68 @@ promise_test(async testCase => {
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with name in options');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
-  await promise_rejects(testCase, new TypeError(), cookieStore.get(
-      'cookie-name', { name: 'cookie-name' }));
+  const cookie = await cookieStore.get('cookie-name',
+                                       { name: 'wrong-cookie-name' });
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with name in both positional arguments and options');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
   const cookie = await cookieStore.get(
       'cookie-name', { matchType: 'equals' });
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
-  const no_cookie = await cookieStore.get(
-      'cookie-na', { matchType: 'equals' });
+  const no_cookie = await cookieStore.get({ name: 'cookie-na',
+                                            matchType: 'equals' });
   assert_equals(no_cookie, null);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with matchType explicitly set to equals');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
-  const cookie = await cookieStore.get(
-      'cookie-na', { matchType: 'starts-with' });
+  const cookie = await cookieStore.get({ name: 'cookie-na',
+                                         matchType: 'starts-with' });
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with matchType set to starts-with');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
   await promise_rejects(testCase, new TypeError(), cookieStore.get(
-      'cookie-name', { matchType: 'invalid' }));
+      { name: 'cookie-name', matchType: 'invalid' }));
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.get with invalid matchType');
 
 promise_test(async testCase => {
   await cookieStore.set('cookie-name', 'cookie-value');
 
-  const cookie = await cookieStore.get(
-      { matchType: 'starts-with', name: 'cookie-na' });
+  const cookie = await cookieStore.get({ matchType: 'equals' });
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   async_cleanup(() => cookieStore.delete('cookie-name'));
-}, 'cookieStore.get with matchType set to starts-with and name in options');
+}, 'cookieStore.get with matchType set to equals and missing name');
+
+promise_test(async testCase => {
+  await cookieStore.set('cookie-name', 'cookie-value');
+
+  const cookie = await cookieStore.get({ matchType: 'starts-with' });
+  assert_equals(cookie.name, 'cookie-name');
+  assert_equals(cookie.value, 'cookie-value');
+
+  async_cleanup(() => cookieStore.delete('cookie-name'));
+}, 'cookieStore.get with matchType set to starts-with and missing name');
--- a/testing/web-platform/tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js
+++ b/testing/web-platform/tests/cookie-store/cookieStore_set_arguments.tentative.https.window.js
@@ -31,31 +31,32 @@ promise_test(async testCase => {
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.set with name and value in options');
 
 promise_test(async testCase => {
   await cookieStore.delete('cookie-name');
 
-  await promise_rejects(testCase, new TypeError(), cookieStore.set(
-      'cookie-name', 'cookie-value', { name: 'cookie-name' }));
+  cookieStore.set('cookie-name', 'cookie-value', { name: 'wrong-cookie-name' });
   const cookie = await cookieStore.get('cookie-name');
-  assert_equals(cookie, null);
+  assert_equals(cookie.name, 'cookie-name');
+  assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.set with name in both positional arguments and options');
 
 promise_test(async testCase => {
   await cookieStore.delete('cookie-name');
 
-  await promise_rejects(testCase, new TypeError(), cookieStore.set(
-      'cookie-name', 'cookie-value', { value: 'cookie-value' }));
+  cookieStore.set('cookie-name', 'cookie-value',
+                  { value: 'wrong-cookie-value' });
   const cookie = await cookieStore.get('cookie-name');
-  assert_equals(cookie, null);
+  assert_equals(cookie.name, 'cookie-name');
+  assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.set with value in both positional arguments and options');
 
 promise_test(async testCase => {
   const tenYears = 10 * 365 * 24 * 60 * 60 * 1000;
   const tenYearsFromNow = Date.now() + tenYears;
   await cookieStore.delete('cookie-name');
@@ -134,26 +135,26 @@ promise_test(async testCase => {
   assert_equals(cookie, null);
 
   await async_cleanup(() => cookieStore.delete('cookie-name'));
 }, 'cookieStore.set with name and value in options and expires in the past');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
-  await cookieStore.delete('cookie-name', { domain: currentDomain });
+  await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
 
   await cookieStore.set(
       'cookie-name', 'cookie-value', { domain: currentDomain });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { domain: currentDomain });
+    await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   });
 }, 'cookieStore.set with domain set to the current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
   const subDomain = `sub.${currentDomain}`;
 
@@ -193,63 +194,81 @@ promise_test(async testCase => {
   assert_equals(cookies[1].name, 'cookie-name');
 
   const values = cookies.map((cookie) => cookie.value);
   values.sort();
   assert_array_equals(values, ['cookie-value1', 'cookie-value2']);
 
   await async_cleanup(async () => {
     await cookieStore.delete('cookie-name');
-    await cookieStore.delete('cookie-name', { domain: currentDomain });
+    await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   });
 }, 'cookieStore.set default domain is null and differs from current hostname');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentPath = currentUrl.pathname;
   const currentDirectory =
       currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
-  await cookieStore.delete('cookie-name', { path: currentDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
 
   await cookieStore.set(
       'cookie-name', 'cookie-value', { path: currentDirectory });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie.name, 'cookie-name');
   assert_equals(cookie.value, 'cookie-value');
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { path: currentDirectory });
+    await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
   });
 }, 'cookieStore.set with path set to the current directory');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentPath = currentUrl.pathname;
   const currentDirectory =
       currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
   const subDirectory = currentDirectory + "subdir/";
-  await cookieStore.delete('cookie-name', { path: currentDirectory });
-  await cookieStore.delete('cookie-name', { path: subDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: currentDirectory });
+  await cookieStore.delete({ name: 'cookie-name', path: subDirectory });
 
   await cookieStore.set(
       'cookie-name', 'cookie-value', { path: subDirectory });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie, null);
 
   await async_cleanup(async () => {
-    await cookieStore.delete('cookie-name', { path: subDirectory });
+    await cookieStore.delete({ name: 'cookie-name', path: subDirectory });
   });
 }, 'cookieStore.set with path set to a subdirectory of the current directory');
 
 promise_test(async testCase => {
   await cookieStore.delete('cookie-name');
 
   await cookieStore.set('cookie-name', 'cookie-old-value');
   await cookieStore.set('cookie-name', 'cookie-new-value', { path: '/' });
 
   const cookies = await cookieStore.getAll('cookie-name');
   assert_equals(cookies.length, 1);
   assert_equals(cookies[0].name, 'cookie-name');
   assert_equals(cookies[0].value, 'cookie-new-value');
 
+  await async_cleanup(async () => {
+    await cookieStore.delete('cookie-name');
+    await cookieStore.delete({ name: 'cookie-name',  path: '/' });
+  });
+}, 'cookieStore.set default path is /');
+
+promise_test(async testCase => {
+  await cookieStore.set('cookie-name', 'old-cookie-value');
+
+  const cookie_attributes = await cookieStore.get('cookie-name');
+  assert_equals(cookie_attributes.name, 'cookie-name');
+  assert_equals(cookie_attributes.value, 'old-cookie-value');
+
+  cookie_attributes.value = 'new-cookie-value';
+  await cookieStore.set(cookie_attributes);
+  const cookie = await cookieStore.get('cookie-name');
+  assert_equals(cookie.name, 'cookie-name');
+  assert_equals(cookie.value, 'new-cookie-value');
+
   await async_cleanup(() => cookieStore.delete('cookie-name'));
-  await async_cleanup(() => cookieStore.delete('cookie-name', { path: '/' }));
-}, 'cookieStore.set default path is /');
+}, 'cookieStore.set with get result');
--- a/testing/web-platform/tests/interfaces/cookie-store.idl
+++ b/testing/web-platform/tests/interfaces/cookie-store.idl
@@ -2,23 +2,23 @@
 
 enum CookieSameSite {
   "strict",
   "lax",
   "unrestricted"
 };
 
 dictionary CookieListItem {
-  USVString name;
+  required USVString name;
   USVString value;
-  USVString? domain;
-  USVString path;
-  DOMTimeStamp? expires;
-  boolean secure;
-  CookieSameSite sameSite;
+  USVString? domain = null;
+  USVString path = "/";
+  DOMTimeStamp? expires = null;
+  boolean secure = true;
+  CookieSameSite sameSite = "strict";
 };
 
 typedef sequence<CookieListItem> CookieList;
 
 dictionary CookieChangeEventInit : EventInit {
   CookieList changed;
   CookieList deleted;
 };
@@ -45,48 +45,59 @@ dictionary ExtendableCookieChangeEventIn
   readonly attribute CookieList deleted;
 };
 
 enum CookieMatchType {
   "equals",
   "starts-with"
 };
 
+dictionary CookieStoreDeleteOptions {
+  required USVString name;
+  USVString? domain = null;
+  USVString path = "/";
+  boolean secure = true;
+  CookieSameSite sameSite = "strict";
+};
+
 dictionary CookieStoreGetOptions {
   USVString name;
   USVString url;
   CookieMatchType matchType = "equals";
 };
 
 dictionary CookieStoreSetOptions {
-  USVString name;
-  USVString value;
   DOMTimeStamp? expires = null;
-  USVString domain;
+  USVString? domain = null;
   USVString path = "/";
   boolean secure = true;
   boolean httpOnly = false;
   CookieSameSite sameSite = "strict";
 };
 
+dictionary CookieStoreSetExtraOptions : CookieStoreSetOptions {
+  required USVString name;
+  required USVString value;
+};
+
 [
   Exposed=(ServiceWorker,Window),
   SecureContext
 ] interface CookieStore : EventTarget {
-  Promise<CookieList?> getAll(USVString name, optional CookieStoreGetOptions options);
-  Promise<CookieList?> getAll(optional CookieStoreGetOptions options);
-
-  Promise<CookieListItem?> get(USVString name, optional CookieStoreGetOptions options);
+  Promise<CookieListItem?> get(USVString name);
   Promise<CookieListItem?> get(optional CookieStoreGetOptions options);
 
-  Promise<void> set(USVString name, USVString value, optional CookieStoreSetOptions options);
-  Promise<void> set(CookieStoreSetOptions options);
+  Promise<CookieList> getAll(USVString name);
+  Promise<CookieList> getAll(optional CookieStoreGetOptions options);
 
-  Promise<void> delete(USVString name, optional CookieStoreSetOptions options);
-  Promise<void> delete(CookieStoreSetOptions options);
+  Promise<void> set(USVString name, USVString value, optional CookieStoreSetOptions options);
+  Promise<void> set(CookieStoreSetExtraOptions options);
+
+  Promise<void> delete(USVString name);
+  Promise<void> delete(CookieStoreDeleteOptions options);
 
   [Exposed=ServiceWorker] Promise<void> subscribeToChanges(sequence<CookieStoreGetOptions> subscriptions);
 
   [Exposed=ServiceWorker] Promise<sequence<CookieStoreGetOptions>> getChangeSubscriptions();
 
   [Exposed=Window] attribute EventHandler onchange;
 };