Storage Access API: Remove access for all frames under a page when the page is closed
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Jan 2018 22:41:07 +0000 (22:41 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Jan 2018 22:41:07 +0000 (22:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181398
<rdar://problem/36357879>

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. Discussed with Alex Christensen and we concluded that
both a layout test and an API test would require a lot of work and
we have existing tests for clearing out storage access for frames.

* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226542 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/WebProcess/WebPage/WebPage.cpp

index aea087b..0797002 100644 (file)
@@ -1,3 +1,19 @@
+2018-01-08  John Wilander  <wilander@apple.com>
+
+        Storage Access API: Remove access for all frames under a page when the page is closed
+        https://bugs.webkit.org/show_bug.cgi?id=181398
+        <rdar://problem/36357879>
+
+        Reviewed by Alex Christensen.
+
+        No new tests. Discussed with Alex Christensen and we concluded that
+        both a layout test and an API test would require a lot of work and
+        we have existing tests for clearing out storage access for frames.
+
+        * platform/network/NetworkStorageSession.h:
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
+
 2018-01-08  Matt Lewis  <jlewis3@apple.com>
 
         Unreviewed, rolling out r226385.
index 31dc0e6..a6580b5 100644 (file)
@@ -101,6 +101,7 @@ public:
     WEBCORE_EXPORT bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const;
     WEBCORE_EXPORT void grantStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
     WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
+    WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);
 #endif
 #elif USE(SOUP)
     NetworkStorageSession(PAL::SessionID, std::unique_ptr<SoupNetworkSession>&&);
index f1c8aca..2880968 100644 (file)
@@ -322,6 +322,11 @@ void NetworkStorageSession::removeStorageAccessForFrame(uint64_t frameID, uint64
     iteration->value.remove(frameID);
 }
 
+void NetworkStorageSession::removeStorageAccessForAllFramesOnPage(uint64_t pageID)
+{
+    m_framesGrantedStorageAccess.remove(pageID);
+}
+
 #endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
 
 #if !PLATFORM(COCOA)
index 3c7068c..1d5b2be 100644 (file)
@@ -1,3 +1,18 @@
+2018-01-08  John Wilander  <wilander@apple.com>
+
+        Storage Access API: Remove access for all frames under a page when the page is closed
+        https://bugs.webkit.org/show_bug.cgi?id=181398
+        <rdar://problem/36357879>
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::close):
+
 2018-01-08  Youenn Fablet  <youenn@apple.com>
 
         SWClientConnection should not keep references to service worker jobs
index 9ad3d77..6b1e93a 100644 (file)
@@ -482,4 +482,14 @@ void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID s
 #endif
 }
 
+void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID)
+{
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    storageSession(sessionID).removeStorageAccessForAllFramesOnPage(pageID);
+#else
+    UNUSED_PARAM(sessionID);
+    UNUSED_PARAM(pageID);
+#endif
+}
+
 } // namespace WebKit
index b126d3c..aa0d9c4 100644 (file)
@@ -134,6 +134,7 @@ private:
     CacheStorageEngineConnection& cacheStorageConnection();
 
     void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
+    void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
 
     Ref<IPC::Connection> m_connection;
 
index 4efdc1d..163ff03 100644 (file)
@@ -59,4 +59,5 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     EnsureLegacyPrivateBrowsingSession()
 
     RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
+    RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
 }
index 9129a03..cb8c05c 100644 (file)
@@ -46,6 +46,8 @@
 #include "LoadParameters.h"
 #include "Logging.h"
 #include "NetscapePlugin.h"
+#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkProcessConnection.h"
 #include "NotificationPermissionRequestManager.h"
 #include "PageBanner.h"
 #include "PluginProcessAttributes.h"
@@ -1093,6 +1095,8 @@ void WebPage::close()
     if (m_isClosed)
         return;
 
+    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForAllFramesOnPage(sessionID(), m_pageID), 0);
+    
     m_isClosed = true;
 
     // If there is still no URL, then we never loaded anything in this page, so nothing to report.