Skip to content

Commit

Permalink
CookieStore: Add domain validation wpt
Browse files Browse the repository at this point in the history
This change adds tests for domain validation in wpt.

Change-Id: Id8c74374d23bd72787ecc40919070b98684e163c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2149699
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760748}
  • Loading branch information
ayuishii authored and chromium-wpt-export-bot committed Apr 21, 2020
1 parent 17b3f85 commit 643c701
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cookie-store/cookieStore_set_arguments.tentative.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ promise_test(async testCase => {
assert_equals(cookie, null);
}, '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 promise_rejects_js(testCase, TypeError, cookieStore.set(
'cookie-name', 'cookie-value', { domain: `.${currentDomain}` }));
}, 'cookieStore.set domain starts with "."');

promise_test(async testCase => {
await promise_rejects_js(testCase, TypeError, cookieStore.set(
'cookie-name', 'cookie-value', { domain: 'example.com' }));
}, 'cookieStore.set with domain that is not equal current host');

promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
Expand Down

0 comments on commit 643c701

Please sign in to comment.