Bug 1635813 [wpt PR 23417] - CookieStore: Add domain validation wpt for cookieStore.delete, a=testonly
authorAyu Ishii <ayui@chromium.org>
Wed, 13 May 2020 09:42:40 +0000
changeset 531091 2dfaa81e18b5deba93b214278daff69d8fa8f7c1
parent 531090 51c041f58f8c3482f1a1fd2e1e025c53b9acc2d8
child 531092 176a81670e50110427d1fe971b9f029658a55d49
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1635813, 23417, 2149699, 729800, 2183193, 765866
milestone78.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 1635813 [wpt PR 23417] - CookieStore: Add domain validation wpt for cookieStore.delete, a=testonly Automatic update from web-platform-tests CookieStore: Add domain validation wpt for cookieStore.delete This change adds tests for domain validation in wpt for cookieStore.delete. Addresses comment: https://chromium-review.googlesource.com/c/chromium/src/+/2149699/2#message-e82e06fcb5fdc9ffb82e425114b2fc2adbf7d36c Bug: 729800 Change-Id: I3c12a5f6e2f8504d1b4c327120ec17af9be060b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2183193 Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Victor Costan <pwnall@chromium.org> Cr-Commit-Position: refs/heads/master@{#765866} -- wpt-commits: cf6daed503ac85776bbfe2299c18f569d29e5c0f wpt-pr: 23417
testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.any.js
--- a/testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.any.js
+++ b/testing/web-platform/tests/cookie-store/cookieStore_delete_arguments.tentative.https.any.js
@@ -31,16 +31,29 @@ promise_test(async testCase => {
   await cookieStore.delete('cookie-name', { name: 'wrong-cookie-name' });
   const cookie = await cookieStore.get('cookie-name');
   assert_equals(cookie, null);
 }, 'cookieStore.delete with name in both positional arguments and options');
 
 promise_test(async testCase => {
   const currentUrl = new URL(self.location.href);
   const currentDomain = currentUrl.hostname;
+
+  await promise_rejects_js(testCase, TypeError, cookieStore.set(
+      'cookie-name', 'cookie-value', { domain: `.${currentDomain}` }));
+}, 'cookieStore.delete domain starts with "."');
+
+promise_test(async testCase => {
+  await promise_rejects_js(testCase, TypeError, cookieStore.set(
+      'cookie-name', 'cookie-value', { domain: 'example.com' }));
+}, 'cookieStore.delete with domain that is not equal current host');
+
+promise_test(async testCase => {
+  const currentUrl = new URL(self.location.href);
+  const currentDomain = currentUrl.hostname;
   await cookieStore.set(
       'cookie-name', 'cookie-value', { domain: currentDomain });
   testCase.add_cleanup(async () => {
     await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   });
 
   await cookieStore.delete({ name: 'cookie-name', domain: currentDomain });
   const cookie = await cookieStore.get('cookie-name');