Changeset 259655 in webkit
- Timestamp:
- Apr 7, 2020, 11:43:45 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259648 r259655 1 2020-04-07 Kate Cheney <katherine_cheney@apple.com> 2 3 Return app-bound sessions for instances where WKAppBoundDomains is 4 empty 5 https://bugs.webkit.org/show_bug.cgi?id=210124 6 <rdar://problem/61276630> 7 8 Reviewed by Brent Fulgham. 9 10 No new tests. Behavior confirmed by existing In-App Browser Privacy 11 tests. 12 13 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 14 (WebKit::NetworkSessionCocoa::sessionWrapperForTask): 15 Remove the flag checking if In-App Browser Privacy is enabled. We 16 should return an app-bound session if WKAppBoundDomains is empty so 17 we no longer need to check the flag here. 18 19 * UIProcess/WebPageProxy.cpp: 20 (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain): 21 (WebKit::WebPageProxy::decidePolicyForNavigationAction): 22 * UIProcess/WebPageProxy.h: 23 As described above, we no longer need to check the flag in this 24 instance as we are determining behavior based on the WKAppBoundDomains 25 list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain, 26 so it should take an Optional (WTF::nullopt indicates an empty list). 27 28 * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: 29 (WebKit::WebsiteDataStore::initializeAppBoundDomains): 30 Use the flag to enable internal debugging for testing purposes. 31 32 * UIProcess/API/APIHTTPCookieStore.cpp: 33 (API::HTTPCookieStore::filterAppBoundCookies): 34 Flag no longer needed. This should be gated by whether the domains 35 list is empty or not. 36 1 37 2020-04-07 Per Arne Vollan <pvollan@apple.com> 2 38 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r259076 r259655 64 64 #else 65 65 #define NETWORK_SESSION_COCOA_ADDITIONS_1 66 #define NETWORK_SESSION_COCOA_ADDITIONS_2 false67 66 #endif 68 67 … … 1212 1211 #endif 1213 1212 1214 if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes) { 1215 if (m_isInAppBrowserPrivacyEnabled || NETWORK_SESSION_COCOA_ADDITIONS_2) 1216 return appBoundSession(storedCredentialsPolicy); 1217 } 1213 if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::Yes) 1214 return appBoundSession(storedCredentialsPolicy); 1218 1215 1219 1216 switch (storedCredentialsPolicy) { -
trunk/Source/WebKit/UIProcess/API/APIHTTPCookieStore.cpp
r259520 r259655 39 39 #include <WebKitAdditions/HTTPCookieStoreAdditions.h> 40 40 #else 41 #define IN_APP_BROWSER_PRIVACY_ENABLED false42 41 #define IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED 43 42 #endif … … 67 66 Vector<WebCore::Cookie> appBoundCookies; 68 67 #if PLATFORM(IOS_FAMILY) 69 m_owningDataStore->getAppBoundDomains([ this, protectedThis = makeRef(*this),cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable {70 if ( m_owningDataStore->parameters().networkSessionParameters.isInAppBrowserPrivacyEnabled || IN_APP_BROWSER_PRIVACY_ENABLED) {68 m_owningDataStore->getAppBoundDomains([cookies, appBoundCookies = WTFMove(appBoundCookies), completionHandler = WTFMove(completionHandler)] (auto& domains) mutable { 69 if (!domains.isEmpty()) { 71 70 IMPLEMENT_IN_APP_BROWSER_PRIVACY_ENABLED 72 71 for (auto& cookie : cookies) { -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r259615 r259655 283 283 #else 284 284 #define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN 285 #define WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2 false286 285 #endif 287 286 … … 3120 3119 }; 3121 3120 3122 void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, NavigatingToAppBoundDomainisNavigatingToAppBoundDomain)3121 void WebPageProxy::setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL& requestURL, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) 3123 3122 { 3124 3123 #if PLATFORM(IOS_FAMILY) 3125 if (isMainFrame && (m_preferences->isInAppBrowserPrivacyEnabled() || WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN_2)) { 3124 if (isMainFrame) { 3125 WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN 3126 if (!isNavigatingToAppBoundDomain) { 3127 m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::Yes; 3128 return; 3129 } 3126 3130 if (m_ignoresAppBoundDomains) 3127 3131 return; 3128 WEB_PAGE_PROXY_ADDITIONS_SETISNAVIGATINGTOAPPBOUNDDOMAIN 3129 if (isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) { 3132 if (*isNavigatingToAppBoundDomain == NavigatingToAppBoundDomain::No) { 3130 3133 m_configuration->setWebViewCategory(WebViewCategory::InAppBrowser); 3131 3134 m_isNavigatingToAppBoundDomain = NavigatingToAppBoundDomain::No; … … 5106 5109 auto listener = makeRef(frame.setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(frame), sender = WTFMove(sender), navigation] (PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isAppBoundDomain) mutable { 5107 5110 5108 if (policyAction != PolicyAction::Ignore && isAppBoundDomain)5109 setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), *isAppBoundDomain);5111 if (policyAction != PolicyAction::Ignore) 5112 setIsNavigatingToAppBoundDomain(frame->isMainFrame(), navigation->currentRequest().url(), isAppBoundDomain); 5110 5113 5111 5114 auto completionHandler = [this, protectedThis = protectedThis.copyRef(), frame = frame.copyRef(), sender = WTFMove(sender), navigation, processSwapRequestedByClient, policies = makeRefPtr(policies)] (PolicyAction policyAction) mutable { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r259523 r259655 2283 2283 void makeStorageSpaceRequest(WebCore::FrameIdentifier, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, CompletionHandler<void(uint64_t)>&&); 2284 2284 2285 void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, NavigatingToAppBoundDomain);2285 void setIsNavigatingToAppBoundDomain(bool isMainFrame, const URL&, Optional<NavigatingToAppBoundDomain>); 2286 2286 NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; } 2287 2287 -
trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
r259615 r259655 404 404 static const auto maxAppBoundDomainCount = 10; 405 405 406 appBoundDomainQueue().dispatch([ forceReinitialization] () mutable {406 appBoundDomainQueue().dispatch([isInAppBrowserPrivacyEnabled = parameters().networkSessionParameters.isInAppBrowserPrivacyEnabled, forceReinitialization] () mutable { 407 407 if (hasInitializedAppBoundDomains && forceReinitialization != ForceReinitialization::Yes) 408 408 return; … … 410 410 NSArray<NSString *> *domains = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WKAppBoundDomains"]; 411 411 412 RunLoop::main().dispatch([ forceReinitialization, domains = retainPtr(domains)] {412 RunLoop::main().dispatch([isInAppBrowserPrivacyEnabled, forceReinitialization, domains = retainPtr(domains)] { 413 413 if (forceReinitialization == ForceReinitialization::Yes) 414 414 appBoundDomains().clear(); … … 427 427 break; 428 428 } 429 WEBSITE_DATA_STORE_ADDITIONS 429 if (isInAppBrowserPrivacyEnabled) 430 WEBSITE_DATA_STORE_ADDITIONS 430 431 hasInitializedAppBoundDomains = true; 431 432 }); -
trunk/Tools/ChangeLog
r259650 r259655 1 2020-04-07 Kate Cheney <katherine_cheney@apple.com> 2 3 Return app-bound sessions for instances where WKAppBoundDomains is 4 empty 5 https://bugs.webkit.org/show_bug.cgi?id=210124 6 <rdar://problem/61276630> 7 8 Reviewed by Brent Fulgham. 9 10 Cleaned up tests to turn the flag on at the start of each In-App 11 Browser Privacy test. 12 13 * TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm: 14 (cleanUpInAppBrowserPrivacyTestSettings): 15 (initializeInAppBrowserPrivacyTestSettings): 16 (TEST): 17 1 18 2020-04-07 Timothy Hatcher <timothy@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm
r259520 r259655 82 82 static void cleanUpInAppBrowserPrivacyTestSettings() 83 83 { 84 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"]; 84 85 IN_APP_BROWSER_PRIVACY_ADDITIONS_2 85 86 } … … 87 88 static void initializeInAppBrowserPrivacyTestSettings() 88 89 { 90 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"]; 89 91 RunLoop::initializeMainRunLoop(); 90 92 WebCore::clearApplicationBundleIdentifierTestingOverride(); … … 537 539 { 538 540 initializeInAppBrowserPrivacyTestSettings(); 539 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];540 541 541 542 auto dataStore = [WKWebsiteDataStore defaultDataStore]; … … 582 583 583 584 cleanUpInAppBrowserPrivacyTestSettings(); 584 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];585 585 gotFlag = false; 586 586 … … 608 608 // Since we can't set non-app-bound cookies with In-App Browser privacy protections on, 609 609 // we can turn the protections off to set a cookie we will then try to get with protections enabled. 610 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];610 cleanUpInAppBrowserPrivacyTestSettings(); 611 611 612 612 setUpCookieTest(); … … 659 659 660 660 // Now enable protections and ensure we can only retrieve the app-bound cookies. 661 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];662 661 initializeInAppBrowserPrivacyTestSettings(); 663 662 … … 684 683 [globalCookieStore deleteCookie:appBoundCookie.get() completionHandler:[]() { 685 684 // Reset flag. 686 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];687 685 cleanUpInAppBrowserPrivacyTestSettings(); 688 686 gotFlag = true; … … 696 694 // Since we can't set non-app-bound cookies with In-App Browser privacy protections on, 697 695 // we can turn the protections off to set a cookie we will then try to get with protections enabled. 698 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];696 cleanUpInAppBrowserPrivacyTestSettings(); 699 697 setUpCookieTest(); 700 698 … … 721 719 722 720 // Now enable protections and ensure we can only retrieve the app-bound cookies. 723 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];724 721 initializeInAppBrowserPrivacyTestSettings(); 725 722 … … 731 728 [globalCookieStore deleteCookie:nonAppBoundCookie completionHandler:^{ 732 729 [globalCookieStore deleteCookie:appBoundCookie completionHandler:^{ 733 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDebugIsInAppBrowserPrivacyEnabled"];734 730 cleanUpInAppBrowserPrivacyTestSettings(); 735 731 done = true;
Note:
See TracChangeset
for help on using the changeset viewer.