Resource Load Statistics: Immediately forward cookie access at user interaction when...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2018 02:05:56 +0000 (02:05 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2018 02:05:56 +0000 (02:05 +0000)
commitcc566578559d07476256283d51c84c1460c37ca4
tree2fe643bdc803004f40bf0a4841b437d2bcdf1db8
parentedd7344042d12fdc9aaec629299c192c4278a27f
Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
https://bugs.webkit.org/show_bug.cgi?id=183577
<rdar://problem/38266987>

Reviewed by Brent Fulgham.

Source/WebCore:

Tested manually on live websites.
No new automated tests because of a bug in WebKitTestRunner:
https://bugs.webkit.org/show_bug.cgi?id=183578
The event sender triggers gestures in the opener rather than
in the popup.

* dom/Document.cpp:
(WebCore::Document::removedLastRef):
    Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
(WebCore::Document::hasGrantedPageSpecificStorageAccess):
(WebCore::Document::setHasGrantedPageSpecificStorageAccess):
* dom/Document.h:
    Added member m_primaryDomainsGrantedPageSpecificStorageAccess
    where we store domains that have been granted access.
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Now checks if there is a cross-origin opener and if so, immediately
    grants cookie access to the popup's domain if it is partitioned or
    blocked.
* loader/ResourceLoadObserver.h:
* platform/network/NetworkStorageSession.h:
    Added member m_pagesGrantedStorageAccess.
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStoragePartition const):
(WebCore::NetworkStorageSession::hasStorageAccess const):
    Renamed from hasStorageAccessForFrame since the frameID now is optional.
(WebCore::NetworkStorageSession::grantStorageAccess):
    Renamed from grantStorageAccessForFrame since the frameID now is optional.
(WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
    Now removes the pageID entry in m_pagesGrantedStorageAccess.
(WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
    Renamed since the frameID now is optional.
(WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
    Renamed since the frameID now is optional.

Source/WebKit:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::hasStorageAccessForFrame):
    Now also checks for general page access.
(WebKit::NetworkProcess::grantStorageAccess):
    Renamed from grantStorageAccessForFrame since the frameID now is optional.
(WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
    Renamed since the frameID now is optional.
* NetworkProcess/NetworkProcess.h:
    Renaming since the frameID now is optional.
* NetworkProcess/NetworkProcess.messages.in:
    Renaming since the frameID now is optional.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::logCookieInformation):
    Consequence of function renaming.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::grantStorageAccess):
(WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
    Renaming since the frameID now is optional.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
    Renaming since the frameID now is optional.
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
    Handler renaming since the frameID now is optional.
(WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
    New function for that grants cookie access under a whole page.
* UIProcess/WebResourceLoadStatisticsStore.h:
    Member renaming since the frameID now is optional.
* UIProcess/WebResourceLoadStatisticsStore.messages.in:
    New message received straight from WebCore::ResourceLoadObserver.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::grantStorageAccessHandler):
    Renamed and made frameID optional.
(WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
    Consequence of renaming and making frameID optional.
(WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
    Renamed and made frameID optional.
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebProcess.cpp:
(WebProcess::WebProcess):
    Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
    WebCore::ResourceLoadObserver.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229569 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadObserver.h
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.messages.in
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebProcess/WebProcess.cpp