Move SOAuthorization from WebKitAdditions to WebKit
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jun 2019 20:40:08 +0000 (20:40 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jun 2019 20:40:08 +0000 (20:40 +0000)
commit0ae2114fdbea776e836147a33bf540f1b8e929a3
tree73c24f54606a069e3e7a75f28ed5c36a6fb45a8e
parent7a887a5d8fff661efaad4a4e32f2a4d70e5611b0
Move SOAuthorization from WebKitAdditions to WebKit
https://bugs.webkit.org/show_bug.cgi?id=198874
<rdar://problem/47573431>

Reviewed by Brent Fulgham.

Source/WebCore/PAL:

This patch moves AppSSOSoftLink from WebKitAdditions to WebKit, and introduces
AuthKitSPI.h.

* PAL.xcodeproj/project.pbxproj:
* pal/cocoa/AppSSOSoftLink.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* pal/cocoa/AppSSOSoftLink.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* pal/spi/cf/CFNetworkSPI.h:
* pal/spi/cocoa/AuthKitSPI.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.

Source/WebKit:

This patch basically moves everything from existing WebKitAdditions to WebKit.
It also replaces the LoadOptimizer nonsense with the actual SOAuthorization API.

* Configurations/WebKit.xcconfig:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializePluginProcess):
* SourcesCocoa.txt:
* UIProcess/API/APINavigationAction.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::trySOAuthorization):
(WebKit::tryInterceptNavigation):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
(WebKit::tryOptimizingLoad): Deleted.
* UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h: Added.
(WebKit::NavigationSOAuthorizationSession::callback):
* UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
(WebKit::NavigationSOAuthorizationSession::NavigationSOAuthorizationSession):
(WebKit::NavigationSOAuthorizationSession::~NavigationSOAuthorizationSession):
(WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
(WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h: Added.
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm: Added.
(-[WKSOSecretDelegate initWithSession:]):
(-[WKSOSecretDelegate webViewDidClose:]):
(-[WKSOSecretDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[WKSOSecretDelegate webView:didFinishNavigation:]):
(WebKit::PopUpSOAuthorizationSession::PopUpSOAuthorizationSession):
(WebKit::PopUpSOAuthorizationSession::~PopUpSOAuthorizationSession):
(WebKit::PopUpSOAuthorizationSession::shouldStartInternal):
(WebKit::PopUpSOAuthorizationSession::fallBackToWebPathInternal):
(WebKit::PopUpSOAuthorizationSession::abortInternal):
(WebKit::PopUpSOAuthorizationSession::completeInternal):
(WebKit::PopUpSOAuthorizationSession::close):
(WebKit::PopUpSOAuthorizationSession::initSecretWebView):
* UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: Added.
(WebKit::RedirectSOAuthorizationSession::RedirectSOAuthorizationSession):
(WebKit::RedirectSOAuthorizationSession::fallBackToWebPathInternal):
(WebKit::RedirectSOAuthorizationSession::abortInternal):
(WebKit::RedirectSOAuthorizationSession::completeInternal):
(WebKit::RedirectSOAuthorizationSession::beforeStart):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm: Added.
(WebKit::SOAuthorizationCoordinator::SOAuthorizationCoordinator):
(WebKit::SOAuthorizationCoordinator::canAuthorize const):
(WebKit::SOAuthorizationCoordinator::tryAuthorize):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
(+[NSURL _web_canPerformAuthorizationWithURL:]):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: Added.
(WebKit::SOAuthorizationSession::page const):
(WebKit::SOAuthorizationSession::state const):
(WebKit::SOAuthorizationSession::setState):
(WebKit::SOAuthorizationSession::navigationAction):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: Added.
(WebKit::SOAuthorizationSession::SOAuthorizationSession):
(WebKit::SOAuthorizationSession::~SOAuthorizationSession):
(WebKit::SOAuthorizationSession::releaseNavigationAction):
(WebKit::SOAuthorizationSession::becomeCompleted):
(WebKit::SOAuthorizationSession::shouldStart):
(WebKit::SOAuthorizationSession::start):
(WebKit::SOAuthorizationSession::fallBackToWebPath):
(WebKit::SOAuthorizationSession::abort):
(WebKit::SOAuthorizationSession::complete):
(WebKit::SOAuthorizationSession::presentViewController):
(WebKit::SOAuthorizationSession::dismissViewController):
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm: Added.
(WebKit::SubFrameSOAuthorizationSession::SubFrameSOAuthorizationSession):
(WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
(WebKit::SubFrameSOAuthorizationSession::abortInternal):
(WebKit::SubFrameSOAuthorizationSession::completeInternal):
(WebKit::SubFrameSOAuthorizationSession::beforeStart):
(WebKit::SubFrameSOAuthorizationSession::loadDataToFrame):
(WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent):
* UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
* UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm: Added.
(-[WKSOAuthorizationDelegate authorization:presentViewController:withCompletion:]):
(-[WKSOAuthorizationDelegate authorizationDidNotHandle:]):
(-[WKSOAuthorizationDelegate authorizationDidCancel:]):
(-[WKSOAuthorizationDelegate authorizationDidComplete:]):
(-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPAuthorizationHeaders:]):
(-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPResponse:httpBody:]):
(-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]):
(-[WKSOAuthorizationDelegate setSession:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::trySOAuthorization):
(WebKit::WebPageProxy::createNewPage):
(WebKit::tryOptimizingLoad): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInAllNavigationPolicyDecision):
(WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::soAuthorizationCoordinator):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeProcess):

Source/WTF:

* wtf/Platform.h:
Adds a feature flag to detect AppSSO framework.

Tools:

This patch moves all SOAuthorization tests from WebKitAdditions to WebKit.

* TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm: Added.
(-[TestSOAuthorizationNavigationDelegate init]):
(-[TestSOAuthorizationNavigationDelegate webView:didFinishNavigation:]):
(-[TestSOAuthorizationNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[TestSOAuthorizationNavigationDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
(-[TestSOAuthorizationViewController viewDidAppear]):
(-[TestSOAuthorizationViewController viewDidDisappear]):
(overrideCanPerformAuthorizationWithURL):
(overrideSetDelegate):
(overrideBeginAuthorizationWithURL):
(overrideCancelAuthorization):
(overrideAddObserverForName):
(overrideIsURLFromAppleOwnedDomain):
(resetState):
(configureSOAuthorizationWebView):
(generateHtml):
(checkAuthorizationOptions):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
41 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/cocoa/AppSSOSoftLink.h [new file with mode: 0644]
Source/WebCore/PAL/pal/cocoa/AppSSOSoftLink.mm [new file with mode: 0644]
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebCore/PAL/pal/spi/cocoa/AuthKitSPI.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/PluginProcess/mac/PluginProcessMac.mm
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/APINavigationAction.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h [moved from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm with 86% similarity]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm [new file with mode: 0644]
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm [new file with mode: 0644]