Diff
Modified: trunk/LayoutTests/ChangeLog (253081 => 253082)
--- trunk/LayoutTests/ChangeLog 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/LayoutTests/ChangeLog 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1,3 +1,23 @@
+2019-12-03 John Wilander <[email protected]>
+
+ Resource Load Statistics (experimental): Delete non-cookie website data after 7 days of no user interaction
+ https://bugs.webkit.org/show_bug.cgi?id=204779
+ <rdar://problem/57578989>
+
+ Reviewed by Alex Christensen.
+
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html:
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
+ Fixed some minor stuff in these two test cases to make any failures more clear.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database.html: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database.html: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html: Added.
+
2019-12-03 Truitt Savell <[email protected]>
6 fast/text/emoji-gender are expected to fail on Catalina 10.15.1 and newer
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html (253081 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -127,7 +127,7 @@
if (++intervalCounterIDB >= maxIntervals) {
clearInterval(checkIDBIntervalID);
- addOutput("Before deletion: IDB entry does not exist.");
+ addOutput("After deletion: IDB entry checks exhausted.");
semaphoreIDBCheck = false;
checkIDBCallback();
} else {
@@ -166,6 +166,8 @@
checkLocalStorageIntervalID = setInterval(function() {
if (++intervalCounterLocalStorage >= maxIntervals) {
clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
checkLocalStorageCallback();
} else if (testRunner.isStatisticsHasLocalStorage(destinationOrigin)) {
clearInterval(checkLocalStorageIntervalID);
@@ -179,6 +181,8 @@
checkLocalStorageIntervalID = setInterval(function() {
if (++intervalCounterLocalStorage >= maxIntervals) {
clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
checkLocalStorageCallback();
} else if (!testRunner.isStatisticsHasLocalStorage(destinationOrigin)) {
clearInterval(checkLocalStorageIntervalID);
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html (253081 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -126,7 +126,7 @@
if (++intervalCounterIDB >= maxIntervals) {
clearInterval(checkIDBIntervalID);
- addOutput("Before deletion: IDB entry does not exist.");
+ addOutput("After deletion: IDB entry checks exhausted.");
semaphoreIDBCheck = false;
checkIDBCallback();
} else {
@@ -165,6 +165,8 @@
checkLocalStorageIntervalID = setInterval(function() {
if (++intervalCounterLocalStorage >= maxIntervals) {
clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
checkLocalStorageCallback();
} else if (testRunner.isStatisticsHasLocalStorage(destinationOrigin)) {
clearInterval(checkLocalStorageIntervalID);
@@ -178,6 +180,8 @@
checkLocalStorageIntervalID = setInterval(function() {
if (++intervalCounterLocalStorage >= maxIntervals) {
clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
checkLocalStorageCallback();
} else if (!testRunner.isStatisticsHasLocalStorage(destinationOrigin)) {
clearInterval(checkLocalStorageIntervalID);
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database-expected.txt (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database-expected.txt 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,15 @@
+Check that non-cookie website data does not get removed for sites with user interaction.
+
+Before deletion: Client-side cookie exists.
+Before deletion: HttpOnly cookie exists.
+Before deletion: Regular server-side cookie exists.
+Before deletion: LocalStorage entry does exist.
+Before deletion: IDB entry does exist.
+
+After deletion: HttpOnly cookie exists.
+After deletion: Client-side cookie exists.
+After deletion: Regular server-side cookie exists.
+After deletion: LocalStorage entry does exist.
+After deletion: IDB entry does exist.
+
+
Copied: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database.html (from rev 253081, trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html) (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,254 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<div id="description">Check that non-cookie website data does not get removed for sites with user interaction.</div>
+<br>
+<div id="output"></div>
+<br>
+<script>
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ testRunner.setUseITPDatabase(true);
+
+ const httpOnlyCookieName = "http-only-cookie";
+ const serverSideCookieName = "server-side-cookie";
+ const clientSideCookieName = "client-side-cookie";
+
+ function sortStringArray(a, b) {
+ a = a.toLowerCase();
+ b = b.toLowerCase();
+
+ return a > b ? 1 : b > a ? -1 : 0;
+ }
+
+ function addLinebreakToOutput() {
+ let element = document.createElement("br");
+ output.appendChild(element);
+ }
+
+ function addOutput(message) {
+ let element = document.createElement("div");
+ element.innerText = message;
+ output.appendChild(element);
+ }
+
+ function checkCookies(isAfterDeletion) {
+ let unsortedTestPassedMessages = [];
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed((isAfterDeletion ? "After" : "Before") + " script-accessible deletion: No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case httpOnlyCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: " + (isAfterDeletion ? " " : "") + "HttpOnly cookie exists.");
+ break;
+ case serverSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Regular server-side cookie exists.");
+ break;
+ case clientSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Client-side cookie exists.");
+ break;
+ }
+ }
+ let sortedTestPassedMessages = unsortedTestPassedMessages.sort(sortStringArray);
+ for (let testPassedMessage of sortedTestPassedMessages) {
+ addOutput(testPassedMessage);
+ }
+ }
+
+ const dbName = "TestDatabase";
+
+ function createIDBDataStore(callback) {
+ let request = indexedDB.open(dbName);
+ request._onerror_ = function() {
+ addOutput("Couldn't create indexedDB.");
+ finishTest();
+ };
+ request._onupgradeneeded_ = function(event) {
+ let db = event.target.result;
+ let objStore = db.createObjectStore("test", {autoIncrement: true});
+ objStore.add("value");
+ callback();
+ }
+ }
+
+ const maxIntervals = 20;
+
+ let intervalCounterIDB;
+ let checkIDBCallback;
+ let checkIDBIntervalID;
+ let semaphoreIDBCheck = false;
+ function checkIDBDataStoreExists(isAfterDeletion, callback) {
+ let request;
+ intervalCounterIDB = 0;
+ checkIDBCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is a IDB.
+ checkIDBIntervalID = setInterval(function() {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ request._onsuccess_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ }
+ }, 200);
+ } else {
+ // Check until there is no IDB.
+ checkIDBIntervalID = setInterval(function () {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onsuccess_ = function () {
+ // Let the next interval check again because deletion might be delayed.
+ semaphoreIDBCheck = false;
+ };
+ }
+ }, 200);
+ }
+ }
+
+ let intervalCounterLocalStorage;
+ let checkLocalStorageCallback;
+ let checkLocalStorageIntervalID;
+ const localStorageName = "test";
+ const localStorageValue = "value";
+ function checkLocalStorageExists(isAfterDeletion, callback) {
+ intervalCounterLocalStorage = 0;
+ checkLocalStorageCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ } else {
+ // Check until there is no LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (!testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ }
+ }
+
+ async function writeWebsiteDataAndContinue() {
+ // Write cookies.
+ await fetch("/cookies/resources/set-http-only-cookie.php?cookieName=" + httpOnlyCookieName, { credentials: "same-origin" });
+ await fetch("/cookies/resources/setCookies.cgi", { headers: { "Set-Cookie": serverSideCookieName + "=1; path=/;" }, credentials: "same-origin" });
+ document.cookie = clientSideCookieName + "=1";
+
+ checkCookies(false);
+
+ // Write LocalStorage
+ localStorage.setItem(localStorageName, localStorageValue);
+ checkLocalStorageExists(false, function() {
+
+ // Write IndexedDB.
+ createIDBDataStore(function () {
+ checkIDBDataStoreExists(false, function() {
+ addLinebreakToOutput();
+ processWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+
+ function processWebsiteDataAndContinue() {
+ testRunner.installStatisticsDidScanDataRecordsCallback(checkWebsiteDataAndContinue);
+ testRunner.statisticsProcessStatisticsAndDataRecords();
+ }
+
+ function checkWebsiteDataAndContinue() {
+ checkCookies(true);
+ checkLocalStorageExists(true, function () {
+ checkIDBDataStoreExists(true, finishTest);
+ });
+ }
+
+ function finishTest() {
+ resetCookies();
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
+ setEnableFeature(false, function() {
+ testRunner.notifyDone();
+ });
+ });
+ }
+
+ const originUnderTest = "http://127.0.0.1:8000";
+ function runTest() {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(true, function() {
+ testRunner.setStatisticsHasHadUserInteraction(originUnderTest, true, function() {
+ if (!testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
+ addOutput("FAIL: " + originUnderTest + " did not get logged for user interaction.");
+ writeWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-expected.txt (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-expected.txt 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,15 @@
+Check that non-cookie website data does not get removed for sites with user interaction.
+
+Before deletion: Client-side cookie exists.
+Before deletion: HttpOnly cookie exists.
+Before deletion: Regular server-side cookie exists.
+Before deletion: LocalStorage entry does exist.
+Before deletion: IDB entry does exist.
+
+After deletion: HttpOnly cookie exists.
+After deletion: Client-side cookie exists.
+After deletion: Regular server-side cookie exists.
+After deletion: LocalStorage entry does exist.
+After deletion: IDB entry checks does exist.
+
+
Copied: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html (from rev 253081, trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html) (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,253 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<div id="description">Check that non-cookie website data does not get removed for sites with user interaction.</div>
+<br>
+<div id="output"></div>
+<br>
+<script>
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+
+ const httpOnlyCookieName = "http-only-cookie";
+ const serverSideCookieName = "server-side-cookie";
+ const clientSideCookieName = "client-side-cookie";
+
+ function sortStringArray(a, b) {
+ a = a.toLowerCase();
+ b = b.toLowerCase();
+
+ return a > b ? 1 : b > a ? -1 : 0;
+ }
+
+ function addLinebreakToOutput() {
+ let element = document.createElement("br");
+ output.appendChild(element);
+ }
+
+ function addOutput(message) {
+ let element = document.createElement("div");
+ element.innerText = message;
+ output.appendChild(element);
+ }
+
+ function checkCookies(isAfterDeletion) {
+ let unsortedTestPassedMessages = [];
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed((isAfterDeletion ? "After" : "Before") + " script-accessible deletion: No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case httpOnlyCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: " + (isAfterDeletion ? " " : "") + "HttpOnly cookie exists.");
+ break;
+ case serverSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Regular server-side cookie exists.");
+ break;
+ case clientSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Client-side cookie exists.");
+ break;
+ }
+ }
+ let sortedTestPassedMessages = unsortedTestPassedMessages.sort(sortStringArray);
+ for (let testPassedMessage of sortedTestPassedMessages) {
+ addOutput(testPassedMessage);
+ }
+ }
+
+ const dbName = "TestDatabase";
+
+ function createIDBDataStore(callback) {
+ let request = indexedDB.open(dbName);
+ request._onerror_ = function() {
+ addOutput("Couldn't create indexedDB.");
+ finishTest();
+ };
+ request._onupgradeneeded_ = function(event) {
+ let db = event.target.result;
+ let objStore = db.createObjectStore("test", {autoIncrement: true});
+ objStore.add("value");
+ callback();
+ }
+ }
+
+ const maxIntervals = 20;
+
+ let intervalCounterIDB;
+ let checkIDBCallback;
+ let checkIDBIntervalID;
+ let semaphoreIDBCheck = false;
+ function checkIDBDataStoreExists(isAfterDeletion, callback) {
+ let request;
+ intervalCounterIDB = 0;
+ checkIDBCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is a IDB.
+ checkIDBIntervalID = setInterval(function() {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ request._onsuccess_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ }
+ }, 200);
+ } else {
+ // Check until there is no IDB.
+ checkIDBIntervalID = setInterval(function () {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry checks does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onsuccess_ = function () {
+ // Let the next interval check again because deletion might be delayed.
+ semaphoreIDBCheck = false;
+ };
+ }
+ }, 200);
+ }
+ }
+
+ let intervalCounterLocalStorage;
+ let checkLocalStorageCallback;
+ let checkLocalStorageIntervalID;
+ const localStorageName = "test";
+ const localStorageValue = "value";
+ function checkLocalStorageExists(isAfterDeletion, callback) {
+ intervalCounterLocalStorage = 0;
+ checkLocalStorageCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ } else {
+ // Check until there is no LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (!testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ }
+ }
+
+ async function writeWebsiteDataAndContinue() {
+ // Write cookies.
+ await fetch("/cookies/resources/set-http-only-cookie.php?cookieName=" + httpOnlyCookieName, { credentials: "same-origin" });
+ await fetch("/cookies/resources/setCookies.cgi", { headers: { "Set-Cookie": serverSideCookieName + "=1; path=/;" }, credentials: "same-origin" });
+ document.cookie = clientSideCookieName + "=1";
+
+ checkCookies(false);
+
+ // Write LocalStorage
+ localStorage.setItem(localStorageName, localStorageValue);
+ checkLocalStorageExists(false, function() {
+
+ // Write IndexedDB.
+ createIDBDataStore(function () {
+ checkIDBDataStoreExists(false, function() {
+ addLinebreakToOutput();
+ processWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+
+ function processWebsiteDataAndContinue() {
+ testRunner.installStatisticsDidScanDataRecordsCallback(checkWebsiteDataAndContinue);
+ testRunner.statisticsProcessStatisticsAndDataRecords();
+ }
+
+ function checkWebsiteDataAndContinue() {
+ checkCookies(true);
+ checkLocalStorageExists(true, function () {
+ checkIDBDataStoreExists(true, finishTest);
+ });
+ }
+
+ function finishTest() {
+ resetCookies();
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
+ setEnableFeature(false, function() {
+ testRunner.notifyDone();
+ });
+ });
+ }
+
+ const originUnderTest = "http://127.0.0.1:8000";
+ function runTest() {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(true, function() {
+ testRunner.setStatisticsHasHadUserInteraction(originUnderTest, true, function() {
+ if (!testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
+ addOutput("FAIL: " + originUnderTest + " did not get logged for user interaction.");
+ writeWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database-expected.txt (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database-expected.txt 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,15 @@
+Check that non-cookie website data gets removed after a period of no user interaction.
+
+Before deletion: Client-side cookie exists.
+Before deletion: HttpOnly cookie exists.
+Before deletion: Regular server-side cookie exists.
+Before deletion: LocalStorage entry does exist.
+Before deletion: IDB entry does exist.
+
+After deletion: HttpOnly cookie exists.
+After deletion: Client-side cookie exists.
+After deletion: Regular server-side cookie exists.
+After deletion: LocalStorage entry does not exist.
+After deletion: IDB entry does not exist.
+
+
Copied: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database.html (from rev 253081, trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html) (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,254 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<div id="description">Check that non-cookie website data gets removed after a period of no user interaction.</div>
+<br>
+<div id="output"></div>
+<br>
+<script>
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ testRunner.setUseITPDatabase(true);
+
+ const httpOnlyCookieName = "http-only-cookie";
+ const serverSideCookieName = "server-side-cookie";
+ const clientSideCookieName = "client-side-cookie";
+
+ function sortStringArray(a, b) {
+ a = a.toLowerCase();
+ b = b.toLowerCase();
+
+ return a > b ? 1 : b > a ? -1 : 0;
+ }
+
+ function addLinebreakToOutput() {
+ let element = document.createElement("br");
+ output.appendChild(element);
+ }
+
+ function addOutput(message) {
+ let element = document.createElement("div");
+ element.innerText = message;
+ output.appendChild(element);
+ }
+
+ function checkCookies(isAfterDeletion) {
+ let unsortedTestPassedMessages = [];
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed((isAfterDeletion ? "After" : "Before") + " script-accessible deletion: No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case httpOnlyCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: " + (isAfterDeletion ? " " : "") + "HttpOnly cookie exists.");
+ break;
+ case serverSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Regular server-side cookie exists.");
+ break;
+ case clientSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Client-side cookie exists.");
+ break;
+ }
+ }
+ let sortedTestPassedMessages = unsortedTestPassedMessages.sort(sortStringArray);
+ for (let testPassedMessage of sortedTestPassedMessages) {
+ addOutput(testPassedMessage);
+ }
+ }
+
+ const dbName = "TestDatabase";
+
+ function createIDBDataStore(callback) {
+ let request = indexedDB.open(dbName);
+ request._onerror_ = function() {
+ addOutput("Couldn't create indexedDB.");
+ finishTest();
+ };
+ request._onupgradeneeded_ = function(event) {
+ let db = event.target.result;
+ let objStore = db.createObjectStore("test", {autoIncrement: true});
+ objStore.add("value");
+ callback();
+ }
+ }
+
+ const maxIntervals = 20;
+
+ let intervalCounterIDB;
+ let checkIDBCallback;
+ let checkIDBIntervalID;
+ let semaphoreIDBCheck = false;
+ function checkIDBDataStoreExists(isAfterDeletion, callback) {
+ let request;
+ intervalCounterIDB = 0;
+ checkIDBCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is a IDB.
+ checkIDBIntervalID = setInterval(function() {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ request._onsuccess_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ }
+ }, 200);
+ } else {
+ // Check until there is no IDB.
+ checkIDBIntervalID = setInterval(function () {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry checks exhausted.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ request._onsuccess_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ }
+ }, 200);
+ }
+ }
+
+ let intervalCounterLocalStorage;
+ let checkLocalStorageCallback;
+ let checkLocalStorageIntervalID;
+ const localStorageName = "test";
+ const localStorageValue = "value";
+ function checkLocalStorageExists(isAfterDeletion, callback) {
+ intervalCounterLocalStorage = 0;
+ checkLocalStorageCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ } else {
+ // Check until there is no LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (!testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ }
+ }
+
+ async function writeWebsiteDataAndContinue() {
+ // Write cookies.
+ await fetch("/cookies/resources/set-http-only-cookie.php?cookieName=" + httpOnlyCookieName, { credentials: "same-origin" });
+ await fetch("/cookies/resources/setCookies.cgi", { headers: { "Set-Cookie": serverSideCookieName + "=1; path=/;" }, credentials: "same-origin" });
+ document.cookie = clientSideCookieName + "=1";
+
+ checkCookies(false);
+
+ // Write LocalStorage
+ localStorage.setItem(localStorageName, localStorageValue);
+ checkLocalStorageExists(false, function() {
+
+ // Write IndexedDB.
+ createIDBDataStore(function () {
+ checkIDBDataStoreExists(false, function() {
+ addLinebreakToOutput();
+ processWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+
+ function processWebsiteDataAndContinue() {
+ testRunner.installStatisticsDidScanDataRecordsCallback(checkWebsiteDataAndContinue);
+ testRunner.statisticsProcessStatisticsAndDataRecords();
+ }
+
+ function checkWebsiteDataAndContinue() {
+ checkCookies(true);
+ checkLocalStorageExists(true, function () {
+ checkIDBDataStoreExists(true, finishTest);
+ });
+ }
+
+ function finishTest() {
+ resetCookies();
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
+ setEnableFeature(false, function() {
+ testRunner.notifyDone();
+ });
+ });
+ }
+
+ const originUnderTest = "http://127.0.0.1:8000";
+ function runTest() {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(true, function() {
+ testRunner.setStatisticsHasHadUserInteraction(originUnderTest, false, function() {
+ if (testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
+ addOutput("FAIL: " + originUnderTest + " got logged for user interaction.");
+ writeWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-expected.txt (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-expected.txt 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,15 @@
+Check that non-cookie website data gets removed after a period of no user interaction.
+
+Before deletion: Client-side cookie exists.
+Before deletion: HttpOnly cookie exists.
+Before deletion: Regular server-side cookie exists.
+Before deletion: LocalStorage entry does exist.
+Before deletion: IDB entry does exist.
+
+After deletion: HttpOnly cookie exists.
+After deletion: Client-side cookie exists.
+After deletion: Regular server-side cookie exists.
+After deletion: LocalStorage entry does not exist.
+After deletion: IDB entry does not exist.
+
+
Copied: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html (from rev 253081, trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html) (0 => 253082)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html 2019-12-04 02:41:49 UTC (rev 253082)
@@ -0,0 +1,253 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<div id="description">Check that non-cookie website data gets removed after a period of no user interaction.</div>
+<br>
+<div id="output"></div>
+<br>
+<script>
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+
+ const httpOnlyCookieName = "http-only-cookie";
+ const serverSideCookieName = "server-side-cookie";
+ const clientSideCookieName = "client-side-cookie";
+
+ function sortStringArray(a, b) {
+ a = a.toLowerCase();
+ b = b.toLowerCase();
+
+ return a > b ? 1 : b > a ? -1 : 0;
+ }
+
+ function addLinebreakToOutput() {
+ let element = document.createElement("br");
+ output.appendChild(element);
+ }
+
+ function addOutput(message) {
+ let element = document.createElement("div");
+ element.innerText = message;
+ output.appendChild(element);
+ }
+
+ function checkCookies(isAfterDeletion) {
+ let unsortedTestPassedMessages = [];
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed((isAfterDeletion ? "After" : "Before") + " script-accessible deletion: No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case httpOnlyCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: " + (isAfterDeletion ? " " : "") + "HttpOnly cookie exists.");
+ break;
+ case serverSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Regular server-side cookie exists.");
+ break;
+ case clientSideCookieName:
+ unsortedTestPassedMessages.push((isAfterDeletion ? "After" : "Before") + " deletion: Client-side cookie exists.");
+ break;
+ }
+ }
+ let sortedTestPassedMessages = unsortedTestPassedMessages.sort(sortStringArray);
+ for (let testPassedMessage of sortedTestPassedMessages) {
+ addOutput(testPassedMessage);
+ }
+ }
+
+ const dbName = "TestDatabase";
+
+ function createIDBDataStore(callback) {
+ let request = indexedDB.open(dbName);
+ request._onerror_ = function() {
+ addOutput("Couldn't create indexedDB.");
+ finishTest();
+ };
+ request._onupgradeneeded_ = function(event) {
+ let db = event.target.result;
+ let objStore = db.createObjectStore("test", {autoIncrement: true});
+ objStore.add("value");
+ callback();
+ }
+ }
+
+ const maxIntervals = 20;
+
+ let intervalCounterIDB;
+ let checkIDBCallback;
+ let checkIDBIntervalID;
+ let semaphoreIDBCheck = false;
+ function checkIDBDataStoreExists(isAfterDeletion, callback) {
+ let request;
+ intervalCounterIDB = 0;
+ checkIDBCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is a IDB.
+ checkIDBIntervalID = setInterval(function() {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ request._onsuccess_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Before deletion: IDB entry does exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ }
+ }, 200);
+ } else {
+ // Check until there is no IDB.
+ checkIDBIntervalID = setInterval(function () {
+ if (semaphoreIDBCheck)
+ return;
+ semaphoreIDBCheck = true;
+
+ if (++intervalCounterIDB >= maxIntervals) {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry checks exhausted.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ } else {
+ request = indexedDB.open(dbName);
+ request._onerror_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("Couldn't open indexedDB.");
+ semaphoreIDBCheck = false;
+ finishTest();
+ };
+ request._onupgradeneeded_ = function () {
+ clearInterval(checkIDBIntervalID);
+ addOutput("After deletion: IDB entry does not exist.");
+ semaphoreIDBCheck = false;
+ checkIDBCallback();
+ };
+ request._onsuccess_ = function () {
+ // Let the next interval check again.
+ semaphoreIDBCheck = false;
+ };
+ }
+ }, 200);
+ }
+ }
+
+ let intervalCounterLocalStorage;
+ let checkLocalStorageCallback;
+ let checkLocalStorageIntervalID;
+ const localStorageName = "test";
+ const localStorageValue = "value";
+ function checkLocalStorageExists(isAfterDeletion, callback) {
+ intervalCounterLocalStorage = 0;
+ checkLocalStorageCallback = callback;
+ if (!isAfterDeletion) {
+ // Check until there is LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("Before deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ } else {
+ // Check until there is no LocalStorage.
+ checkLocalStorageIntervalID = setInterval(function() {
+ if (++intervalCounterLocalStorage >= maxIntervals) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ } else if (!testRunner.isStatisticsHasLocalStorage(originUnderTest)) {
+ clearInterval(checkLocalStorageIntervalID);
+ let value = localStorage.getItem(localStorageName);
+ addOutput("After deletion: LocalStorage entry " + (value === localStorageValue ? "does" : "does not") + " exist.");
+ checkLocalStorageCallback();
+ }
+ }, 100);
+ }
+ }
+
+ async function writeWebsiteDataAndContinue() {
+ // Write cookies.
+ await fetch("/cookies/resources/set-http-only-cookie.php?cookieName=" + httpOnlyCookieName, { credentials: "same-origin" });
+ await fetch("/cookies/resources/setCookies.cgi", { headers: { "Set-Cookie": serverSideCookieName + "=1; path=/;" }, credentials: "same-origin" });
+ document.cookie = clientSideCookieName + "=1";
+
+ checkCookies(false);
+
+ // Write LocalStorage
+ localStorage.setItem(localStorageName, localStorageValue);
+ checkLocalStorageExists(false, function() {
+
+ // Write IndexedDB.
+ createIDBDataStore(function () {
+ checkIDBDataStoreExists(false, function() {
+ addLinebreakToOutput();
+ processWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+
+ function processWebsiteDataAndContinue() {
+ testRunner.installStatisticsDidScanDataRecordsCallback(checkWebsiteDataAndContinue);
+ testRunner.statisticsProcessStatisticsAndDataRecords();
+ }
+
+ function checkWebsiteDataAndContinue() {
+ checkCookies(true);
+ checkLocalStorageExists(true, function () {
+ checkIDBDataStoreExists(true, finishTest);
+ });
+ }
+
+ function finishTest() {
+ resetCookies();
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
+ setEnableFeature(false, function() {
+ testRunner.notifyDone();
+ });
+ });
+ }
+
+ const originUnderTest = "http://127.0.0.1:8000";
+ function runTest() {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(true, function() {
+ testRunner.setStatisticsHasHadUserInteraction(originUnderTest, false, function() {
+ if (testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
+ addOutput("FAIL: " + originUnderTest + " got logged for user interaction.");
+ writeWebsiteDataAndContinue();
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (253081 => 253082)
--- trunk/Source/WebCore/ChangeLog 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebCore/ChangeLog 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1,3 +1,25 @@
+2019-12-03 John Wilander <[email protected]>
+
+ Resource Load Statistics (experimental): Delete non-cookie website data after 7 days of no user interaction
+ https://bugs.webkit.org/show_bug.cgi?id=204779
+ <rdar://problem/57578989>
+
+ Reviewed by Alex Christensen.
+
+ Trackers are continuing to move cross-site tracking IDs into first-party storage.
+ This change ages out script-writable non-cookie website data in alignment with the
+ 7-day cap on client-side cookies.
+
+ Tests: http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction-database.html
+ http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html
+ http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction-database.html
+ http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html
+
+ * page/Settings.yaml:
+ New experimental feature, off by default.
+ * platform/network/NetworkStorageSession.h:
+ Added a boolean enum WebCore::FirstPartyWebsiteDataRemovalMode.
+
2019-12-03 Peng Liu <[email protected]>
The animation of returning to inline from PiP targets wrong destination rectangle
Modified: trunk/Source/WebCore/page/Settings.yaml (253081 => 253082)
--- trunk/Source/WebCore/page/Settings.yaml 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebCore/page/Settings.yaml 2019-12-04 02:41:49 UTC (rev 253082)
@@ -886,6 +886,9 @@
isThirdPartyCookieBlockingEnabled:
initial: true
+isFirstPartyWebsiteDataRemovalEnabled:
+ initial: false
+
isLoggedInAPIEnabled:
initial: false
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (253081 => 253082)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -75,6 +75,7 @@
enum class IncludeSecureCookies : bool;
enum class IncludeHttpOnlyCookies : bool;
enum class ThirdPartyCookieBlockingMode : uint8_t { All, AllOnSitesWithoutUserInteraction, OnlyAccordingToPerDomainPolicy };
+enum class FirstPartyWebsiteDataRemovalMode : bool { AllButCookies, None };
class NetworkStorageSession {
WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
Modified: trunk/Source/WebKit/ChangeLog (253081 => 253082)
--- trunk/Source/WebKit/ChangeLog 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/ChangeLog 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1,3 +1,64 @@
+2019-12-03 John Wilander <[email protected]>
+
+ Resource Load Statistics (experimental): Delete non-cookie website data after 7 days of no user interaction
+ https://bugs.webkit.org/show_bug.cgi?id=204779
+ <rdar://problem/57578989>
+
+ Reviewed by Alex Christensen.
+
+ Trackers are continuing to move cross-site tracking IDs into first-party storage.
+ This change ages out script-writable non-cookie website data in alignment with the
+ 7-day cap on client-side cookies.
+
+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+ (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
+ Now makes use of the set WebCore::FirstPartyWebsiteDataRemovalMode.
+ * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
+ Now makes use of the set WebCore::FirstPartyWebsiteDataRemovalMode.
+ * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
+ (WebKit::ResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode):
+ (WebKit::ResourceLoadStatisticsStore::firstPartyWebsiteDataRemovalMode const):
+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode):
+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::setFirstPartyWebsiteDataRemovalModeForTesting):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * NetworkProcess/NetworkSession.cpp:
+ (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
+ (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
+ (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings):
+ New convenience function to avoid code duplication in
+ NetworkSession::setResourceLoadStatisticsEnabled() and
+ NetworkSession::forwardResourceLoadStatisticsSettings().
+ * NetworkProcess/NetworkSession.h:
+ * NetworkProcess/NetworkSessionCreationParameters.cpp:
+ (WebKit::NetworkSessionCreationParameters::encode const):
+ (WebKit::NetworkSessionCreationParameters::decode):
+ * NetworkProcess/NetworkSessionCreationParameters.h:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+ * Scripts/webkit/messages.py:
+ Makes sure the WebCore::FirstPartyWebsiteDataRemovalMode is found in WebCore/NetworkStorageSession.h.
+ * Shared/WebPreferences.yaml:
+ New experimental feature, off by default.
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting):
+ (WKWebsiteDataStoreStatisticsResetToConsistentState):
+ * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting):
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::ensureNetworkProcess):
+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+ (WebKit::WebsiteDataStore::parameters):
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2019-12-03 Chris Dumez <[email protected]>
[iOS] Unable to interact with the view after a back swipe until lifting the finger off the screen
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -2087,7 +2087,10 @@
bool ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor(const DomainData& resourceStatistic, bool shouldCheckForGrandfathering)
{
- return resourceStatistic.isScheduledForAllButCookieDataRemoval && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Short) && (!shouldCheckForGrandfathering || !resourceStatistic.grandfathered);
+ bool isRemovalEnabled = firstPartyWebsiteDataRemovalMode() != FirstPartyWebsiteDataRemovalMode::None || resourceStatistic.isScheduledForAllButCookieDataRemoval;
+ bool isResourceGrandfathered = shouldCheckForGrandfathering && resourceStatistic.grandfathered;
+
+ return isRemovalEnabled && !isResourceGrandfathered && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Short);
}
Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor()
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -832,7 +832,10 @@
bool ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor(ResourceLoadStatistics& resourceStatistic, bool shouldCheckForGrandfathering) const
{
- return resourceStatistic.gotLinkDecorationFromPrevalentResource && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Short) && (!shouldCheckForGrandfathering || !resourceStatistic.grandfathered);
+ bool isRemovalEnabled = firstPartyWebsiteDataRemovalMode() != FirstPartyWebsiteDataRemovalMode::None || resourceStatistic.gotLinkDecorationFromPrevalentResource;
+ bool isResourceGrandfathered = shouldCheckForGrandfathering && resourceStatistic.grandfathered;
+
+ return isRemovalEnabled && !isResourceGrandfathered && !hasHadUnexpiredRecentUserInteraction(resourceStatistic, OperatingDatesWindow::Short);
}
Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor()
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -30,7 +30,6 @@
#include "ResourceLoadStatisticsClassifier.h"
#include "WebResourceLoadStatisticsStore.h"
#include <WebCore/FrameIdentifier.h>
-#include <WebCore/NetworkStorageSession.h>
#include <wtf/CompletionHandler.h>
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
@@ -164,6 +163,7 @@
void setPrevalentResourceForDebugMode(const RegistrableDomain&);
void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode mode) { m_thirdPartyCookieBlockingMode = mode; };
WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode() const { return m_thirdPartyCookieBlockingMode; };
+ void setFirstPartyWebsiteDataRemovalMode(WebCore::FirstPartyWebsiteDataRemovalMode mode) { m_firstPartyWebsiteDataRemovalMode = mode; }
virtual bool areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain&) = 0;
virtual void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<WebCore::FrameIdentifier>, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&) = 0;
@@ -237,6 +237,7 @@
const RegistrableDomain& debugStaticPrevalentResource() const { return m_debugStaticPrevalentResource; }
bool debugLoggingEnabled() const { return m_debugLoggingEnabled; };
bool debugModeEnabled() const { return m_debugModeEnabled; }
+ WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode() const { return m_firstPartyWebsiteDataRemovalMode; }
static constexpr unsigned maxNumberOfRecursiveCallsInRedirectTraceBack { 50 };
@@ -275,6 +276,7 @@
WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction };
bool m_dataRecordsBeingRemoved { false };
ShouldIncludeLocalhost m_shouldIncludeLocalhost { ShouldIncludeLocalhost::Yes };
+ WebCore::FirstPartyWebsiteDataRemovalMode m_firstPartyWebsiteDataRemovalMode { WebCore::FirstPartyWebsiteDataRemovalMode::None };
};
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -481,6 +481,19 @@
});
}
+void WebResourceLoadStatisticsStore::setFirstPartyWebsiteDataRemovalMode(FirstPartyWebsiteDataRemovalMode mode, CompletionHandler<void()>&& completionHandler)
+{
+ ASSERT(RunLoop::isMain());
+
+ postTask([this, mode, completionHandler = WTFMove(completionHandler)]() mutable {
+ if (m_statisticsStore)
+ m_statisticsStore->setFirstPartyWebsiteDataRemovalMode(mode);
+ postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable {
+ completionHandler();
+ });
+ });
+}
+
void WebResourceLoadStatisticsStore::didCreateNetworkProcess()
{
ASSERT(RunLoop::isMain());
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -31,6 +31,7 @@
#include "WebPageProxyIdentifier.h"
#include "WebsiteDataType.h"
#include <WebCore/FrameIdentifier.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PageIdentifier.h>
#include <WebCore/RegistrableDomain.h>
#include <wtf/CompletionHandler.h>
@@ -181,6 +182,7 @@
void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode);
+ void setFirstPartyWebsiteDataRemovalMode(WebCore::FirstPartyWebsiteDataRemovalMode, CompletionHandler<void()>&&);
void didCreateNetworkProcess();
void notifyResourceLoadStatisticsProcessed();
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1273,6 +1273,19 @@
ASSERT_NOT_REACHED();
completionHandler();
}
+
+void NetworkProcess::setFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID sessionID, WebCore::FirstPartyWebsiteDataRemovalMode mode, CompletionHandler<void()>&& completionHandler)
+{
+ if (auto* networkSession = this->networkSession(sessionID)) {
+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+ resourceLoadStatistics->setFirstPartyWebsiteDataRemovalMode(mode, WTFMove(completionHandler));
+ else
+ completionHandler();
+ } else {
+ ASSERT_NOT_REACHED();
+ completionHandler();
+ }
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -261,6 +261,7 @@
bool isITPDatabaseEnabled() const { return m_isITPDatabaseEnabled; }
void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&);
+ void setFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID, WebCore::FirstPartyWebsiteDataRemovalMode, CompletionHandler<void()>&&);
#endif
using CacheStorageRootPathCallback = CompletionHandler<void(String&&)>;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-12-04 02:41:49 UTC (rev 253082)
@@ -138,6 +138,7 @@
HasIsolatedSession(PAL::SessionID sessionID, WebCore::RegistrableDomain domain) -> (bool hasIsolatedSession) Async
SetShouldDowngradeReferrerForTesting(bool enabled) -> () Async
SetShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, enum:uint8_t WebCore::ThirdPartyCookieBlockingMode blockingMode) -> () Async
+ SetFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID sessionID, enum:bool WebCore::FirstPartyWebsiteDataRemovalMode mode) -> () Async
#endif
SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -175,7 +175,7 @@
// This should always be forwarded since debug mode may be enabled at runtime.
if (!m_resourceLoadStatisticsManualPrevalentResource.isEmpty())
m_resourceLoadStatistics->setPrevalentResourceForDebugMode(m_resourceLoadStatisticsManualPrevalentResource, [] { });
- m_resourceLoadStatistics->setThirdPartyCookieBlockingMode(m_thirdPartyCookieBlockingMode);
+ forwardResourceLoadStatisticsSettings();
}
void NetworkSession::recreateResourceLoadStatisticStore(CompletionHandler<void()>&& completionHandler)
@@ -183,7 +183,13 @@
destroyResourceLoadStatistics();
m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory, m_shouldIncludeLocalhostInResourceLoadStatistics);
m_resourceLoadStatistics->populateMemoryStoreFromDisk(WTFMove(completionHandler));
+ forwardResourceLoadStatisticsSettings();
+}
+
+void NetworkSession::forwardResourceLoadStatisticsSettings()
+{
m_resourceLoadStatistics->setThirdPartyCookieBlockingMode(m_thirdPartyCookieBlockingMode);
+ m_resourceLoadStatistics->setFirstPartyWebsiteDataRemovalMode(m_firstPartyWebsiteDataRemovalMode, [] { });
}
bool NetworkSession::isResourceLoadStatisticsEnabled() const
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -132,6 +132,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void destroyResourceLoadStatistics();
+ void forwardResourceLoadStatisticsSettings();
#endif
PAL::SessionID m_sessionID;
@@ -146,6 +147,7 @@
bool m_enableResourceLoadStatisticsLogTestingEvent;
bool m_downgradeReferrer { true };
WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction };
+ WebCore::FirstPartyWebsiteDataRemovalMode m_firstPartyWebsiteDataRemovalMode { WebCore::FirstPartyWebsiteDataRemovalMode::None };
#endif
bool m_isStaleWhileRevalidateEnabled { false };
UniqueRef<AdClickAttributionManager> m_adClickAttribution;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -69,6 +69,7 @@
encoder << enableResourceLoadStatisticsDebugMode;
encoder << resourceLoadStatisticsManualPrevalentResource;
encoder << thirdPartyCookieBlockingMode;
+ encoder << firstPartyWebsiteDataRemovalMode;
encoder << networkCacheDirectory << networkCacheDirectoryExtensionHandle;
@@ -205,6 +206,11 @@
if (!thirdPartyCookieBlockingMode)
return WTF::nullopt;
+ Optional<WebCore::FirstPartyWebsiteDataRemovalMode> firstPartyWebsiteDataRemovalMode;
+ decoder >> firstPartyWebsiteDataRemovalMode;
+ if (!firstPartyWebsiteDataRemovalMode)
+ return WTF::nullopt;
+
Optional<String> networkCacheDirectory;
decoder >> networkCacheDirectory;
if (!networkCacheDirectory)
@@ -289,6 +295,7 @@
, WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics)
, WTFMove(*enableResourceLoadStatisticsDebugMode)
, WTFMove(*thirdPartyCookieBlockingMode)
+ , WTFMove(*firstPartyWebsiteDataRemovalMode)
, WTFMove(*deviceManagementRestrictionsEnabled)
, WTFMove(*allLoadsBlockedByDeviceManagementRestrictionsForTesting)
, WTFMove(*resourceLoadStatisticsManualPrevalentResource)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -87,6 +87,7 @@
bool shouldIncludeLocalhostInResourceLoadStatistics { true };
bool enableResourceLoadStatisticsDebugMode { false };
WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction };
+ WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode { WebCore::FirstPartyWebsiteDataRemovalMode::None };
bool deviceManagementRestrictionsEnabled { false };
bool allLoadsBlockedByDeviceManagementRestrictionsForTesting { false };
WebCore::RegistrableDomain resourceLoadStatisticsManualPrevalentResource { };
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (253081 => 253082)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1136,6 +1136,7 @@
m_enableResourceLoadStatisticsDebugMode = parameters.enableResourceLoadStatisticsDebugMode ? EnableResourceLoadStatisticsDebugMode::Yes : EnableResourceLoadStatisticsDebugMode::No;
m_resourceLoadStatisticsManualPrevalentResource = parameters.resourceLoadStatisticsManualPrevalentResource;
m_thirdPartyCookieBlockingMode = parameters.thirdPartyCookieBlockingMode;
+ m_firstPartyWebsiteDataRemovalMode = parameters.firstPartyWebsiteDataRemovalMode;
setResourceLoadStatisticsEnabled(parameters.enableResourceLoadStatistics);
#endif
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (253081 => 253082)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2019-12-04 02:41:49 UTC (rev 253082)
@@ -589,6 +589,7 @@
'WebCore::TextCheckingType': ['<WebCore/TextChecking.h>'],
'WebCore::TextIndicatorData': ['<WebCore/TextIndicator.h>'],
'WebCore::ThirdPartyCookieBlockingMode': ['<WebCore/NetworkStorageSession.h>'],
+ 'WebCore::FirstPartyWebsiteDataRemovalMode': ['<WebCore/NetworkStorageSession.h>'],
'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
'WebCore::WillContinueLoading': ['<WebCore/FrameLoaderTypes.h>'],
'WebCore::SelectionRect': ['"EditorState.h"'],
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (253081 => 253082)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1817,6 +1817,13 @@
humanReadableDescription: "Block all third-party cookies when Intelligent Tracking Prevention is enabled"
category: experimental
+IsFirstPartyWebsiteDataRemovalEnabled:
+ type: bool
+ defaultValue: false
+ humanReadableName: "Remove Non-Cookie Data After 7 Days of No User Interaction (ITP)"
+ humanReadableDescription: "Remove all non-cookie website data after seven days of no user interaction when Intelligent Tracking Prevention is enabled"
+ category: experimental
+
IsLoggedInAPIEnabled:
type: bool
defaultValue: false
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -549,6 +549,17 @@
#endif
}
+void WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTestingFunction completionHandler)
+{
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+ WebKit::toImpl(dataStoreRef)->setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(enabled, [context, completionHandler] {
+ completionHandler(context);
+ });
+#else
+ completionHandler(context);
+#endif
+}
+
void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsResetToConsistentStateFunction completionHandler)
{
#if ENABLE(RESOURCE_LOAD_STATISTICS)
@@ -562,6 +573,7 @@
store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { });
store.setResourceLoadStatisticsShouldDowngradeReferrerForTesting(true, [callbackAggregator = callbackAggregator.copyRef()] { });
store.setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(false, false, [callbackAggregator = callbackAggregator.copyRef()] { });
+ store.setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(false, [callbackAggregator = callbackAggregator.copyRef()] { });
store.resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { });
store.scheduleClearInMemoryAndPersistent(WebKit::ShouldGrandfatherStatistics::No, [callbackAggregator = callbackAggregator.copyRef()] { });
store.setUseITPDatabase(false, [callbackAggregator = callbackAggregator.copyRef()] { });
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -121,6 +121,8 @@
WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTestingFunction completionHandler);
typedef void (*WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, bool onlyOnSitesWithoutUserInteraction, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction completionHandler);
+typedef void (*WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTestingFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTestingFunction completionHandler);
typedef void (*WKWebsiteDataStoreStatisticsResetToConsistentStateFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsResetToConsistentStateFunction completionHandler);
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1066,6 +1066,16 @@
sendWithAsyncReply(Messages::NetworkProcess::SetShouldBlockThirdPartyCookiesForTesting(sessionID, blockingMode), WTFMove(completionHandler));
}
+
+void NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID sessionID, FirstPartyWebsiteDataRemovalMode mode, CompletionHandler<void()>&& completionHandler)
+{
+ if (!canSendMessage()) {
+ completionHandler();
+ return;
+ }
+
+ sendWithAsyncReply(Messages::NetworkProcess::SetFirstPartyWebsiteDataRemovalModeForTesting(sessionID, mode), WTFMove(completionHandler));
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
void NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting()
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -159,6 +159,7 @@
void hasIsolatedSession(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&);
+ void setFirstPartyWebsiteDataRemovalModeForTesting(PAL::SessionID, WebCore::FirstPartyWebsiteDataRemovalMode, CompletionHandler<void()>&&);
#endif
void synthesizeAppIsBackground(bool background);
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -569,6 +569,7 @@
bool shouldIncludeLocalhost = true;
bool enableResourceLoadStatisticsDebugMode = false;
WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction;
+ WebCore::FirstPartyWebsiteDataRemovalMode firstPartyWebsiteDataRemovalMode = WebCore::FirstPartyWebsiteDataRemovalMode::None;
WebCore::RegistrableDomain manualPrevalentResource { };
if (withWebsiteDataStore) {
enableResourceLoadStatistics = withWebsiteDataStore->resourceLoadStatisticsEnabled();
@@ -580,6 +581,7 @@
shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode;
+ firstPartyWebsiteDataRemovalMode = networkSessionParameters.firstPartyWebsiteDataRemovalMode;
manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
}
@@ -601,6 +603,7 @@
shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode;
+ firstPartyWebsiteDataRemovalMode = networkSessionParameters.firstPartyWebsiteDataRemovalMode;
manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
}
@@ -625,6 +628,8 @@
parameters.defaultDataStoreParameters.networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics = shouldIncludeLocalhost;
parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatisticsDebugMode = enableResourceLoadStatisticsDebugMode;
parameters.defaultDataStoreParameters.networkSessionParameters.thirdPartyCookieBlockingMode = thirdPartyCookieBlockingMode;
+ parameters.defaultDataStoreParameters.networkSessionParameters.firstPartyWebsiteDataRemovalMode = firstPartyWebsiteDataRemovalMode;
+
parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsManualPrevalentResource = manualPrevalentResource;
// Add any platform specific parameters
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-12-04 02:41:49 UTC (rev 253082)
@@ -71,6 +71,7 @@
bool shouldLogCookieInformation = false;
bool enableResourceLoadStatisticsDebugMode = false;
auto thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy;
+ auto firstPartyWebsiteDataRemovalMode = WebCore::FirstPartyWebsiteDataRemovalMode::None;
bool enableLegacyTLS = true;
if (id value = [defaults objectForKey:@"WebKitEnableLegacyTLS"])
enableLegacyTLS = [value boolValue];
@@ -81,6 +82,8 @@
thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::All;
else
thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction;
+ if ([defaults boolForKey:[NSString stringWithFormat:@"Experimental%@", WebPreferencesKey::isFirstPartyWebsiteDataRemovalEnabledKey().createCFString().get()]])
+ firstPartyWebsiteDataRemovalMode = WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies;
auto* manualPrevalentResource = [defaults stringForKey:@"ITPManualPrevalentResource"];
if (manualPrevalentResource) {
URL url { URL(), manualPrevalentResource };
@@ -145,6 +148,7 @@
shouldIncludeLocalhostInResourceLoadStatistics,
enableResourceLoadStatisticsDebugMode,
thirdPartyCookieBlockingMode,
+ firstPartyWebsiteDataRemovalMode,
m_configuration->deviceManagementRestrictionsEnabled(),
m_configuration->allLoadsBlockedByDeviceManagementRestrictionsForTesting(),
WTFMove(resourceLoadStatisticsManualPrevalentResource),
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1804,6 +1804,21 @@
}
ASSERT(!completionHandler);
}
+
+void WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(bool enabled, CompletionHandler<void()>&& completionHandler)
+{
+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
+ auto mode = enabled ? WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies : WebCore::FirstPartyWebsiteDataRemovalMode::None;
+
+ for (auto& processPool : processPools()) {
+ if (auto* networkProcess = processPool->networkProcess()) {
+ networkProcess->setFirstPartyWebsiteDataRemovalModeForTesting(m_sessionID, mode, [callbackAggregator = callbackAggregator.copyRef()] { });
+ ASSERT(processPools().size() == 1);
+ break;
+ }
+ }
+ ASSERT(!completionHandler);
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
void WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources(Seconds seconds, CompletionHandler<void()>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (253081 => 253082)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -195,6 +195,7 @@
void hasIsolatedSessionForTesting(const URL&, CompletionHandler<void(bool)>&&) const;
void setResourceLoadStatisticsShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
void setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(bool enabled, bool onlyOnSitesWithoutUserInteraction, CompletionHandler<void()>&&);
+ void setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(bool enabled, CompletionHandler<void()>&&);
#endif
void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&);
void resetCacheMaxAgeCapForPrevalentResources(CompletionHandler<void()>&&);
Modified: trunk/Tools/ChangeLog (253081 => 253082)
--- trunk/Tools/ChangeLog 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/ChangeLog 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1,3 +1,29 @@
+2019-12-03 John Wilander <[email protected]>
+
+ Resource Load Statistics (experimental): Delete non-cookie website data after 7 days of no user interaction
+ https://bugs.webkit.org/show_bug.cgi?id=204779
+ <rdar://problem/57578989>
+
+ Reviewed by Alex Christensen.
+
+ These changes are test infrastructure so that TestRunner can
+ control the new setting.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setStatisticsFirstPartyWebsiteDataRemovalMode):
+ (WTR::TestRunner::statisticsCallDidSetFirstPartyWebsiteDataRemovalModeCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::setStatisticsFirstPartyWebsiteDataRemovalMode):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+ (WTR::TestInvocation::didSetFirstPartyWebsiteDataRemovalMode):
+ * WebKitTestRunner/TestInvocation.h:
+
2019-12-03 Jonathan Bedard <[email protected]>
Python 3: Add support in webkitpy.bindings
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-12-04 02:41:49 UTC (rev 253082)
@@ -343,6 +343,7 @@
boolean hasStatisticsIsolatedSession(DOMString hostName);
void setStatisticsShouldDowngradeReferrer(boolean value, object callback);
void setStatisticsShouldBlockThirdPartyCookies(boolean value, object callback, optional boolean onlyOnSitesWithoutUserInteraction);
+ void setStatisticsFirstPartyWebsiteDataRemovalMode(boolean value, object callback);
// Injected bundle form client.
void installTextDidChangeInTextFieldCallback(object callback);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -337,6 +337,11 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetFirstPartyWebsiteDataRemovalMode")) {
+ m_testRunner->statisticsCallDidSetFirstPartyWebsiteDataRemovalModeCallback();
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "CallDidResetStatisticsToConsistentState")) {
m_testRunner->statisticsCallDidResetToConsistentStateCallback();
return;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -752,6 +752,7 @@
StatisticsDidSetBlockCookiesForHostCallbackID,
StatisticsDidSetShouldDowngradeReferrerCallbackID,
StatisticsDidSetShouldBlockThirdPartyCookiesCallbackID,
+ StatisticsDidSetFirstPartyWebsiteDataRemovalModeCallbackID,
AllStorageAccessEntriesCallbackID,
DidRemoveAllSessionCredentialsCallbackID,
GetApplicationManifestCallbackID,
@@ -2244,6 +2245,24 @@
m_hasSetBlockThirdPartyCookiesCallback = false;
}
+void TestRunner::setStatisticsFirstPartyWebsiteDataRemovalMode(bool value, JSValueRef completionHandler)
+{
+ if (m_hasSetFirstPartyWebsiteDataRemovalModeCallback)
+ return;
+
+ cacheTestRunnerCallback(StatisticsDidSetFirstPartyWebsiteDataRemovalModeCallbackID, completionHandler);
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsFirstPartyWebsiteDataRemovalMode"));
+ WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+ m_hasSetFirstPartyWebsiteDataRemovalModeCallback = true;
+}
+
+void TestRunner::statisticsCallDidSetFirstPartyWebsiteDataRemovalModeCallback()
+{
+ callTestRunnerCallback(StatisticsDidSetFirstPartyWebsiteDataRemovalModeCallbackID);
+ m_hasSetFirstPartyWebsiteDataRemovalModeCallback = false;
+}
+
void TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback()
{
callTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -444,6 +444,8 @@
void statisticsCallDidSetShouldDowngradeReferrerCallback();
void setStatisticsShouldBlockThirdPartyCookies(bool value, JSValueRef callback, bool onlyOnSitesWithoutUserInteraction);
void statisticsCallDidSetShouldBlockThirdPartyCookiesCallback();
+ void setStatisticsFirstPartyWebsiteDataRemovalMode(bool value, JSValueRef callback);
+ void statisticsCallDidSetFirstPartyWebsiteDataRemovalModeCallback();
void statisticsResetToConsistentState(JSValueRef completionHandler);
void statisticsCallDidResetToConsistentStateCallback();
@@ -581,6 +583,7 @@
bool m_dumpAllHTTPRedirectedResponseHeaders { false };
bool m_hasSetDowngradeReferrerCallback { false };
bool m_hasSetBlockThirdPartyCookiesCallback { false };
+ bool m_hasSetFirstPartyWebsiteDataRemovalModeCallback { false };
};
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -3598,6 +3598,14 @@
m_currentInvocation->didSetShouldBlockThirdPartyCookies();
}
+void TestController::setStatisticsFirstPartyWebsiteDataRemovalMode(bool value)
+{
+ ResourceStatisticsCallbackContext context(*this);
+ WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting(TestController::websiteDataStore(), value, &context, resourceStatisticsVoidResultCallback);
+ runUntil(context.done, noTimeout);
+ m_currentInvocation->didSetFirstPartyWebsiteDataRemovalMode();
+}
+
void TestController::statisticsResetToConsistentState()
{
ResourceStatisticsCallbackContext context(*this);
Modified: trunk/Tools/WebKitTestRunner/TestController.h (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/TestController.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -254,6 +254,7 @@
bool hasStatisticsIsolatedSession(WKStringRef hostName);
void setStatisticsShouldDowngradeReferrer(bool value);
void setStatisticsShouldBlockThirdPartyCookies(bool value, bool onlyOnSitesWithoutUserInteraction);
+ void setStatisticsFirstPartyWebsiteDataRemovalMode(bool value);
void statisticsResetToConsistentState();
void getAllStorageAccessEntries();
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-12-04 02:41:49 UTC (rev 253082)
@@ -1568,6 +1568,13 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsFirstPartyWebsiteDataRemovalMode")) {
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+ TestController::singleton().setStatisticsFirstPartyWebsiteDataRemovalMode(WKBooleanGetValue(value));
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "RemoveAllSessionCredentials")) {
TestController::singleton().removeAllSessionCredentials();
return nullptr;
@@ -1857,6 +1864,12 @@
WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), nullptr);
}
+void TestInvocation::didSetFirstPartyWebsiteDataRemovalMode()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetFirstPartyWebsiteDataRemovalMode"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), nullptr);
+}
+
void TestInvocation::didResetStatisticsToConsistentState()
{
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidResetStatisticsToConsistentState"));
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (253081 => 253082)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2019-12-04 02:36:54 UTC (rev 253081)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2019-12-04 02:41:49 UTC (rev 253082)
@@ -75,6 +75,7 @@
void didClearStatisticsThroughWebsiteDataRemoval();
void didSetShouldDowngradeReferrer();
void didSetShouldBlockThirdPartyCookies();
+ void didSetFirstPartyWebsiteDataRemovalMode();
void didResetStatisticsToConsistentState();
void didSetBlockCookiesForHost();
void didSetStatisticsDebugMode();