Changeset 246449 in webkit
- Timestamp:
- Jun 14, 2019 4:05:31 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246448 r246449 1 2019-06-14 Youenn Fablet <youenn@apple.com> 2 3 WebResourceLoadStatisticsStore should not use its network session if invalidated 4 https://bugs.webkit.org/show_bug.cgi?id=198814 5 6 Reviewed by Geoffrey Garen. 7 8 Tell WebResourceLoadStatisticsStore that its network session is invalidated. 9 WebResourceLoadStatisticsStore will then clear its reference to the network session. 10 11 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 12 (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): 13 Added for test purposes to trigger further cookie processing. 14 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 15 (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel): 16 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 17 * NetworkProcess/NetworkSession.cpp: 18 (WebKit::NetworkSession::invalidateAndCancel): 19 1 20 2019-06-14 Joseph Pecoraro <pecoraro@apple.com> 2 21 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r245796 r246449 759 759 } 760 760 761 if (domainsToBlock.isEmpty() ) {761 if (domainsToBlock.isEmpty() && !debugModeEnabled()) { 762 762 completionHandler(); 763 763 return; -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r245868 r246449 1022 1022 } 1023 1023 1024 void WebResourceLoadStatisticsStore::invalidateAndCancel() 1025 { 1026 m_networkSession = nullptr; 1027 } 1028 1024 1029 void WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType> dataTypes, HashMap<RegistrableDomain, WebsiteDataToRemove>&& domainsToRemoveWebsiteDataFor, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler) 1025 1030 { -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r245868 r246449 177 177 178 178 NetworkSession* networkSession(); 179 void invalidateAndCancel(); 179 180 180 181 void sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample) const; -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r246388 r246449 101 101 for (auto* task : m_dataTaskSet) 102 102 task->invalidateAndCancel(); 103 #if ENABLE(RESOURCE_LOAD_STATISTICS) 104 if (m_resourceLoadStatistics) 105 m_resourceLoadStatistics->invalidateAndCancel(); 106 #endif 107 #if !ASSERT_DISABLED 108 m_isInvalidated = true; 109 #endif 103 110 } 104 111 … … 106 113 void NetworkSession::setResourceLoadStatisticsEnabled(bool enable) 107 114 { 115 ASSERT(!m_isInvalidated); 108 116 if (!enable) { 109 117 m_resourceLoadStatistics = nullptr; -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r246388 r246449 128 128 129 129 Ref<StorageManager> m_storageManager; 130 #if !ASSERT_DISABLED 131 bool m_isInvalidated { false }; 132 #endif 130 133 }; 131 134 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
r246370 r246449 481 481 } 482 482 483 - (void)_scheduleCookieBlockingUpdate:(void (^)(void))completionHandler 484 { 485 #if ENABLE(RESOURCE_LOAD_STATISTICS) 486 _websiteDataStore->websiteDataStore().scheduleCookieBlockingUpdate([completionHandler = makeBlockPtr(completionHandler)]() { 487 completionHandler(); 488 }); 489 #else 490 completionHandler(); 491 #endif 492 } 493 483 494 - (void)_setPrevalentDomain:(NSURL *)domain completionHandler:(void (^)(void))completionHandler 484 495 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
r246360 r246449 68 68 - (bool)_hasRegisteredServiceWorker WK_API_AVAILABLE(macos(10.14), ios(12.0)); 69 69 70 - (void)_scheduleCookieBlockingUpdate:(void (^)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 70 71 - (void)_setPrevalentDomain:(NSURL *)domain completionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 71 72 - (void)_getIsPrevalentDomain:(NSURL *)domain completionHandler:(void (^)(BOOL))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Tools/ChangeLog
r246434 r246449 1 2019-06-14 Youenn Fablet <youenn@apple.com> 2 3 WebResourceLoadStatisticsStore should not use its network session if invalidated 4 https://bugs.webkit.org/show_bug.cgi?id=198814 5 6 Reviewed by Geoffrey Garen. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm: 9 (TEST): 10 1 11 2019-06-14 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm
r246360 r246449 29 29 #import "TestNavigationDelegate.h" 30 30 #import <WebKit/WKFoundation.h> 31 #import <WebKit/WKPreferencesPrivate.h> 31 32 #import <WebKit/WKProcessPoolPrivate.h> 32 33 #import <WebKit/WKWebViewConfigurationPrivate.h> 33 34 #import <WebKit/WKWebsiteDataRecordPrivate.h> 34 35 #import <WebKit/WKWebsiteDataStorePrivate.h> 36 #import <WebKit/_WKWebsiteDataStoreConfiguration.h> 35 37 #import <wtf/RetainPtr.h> 36 38 … … 282 284 } 283 285 286 TEST(ResourceLoadStatistics, RemoveSessionID) 287 { 288 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 289 auto websiteDataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]); 290 configuration.get().websiteDataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:websiteDataStoreConfiguration.get()] autorelease]; 291 292 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); 293 294 // We load a resource so that the NetworkSession stays alive a little bit longer after the session is removed. 295 296 [webView loadHTMLString:@"<a id='link' href='http://webkit.org' download>Click me!</a>" baseURL:[NSURL URLWithString:@"http://webkit.org"]]; 297 [webView _test_waitForDidFinishNavigation]; 298 299 static bool doneFlag = false; 300 [webView evaluateJavaScript:@"document.getElementById('link').click();" completionHandler: ^(id, NSError*) { 301 doneFlag = true; 302 }]; 303 TestWebKitAPI::Util::run(&doneFlag); 304 305 [configuration.get().websiteDataStore _setResourceLoadStatisticsEnabled:YES]; 306 [configuration.get().websiteDataStore _setResourceLoadStatisticsDebugMode:YES]; 307 308 // Trigger ITP tasks. 309 [configuration.get().websiteDataStore _scheduleCookieBlockingUpdate: ^(void) { }]; 310 // Trigger removing of the sessionID. 311 TestWebKitAPI::Util::spinRunLoop(2); 312 [webView _close]; 313 webView = nullptr; 314 configuration = nullptr; 315 316 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 317 [webView2 loadHTMLString:@"WebKit Test" baseURL:[NSURL URLWithString:@"http://webkit.org"]]; 318 [webView2 _test_waitForDidFinishNavigation]; 319 }
Note: See TracChangeset
for help on using the changeset viewer.