Commit bc68a32a authored by Ayu Ishii's avatar Ayu Ishii Committed by Commit Bot

CookieStore: Replace old Origin Trial flag

This change removes the old "CookieStore" flag and adds 2 new flags
"CookieStoreDocument" and "CookieStoreWorker". The APIs are divided
as follows.

CookieStoreDocument:
-'CookieStore': ['get', 'getAll', 'set', 'delete', 'onchange']
-'CookieChangeEvent': ['changed', 'deleted']

CookieStoreWorker:
-'ServiceWorkerRegistration': ['cookies']
-'CookieStoreManager': ['getSubscriptions', 'subscribe', 'unsubscribe']


Change-Id: I8dd3fd8419576a70aae3cf5012d96fb7f8afb2ce
Bug: 1044245
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008588Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734705}
parent e4a97e0e
...@@ -174,7 +174,7 @@ public class CookieManagerTest { ...@@ -174,7 +174,7 @@ public class CookieManagerTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"AndroidWebView", "Privacy"}) @Feature({"AndroidWebView", "Privacy"})
@CommandLineFlags.Add({"enable-blink-features=CookieStore"}) @CommandLineFlags.Add({"enable-blink-features=CookieStoreDocument"})
// TODO(https://crbug.com/968649) Remove switch when CookieStore launched. // TODO(https://crbug.com/968649) Remove switch when CookieStore launched.
public void testAcceptCookie_falseWontSetCookies() throws Throwable { public void testAcceptCookie_falseWontSetCookies() throws Throwable {
testAcceptCookieHelper(false, "-disabled"); testAcceptCookieHelper(false, "-disabled");
...@@ -183,7 +183,7 @@ public class CookieManagerTest { ...@@ -183,7 +183,7 @@ public class CookieManagerTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"AndroidWebView", "Privacy"}) @Feature({"AndroidWebView", "Privacy"})
@CommandLineFlags.Add({"enable-blink-features=CookieStore"}) @CommandLineFlags.Add({"enable-blink-features=CookieStoreDocument"})
// TODO(https://crbug.com/968649) Remove switch when CookieStore launched. // TODO(https://crbug.com/968649) Remove switch when CookieStore launched.
public void testAcceptCookie_trueWillSetCookies() throws Throwable { public void testAcceptCookie_trueWillSetCookies() throws Throwable {
testAcceptCookieHelper(true, "-enabled"); testAcceptCookieHelper(true, "-enabled");
...@@ -657,7 +657,7 @@ public class CookieManagerTest { ...@@ -657,7 +657,7 @@ public class CookieManagerTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"AndroidWebView", "Privacy"}) @Feature({"AndroidWebView", "Privacy"})
@CommandLineFlags.Add({"enable-blink-features=CookieStore"}) @CommandLineFlags.Add({"enable-blink-features=CookieStoreDocument"})
// TODO(https://crbug.com/968649) Remove switch when CookieStore launched. // TODO(https://crbug.com/968649) Remove switch when CookieStore launched.
public void testCookieStoreListener() throws Throwable { public void testCookieStoreListener() throws Throwable {
TestWebServer webServer = TestWebServer.startSsl(); TestWebServer webServer = TestWebServer.startSsl();
...@@ -896,7 +896,7 @@ public class CookieManagerTest { ...@@ -896,7 +896,7 @@ public class CookieManagerTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"AndroidWebView", "Privacy"}) @Feature({"AndroidWebView", "Privacy"})
@CommandLineFlags.Add({"enable-blink-features=CookieStore"}) @CommandLineFlags.Add({"enable-blink-features=CookieStoreDocument"})
// TODO(https://crbug.com/968649) Remove switch when CookieStore launched. // TODO(https://crbug.com/968649) Remove switch when CookieStore launched.
public void testThirdPartyJavascriptCookie() throws Throwable { public void testThirdPartyJavascriptCookie() throws Throwable {
// Using SSL server here since CookieStore API requires a secure schema. // Using SSL server here since CookieStore API requires a secure schema.
...@@ -924,7 +924,7 @@ public class CookieManagerTest { ...@@ -924,7 +924,7 @@ public class CookieManagerTest {
@Test @Test
@MediumTest @MediumTest
@Feature({"AndroidWebView", "Privacy"}) @Feature({"AndroidWebView", "Privacy"})
@CommandLineFlags.Add({"enable-blink-features=CookieStore"}) @CommandLineFlags.Add({"enable-blink-features=CookieStoreDocument"})
// TODO(https://crbug.com/968649) Remove switch when CookieStore launched. // TODO(https://crbug.com/968649) Remove switch when CookieStore launched.
public void testThirdPartyCookiesArePerWebview() throws Throwable { public void testThirdPartyCookiesArePerWebview() throws Throwable {
// Using SSL server here since CookieStore API requires a secure schema. // Using SSL server here since CookieStore API requires a secure schema.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
[ [
Exposed=Window, Exposed=Window,
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreDocument,
SecureContext SecureContext
] interface CookieChangeEvent : Event { ] interface CookieChangeEvent : Event {
constructor(DOMString type, optional CookieChangeEventInit eventInitDict = {}); constructor(DOMString type, optional CookieChangeEventInit eventInitDict = {});
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
[ [
Exposed=(ServiceWorker,Window), Exposed=(ServiceWorker,Window),
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreDocument,
SecureContext SecureContext
] interface CookieStore : EventTarget { ] interface CookieStore : EventTarget {
// https://wicg.github.io/cookie-store/explainer.html#the-query-api // https://wicg.github.io/cookie-store/explainer.html#the-query-api
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
[ [
Exposed=(ServiceWorker,Window), Exposed=(ServiceWorker,Window),
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreWorker,
SecureContext SecureContext
] interface CookieStoreManager { ] interface CookieStoreManager {
[CallWith=ScriptState, MeasureAs=CookieStoreAPI, RaisesException] [CallWith=ScriptState, MeasureAs=CookieStoreAPI, RaisesException]
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
[ [
Exposed=ServiceWorker, Exposed=ServiceWorker,
RuntimeEnabled=CookieStore RuntimeEnabled=CookieStoreWorker
] interface ExtendableCookieChangeEvent : ExtendableEvent { ] interface ExtendableCookieChangeEvent : ExtendableEvent {
constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict = {}); constructor(DOMString type, optional ExtendableCookieChangeEventInit eventInitDict = {});
[MeasureAs=CookieStoreAPI] readonly attribute CookieList changed; [MeasureAs=CookieStoreAPI] readonly attribute CookieList changed;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md // https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md
[ [
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreWorker,
ImplementedAs=GlobalCookieStore ImplementedAs=GlobalCookieStore
] partial interface ServiceWorkerGlobalScope { ] partial interface ServiceWorkerGlobalScope {
[Replaceable, SameObject] readonly attribute CookieStore cookieStore; [Replaceable, SameObject] readonly attribute CookieStore cookieStore;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
[ [
Exposed=(ServiceWorker,Window), Exposed=(ServiceWorker,Window),
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreWorker,
ImplementedAs=ServiceWorkerRegistrationCookies ImplementedAs=ServiceWorkerRegistrationCookies
] partial interface ServiceWorkerRegistration { ] partial interface ServiceWorkerRegistration {
readonly attribute CookieStoreManager cookies; readonly attribute CookieStoreManager cookies;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md // https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md
[ [
RuntimeEnabled=CookieStore, RuntimeEnabled=CookieStoreDocument,
ImplementedAs=GlobalCookieStore, ImplementedAs=GlobalCookieStore,
SecureContext SecureContext
] partial interface Window { ] partial interface Window {
......
...@@ -374,8 +374,11 @@ ...@@ -374,8 +374,11 @@
status: "experimental", status: "experimental",
}, },
{ {
name: "CookieStore", name: "CookieStoreDocument",
origin_trial_feature_name: "CookieStore", status: "experimental",
},
{
name: "CookieStoreWorker",
status: "experimental", status: "experimental",
}, },
{ {
......
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Generate token with the command:
generate_token.py http://127.0.0.1:8000 CookieStore --expire-timestamp=2000000000
-- -->
<meta http-equiv="origin-trial" content="AuCNc4F6ez8bdiKV6reoNKgzu2afmtUl5FgKkP6jdrbbCqVh8BfddejNqciWMz+V+oZXxJdW1LU5nQuC0Ij2GQkAAABTeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQ29va2llU3RvcmUiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=" />
<title>Cookie Store API - interfaces exposed by origin trial</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/origin-trials-helper.js"></script>
<script src="/serviceworker/resources/test-helpers.js"></script>
<script>
test(t => {
OriginTrialsHelper.check_properties_exist(this, {
'CookieStore': ['get', 'getAll', 'set', 'delete', 'onchange'],
'CookieStoreManager': ['getSubscriptions', 'subscribe', 'unsubscribe'],
'CookieChangeEvent': ['changed', 'deleted'],
'ServiceWorkerRegistration': ['cookies'],
});
}, 'Cookie Store API interfaces and properties in Origin-Trial enabled document.');
test(t => {
assert_true('cookieStore' in self, 'cookieStore property exists on global scope');
}, 'Cookie Store API entry point in Origin-Trial enabled document.');
// Only run "disabled" tests if the feature is not enabled via runtime flags.
if (!self.internals.runtimeFlags.cookieStoreEnabled) {
service_worker_test('resources/cookiestore-origin-trial-interfaces-serviceworker-disabled.js');
}
service_worker_test('resources/cookiestore-origin-trial-interfaces-serviceworker-enabled.php');
</script>
importScripts('/resources/testharness.js',
'/resources/origin-trials-helper.js');
test(t => {
OriginTrialsHelper.check_interfaces_missing(
self,
['CookieStore', 'CookieStoreManager', 'ExtendableCookieChangeEvent']);
}, 'Cookie Store API interfaces in Origin-Trial disabled worker.');
test(t => {
assert_false('cookieStore' in self,
'cookieStore property does not exist on global scope');
assert_false('oncookiechange' in self,
'oncookiechange property does not exist on global scope');
assert_false('cookies' in self.registration,
'cookies property does not exist on ServiceWorkerRegistration');
}, 'Cookie Store API entry points in Origin-Trial disabled worker.');
done();
<?php
// Generate token with the command:
// generate_token.py http://127.0.0.1:8000 CookieStore --expire-timestamp=2000000000
header("Origin-Trial: AuCNc4F6ez8bdiKV6reoNKgzu2afmtUl5FgKkP6jdrbbCqVh8BfddejNqciWMz+V+oZXxJdW1LU5nQuC0Ij2GQkAAABTeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQ29va2llU3RvcmUiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=");
header('Content-Type: application/javascript');
?>
importScripts('/resources/testharness.js',
'/resources/origin-trials-helper.js');
test(t => {
OriginTrialsHelper.check_properties_exist(this, {
'CookieStore': ['get', 'getAll', 'set', 'delete'],
'CookieStoreManager': ['getSubscriptions', 'subscribe', 'unsubscribe'],
'ExtendableCookieChangeEvent': ['changed', 'deleted'],
'ServiceWorkerRegistration': ['cookies'],
});
}, 'Cookie Store API interfaces and properties in Origin-Trial enabled serviceworker.');
test(t => {
assert_true('cookieStore' in self, 'cookieStore property exists on global');
assert_true('oncookiechange' in self,
'oncookiechange property exists on global');
}, 'Cookie Store API entry points in Origin-Trial enabled serviceworker.');
done();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment