WebKit Bugzilla
Attachment 362587 Details for
Bug 194894
: Discard cached processes when clearing website data store
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the bug
bug-194894-20190220211601.patch (text/plain), 7.66 KB, created by
Ryosuke Niwa
on 2019-02-20 21:16:02 PST
(
hide
)
Description:
Fixes the bug
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-02-20 21:16:02 PST
Size:
7.66 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 241854) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2019-02-20 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Discard cached processes when clearing website data store >+ https://bugs.webkit.org/show_bug.cgi?id=194894 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Clear the process cache when clearing the website data store so that >+ there is no way to infer which site the user had visited by observing >+ for which sites WebContent processes had been cached. >+ >+ * UIProcess/API/Cocoa/WKProcessPool.mm: >+ (-[WKProcessPool _processCacheCapacity]): Added for testing. >+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::removeData): >+ > 2019-02-18 Babak Shafiei <bshafiei@apple.com> > > Cherry-pick r241635. rdar://problem/48165262 >Index: Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (revision 241854) >+++ Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (working copy) >@@ -519,6 +519,11 @@ - (NSUInteger)_maximumSuspendedPageCount > return _processPool->maxSuspendedPageCount(); > } > >+- (NSUInteger)_processCacheCapacity >+{ >+ return _processPool->webProcessCache().capacity(); >+} >+ > - (size_t)_serviceWorkerProcessCount > { > #if ENABLE(SERVICE_WORKER) >Index: Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (revision 241854) >+++ Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (working copy) >@@ -103,6 +103,7 @@ > - (void)_makeNextWebProcessLaunchFailForTesting WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > - (void)_makeNextNetworkProcessLaunchFailForTesting WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > - (NSUInteger)_maximumSuspendedPageCount WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+- (NSUInteger)_processCacheCapacity WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > > // Test only. Returns web processes running web pages (does not include web processes running service workers) > - (size_t)_webPageContentProcessCount WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); >Index: Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (revision 241854) >+++ Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (working copy) >@@ -35,6 +35,7 @@ > #include "NetworkProcessMessages.h" > #include "StorageManager.h" > #include "WebCookieManagerProxy.h" >+#include "WebProcessCache.h" > #include "WebProcessMessages.h" > #include "WebProcessPool.h" > #include "WebResourceLoadStatisticsStore.h" >@@ -776,6 +777,9 @@ void WebsiteDataStore::removeData(Option > > auto webProcessAccessType = computeWebProcessAccessTypeForDataRemoval(dataTypes, !isPersistent()); > if (webProcessAccessType != ProcessAccessType::None) { >+ for (auto& processPool : processPools()) >+ processPool->webProcessCache().clear(); >+ > for (auto& process : processes()) { > switch (webProcessAccessType) { > case ProcessAccessType::OnlyIfLaunched: >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 241860) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-02-20 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Discard cached processes when clearing website data store >+ https://bugs.webkit.org/show_bug.cgi?id=194894 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a test case. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: >+ (TestWebKitAPI.ProcessSwap.NumberOfCachedProcesses): Added. >+ > 2019-02-18 Babak Shafiei <bshafiei@apple.com> > > Apply patch. rdar://problem/48122553 >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (revision 241854) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (working copy) >@@ -52,6 +52,7 @@ > #import <wtf/HashSet.h> > #import <wtf/RetainPtr.h> > #import <wtf/Vector.h> >+#import <wtf/text/StringConcatenateNumbers.h> > #import <wtf/text/StringHash.h> > #import <wtf/text/WTFString.h> > >@@ -2837,6 +2838,62 @@ TEST(ProcessSwap, NumberOfPrewarmedProce > EXPECT_TRUE([processPool _hasPrewarmedWebProcess]); > } > >+TEST(ProcessSwap, NumberOfCachedProcesses) >+{ >+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); >+ processPoolConfiguration.get().processSwapsOnNavigation = YES; >+ processPoolConfiguration.get().usesWebProcessCache = YES; >+ processPoolConfiguration.get().prewarmsProcessesAutomatically = NO; >+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); >+ >+ EXPECT_GT([processPool _maximumSuspendedPageCount], 0u); >+ EXPECT_GT([processPool _processCacheCapacity], 0u); >+ >+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [webViewConfiguration setProcessPool:processPool.get()]; >+ auto handler = adoptNS([[PSONScheme alloc] init]); >+ >+ const unsigned maxSuspendedPageCount = [processPool _maximumSuspendedPageCount]; >+ for (unsigned i = 0; i < maxSuspendedPageCount + 2; i++) >+ [handler addMappingFromURLString:makeString("pson://www.domain-", i, ".com") toData:pageCache1Bytes]; >+ [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; >+ >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >+ auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]); >+ [webView setNavigationDelegate:delegate.get()]; >+ >+ for (unsigned i = 0; i < maxSuspendedPageCount + 1; i++) { >+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:makeString("pson://www.domain-", i, ".com")]]; >+ [webView loadRequest:request]; >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ EXPECT_EQ(i + 1, [processPool _webProcessCount]); >+ EXPECT_EQ(i + 1, [processPool _webProcessCountIgnoringPrewarmedAndCached]); >+ EXPECT_FALSE([processPool _hasPrewarmedWebProcess]); >+ } >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:makeString("pson://www.domain-", maxSuspendedPageCount + 1, ".com")]]; >+ [webView loadRequest:request]; >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ EXPECT_EQ(maxSuspendedPageCount + 2, [processPool _webProcessCount]); >+ EXPECT_EQ(maxSuspendedPageCount + 1, [processPool _webProcessCountIgnoringPrewarmedAndCached]); >+ EXPECT_FALSE([processPool _hasPrewarmedWebProcess]); >+ >+ static bool readyToContinue = false; >+ [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate] modifiedSince:[NSDate distantPast] completionHandler:^() { >+ readyToContinue = true; >+ }]; >+ TestWebKitAPI::Util::run(&readyToContinue); >+ >+ EXPECT_EQ(maxSuspendedPageCount + 1, [processPool _webProcessCount]); >+ EXPECT_EQ(maxSuspendedPageCount + 1, [processPool _webProcessCountIgnoringPrewarmedAndCached]); >+ EXPECT_FALSE([processPool _hasPrewarmedWebProcess]); >+ >+} >+ > static const char* visibilityBytes = R"PSONRESOURCE( > <script> > window.addEventListener('pageshow', function(event) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194894
:
362587
|
362650
|
362668