Get StorageAccess API features working on SQLite database implementation (195422)
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 19:14:08 +0000 (19:14 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Oct 2019 19:14:08 +0000 (19:14 +0000)
commit011fd4b0af23243d471c23f9832f4d39fab1a23e
tree663ba78d5fc2fd8940f939547ea775dc7fe76f82
parentbff8363575c4869204ea224ecfa667f831421f9f
Get StorageAccess API features working on SQLite database implementation (195422)
https://bugs.webkit.org/show_bug.cgi?id=195422
<rdar://problem/54213519>

Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-10-11
Reviewed by Brent Fulgham.

Source/WebKit:

This patch migrates the http/tests/storageAccess/ Layout tests to
use the ITP database and uncovered 3 bugs in the process.

1. It was previously blocking cookies to a third party domain which
was not marked as prevalent. Now it ensures that the user is prompted
using the storage acess API regarding that third party domain.

2. It was not requesting storage access if cookies had previously been
blocked. Now it will only return early from
ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener
if cookie access is allowed, and request storage access otherwise.

3. hasUserGrantedStorageAccessThroughPrompt was returning true even
if the result was not previously granted storage access.

All of these fixes match behavior in
ResourceLoadStatisticsMemoryStore.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):

LayoutTests:

This patch migrates tests in http/tests/storageAccess to use the ITP
SQLite Database to ensure the storageAccess API features are working.
Additionally, the Safari UI flow was manually tested for the database
using tlstestwebkit.org (no automated tests exist for this).

It also updates the test expectations for two tests that consistently
timeout on the flakiness dashboard and will be looked into in a
separate radar.

Most storageAccess tests are skipped on ios because of incompatibility
with recognizing user interaction.

* http/tests/storageAccess/deny-storage-access-under-opener-database-expected.txt: Added.
* http/tests/storageAccess/deny-storage-access-under-opener-database.html: Added.
* http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-database-expected.txt: Added.
* http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-database.html: Added.
* http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-database-expected.txt: Added.
* http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-database.html: Added.
* http/tests/storageAccess/deny-without-prompt-preserves-gesture-database-expected.txt: Added.
* http/tests/storageAccess/deny-without-prompt-preserves-gesture-database.html: Added.
* http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-database-expected.txt: Added.
* http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-database.html: Added.
* http/tests/storageAccess/grant-with-prompt-preserves-gesture-database-expected.txt: Added.
* http/tests/storageAccess/grant-with-prompt-preserves-gesture-database.html: Added.
* http/tests/storageAccess/has-storage-access-crash-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-crash-database.html: Added.
* http/tests/storageAccess/has-storage-access-false-by-default-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-false-by-default-database.html: Added.
* http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-database.html: Added.
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-database.html: Added.
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-database.html: Added.
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-database-expected.txt: Added.
* http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-database.html: Added.
* http/tests/storageAccess/remove-requesting-iframe-database-expected.txt: Added.
* http/tests/storageAccess/remove-requesting-iframe-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-database.html: Added.
* http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-database-expected.txt: Added.
* http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-database.html: Added.
* http/tests/storageAccess/request-storage-access-crash-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-crash-database.html: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-database.html: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-database.html: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture-database.html: Added.
* http/tests/storageAccess/request-storage-access-same-origin-iframe-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-same-origin-iframe-database.html: Added.
* http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-database.html: Added.
* http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-database.html: Added.
* http/tests/storageAccess/request-storage-access-top-frame-database-expected.txt: Added.
* http/tests/storageAccess/request-storage-access-top-frame-database.html: Added.
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
67 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-crash-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-crash-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/remove-requesting-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/remove-requesting-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-crash-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-crash-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-database.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-top-frame-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-storage-access-top-frame-database.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp