Changeset 250729 in webkit
- Timestamp:
- Oct 4, 2019 9:50:01 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 24 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250728 r250729 1 2019-10-04 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Implement _WKWebAuthenticationPanel SPI 4 https://bugs.webkit.org/show_bug.cgi?id=202559 5 <rdar://problem/55932094> 6 7 Reviewed by Brent Fulgham. 8 9 This patch implements _WKWebAuthenticationPanel SPI. Here is the structure: 10 1) API::WebAuthenticationPanel is the APIObject of _WKWebAuthenticationPanel. It is owned by AuthenticatorManager. 11 The lifetime of _WKWebAuthenticationPanel on the other hand is managed by clients. This binding is the surface 12 where clients could interact with WebKit's WebAuthentication implementation. 13 2) API::WebAuthenticationPanelClient is a base class representing _WKWebAuthenticationPanelDelegate. Its subclass 14 WebKit::WebAuthenticationPanelClient implements bridges to _WKWebAuthenticationPanelDelegate methods. It is owned by 15 API::WebAuthenticationPanel. A weak pointer of WebKit::WebAuthenticationPanelClient is kept in _WKWebAuthenticationPanel 16 to get the _WKWebAuthenticationPanelDelegate set by clients or nil otherwise. This binding is the surface where WebKit 17 interacts with clients. 18 3) WebAuthenticationPanelFlags is the mirror of enums within _WKWebAuthenticationPanel. 19 20 Implementation wise, this patch implements: 21 1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:], this is bridged from 22 the regular UIDelegate route. Noted, WKFrameInfo is nil for now, a follow up on Bug 202563 will take care of it. This 23 will be called from AuthenticatorManager::runPanel() which gates the start of discovery on the callback. For clients 24 that don't implement the delegate, the callback will always be called with _WKWebAuthenticationPanelResultUnavailable 25 to allow WebKit run on non-UI mode. A specific C API hack is added to always return _WKWebAuthenticationPanelResultPresented 26 in WebKitTestRunner for layout tests. 27 2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] will be implemented in Bug 200932. 28 3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:], this is bridged from 29 API::WebAuthenticationPanel/API::WebAuthenticationPanelClient. This will be called whenever AuthenticatorManager::m_pendingCompletionHandler 30 is invoked. Depending on the respond, _WKWebAuthenticationResult will be returned accordingly. To facilitate that, 31 invokePendingCompletionHandler is crafted to bundle those two operations. 32 4) -[_WKWebAuthenticationPanel cancel] will be implemented in Bug 191523. 33 34 Besides the above, this patch also silents the NFC action sheet. 35 36 * Platform/spi/Cocoa/NearFieldSPI.h: 37 * Shared/API/APIObject.h: 38 * Shared/Cocoa/APIObject.mm: 39 (API::Object::newObject): 40 * Sources.txt: 41 * SourcesCocoa.txt: 42 * UIProcess/API/APIUIClient.h: 43 (API::UIClient::runWebAuthenticationPanel): 44 * UIProcess/API/APIWebAuthenticationPanel.cpp: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm. 45 (API::WebAuthenticationPanel::create): 46 (API::WebAuthenticationPanel::WebAuthenticationPanel): 47 (API::WebAuthenticationPanel::setClient): 48 * UIProcess/API/APIWebAuthenticationPanel.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h. 49 * UIProcess/API/APIWebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h. 50 (API::WebAuthenticationPanelClient::dismissPanel const): 51 * UIProcess/API/C/WKPage.cpp: 52 (WKPageSetPageUIClient): 53 * UIProcess/API/C/WKPageUIClient.h: 54 * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: 55 (-[_WKWebAuthenticationPanel dealloc]): 56 (-[_WKWebAuthenticationPanel relyingPartyID]): 57 (-[_WKWebAuthenticationPanel delegate]): 58 (-[_WKWebAuthenticationPanel setDelegate:]): 59 (-[_WKWebAuthenticationPanel _apiObject]): 60 (-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]): Deleted. 61 * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: 62 * UIProcess/Cocoa/UIDelegate.h: 63 * UIProcess/Cocoa/UIDelegate.mm: 64 (WebKit::UIDelegate::setDelegate): 65 (WebKit::webAuthenticationPanelResult): 66 (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel): 67 * UIProcess/WebAuthentication/AuthenticatorManager.cpp: 68 (WebKit::WebCore::isFeatureEnabled): 69 (WebKit::WebCore::getRpId): 70 (WebKit::AuthenticatorManager::handleRequest): 71 (WebKit::AuthenticatorManager::respondReceived): 72 (WebKit::AuthenticatorManager::startDiscovery): 73 (WebKit::AuthenticatorManager::initTimeOutTimer): 74 (WebKit::AuthenticatorManager::timeOutTimerFired): 75 (WebKit::AuthenticatorManager::runPanel): 76 (WebKit::AuthenticatorManager::startRequest): 77 (WebKit::AuthenticatorManager::invokePendingCompletionHandler): 78 (WebKit::AuthenticatorManagerInternal::collectTransports): Deleted. 79 (WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension): Deleted. 80 * UIProcess/WebAuthentication/AuthenticatorManager.h: 81 (WebKit::AuthenticatorManager::pendingCompletionHandler): Deleted. 82 * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: 83 (WebKit::NfcConnection::NfcConnection): 84 * UIProcess/WebAuthentication/Cocoa/NfcService.mm: 85 (WebKit::NfcService::platformStartDiscovery): 86 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h. 87 * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp. 88 (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient): 89 (WebKit::wkWebAuthenticationResult): 90 (WebKit::WebAuthenticationPanelClient::dismissPanel const): 91 * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: 92 (WebKit::MockAuthenticatorManager::respondReceivedInternal): 93 * UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h. 94 * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: 95 * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: 96 (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): 97 (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): 98 * WebKit.xcodeproj/project.pbxproj: 99 1 100 2019-10-04 Alex Christensen <achristensen@webkit.org> 2 101 -
trunk/Source/WebKit/Platform/spi/Cocoa/NearFieldSPI.h
r249059 r250729 109 109 @interface NFHardwareManager : NSObject 110 110 + (instancetype)sharedHardwareManager; 111 - (NSObject<NFSession> *)startReaderSession WithActionSheetUI:(void(^)(NFReaderSession *session, NSError *error))theStartCallback;111 - (NSObject<NFSession> *)startReaderSession:(void(^)(NFReaderSession *session, NSError *error))theStartCallback; 112 112 - (BOOL)areFeaturesSupported:(NFFeature)featureMask outError:(NSError**)outError; 113 113 @end -
trunk/Source/WebKit/Shared/API/APIObject.h
r246856 r250729 179 179 #endif 180 180 181 #if ENABLE(WEB_AUTHN) 182 WebAuthenticationPanel, 183 #endif 184 181 185 // Bundle types 182 186 Bundle, -
trunk/Source/WebKit/Shared/Cocoa/APIObject.mm
r247281 r250729 85 85 #import "_WKUserStyleSheetInternal.h" 86 86 #import "_WKVisitedLinkStoreInternal.h" 87 #import "_WKWebAuthenticationPanelInternal.h" 87 88 #import "_WKWebsiteDataStoreConfigurationInternal.h" 88 89 … … 365 366 break; 366 367 368 #if ENABLE(WEB_AUTHN) 369 case Type::WebAuthenticationPanel: 370 wrapper = [_WKWebAuthenticationPanel alloc]; 371 break; 372 #endif 373 367 374 case Type::BundleFrame: 368 375 wrapper = [WKWebProcessPlugInFrame alloc]; -
trunk/Source/WebKit/Sources.txt
r250169 r250729 319 319 UIProcess/API/APIUserScript.cpp 320 320 UIProcess/API/APIUserStyleSheet.cpp 321 UIProcess/API/APIWebAuthenticationPanel.cpp 321 322 UIProcess/API/APIWebsitePolicies.cpp 322 323 UIProcess/API/APIWindowFeatures.cpp -
trunk/Source/WebKit/SourcesCocoa.txt
r250658 r250729 504 504 UIProcess/WebAuthentication/Cocoa/NfcService.mm 505 505 UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm 506 UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm 506 507 507 508 UIProcess/WebAuthentication/Mock/MockLocalConnection.mm -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r248762 r250729 39 39 #endif 40 40 41 #if ENABLE(WEB_AUTHN) 42 #include "WebAuthenticationPanelFlags.h" 43 #endif 44 41 45 namespace WebCore { 42 46 class RegistrableDomain; … … 70 74 class OpenPanelParameters; 71 75 class SecurityOrigin; 76 #if ENABLE(WEB_AUTHN) 77 class WebAuthenticationPanel; 78 #endif 72 79 73 80 class UIClient { … … 189 196 190 197 virtual void didShowSafeBrowsingWarning() { } 198 199 #if ENABLE(WEB_AUTHN) 200 virtual void runWebAuthenticationPanel(WebKit::WebPageProxy&, WebAuthenticationPanel&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) { completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable); } 201 #endif 191 202 }; 192 203 -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp
r250728 r250729 24 24 */ 25 25 26 #i mport"config.h"27 #i mport "_WKWebAuthenticationPanelInternal.h"26 #include "config.h" 27 #include "APIWebAuthenticationPanel.h" 28 28 29 #i mport <wtf/RetainPtr.h>29 #if ENABLE(WEB_AUTHN) 30 30 31 @implementation _WKWebAuthenticationPanel { 32 RetainPtr<NSString> _relyingPartyID; 31 #include "APIWebAuthenticationPanelClient.h" 32 33 namespace API { 34 35 Ref<WebAuthenticationPanel> WebAuthenticationPanel::create(const String& rpId) 36 { 37 return adoptRef(*new WebAuthenticationPanel(rpId)); 33 38 } 34 39 35 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID 36 { 37 if (!(self = [super init])) 38 return nil; 39 _relyingPartyID = relayingPartyID; 40 return self; 41 } 42 43 - (NSString *)relyingPartyID 44 { 45 return _relyingPartyID.get(); 46 } 47 48 - (void)cancel 40 WebAuthenticationPanel::WebAuthenticationPanel(const String& rpId) 41 : m_rpId(rpId) 42 , m_client(WTF::makeUniqueRef<WebAuthenticationPanelClient>()) 49 43 { 50 44 } 51 45 52 @end 46 WebAuthenticationPanel::~WebAuthenticationPanel() = default; 47 48 void WebAuthenticationPanel::setClient(UniqueRef<WebAuthenticationPanelClient>&& client) 49 { 50 m_client = WTFMove(client); 51 } 52 53 } // namespace API 54 55 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h
r250728 r250729 1 1 /* 2 * Copyright (C) 201 8Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "WebPreferences.h" 31 #include <WebCore/PublicKeyCredentialCreationOptions.h> 32 #include <WebCore/PublicKeyCredentialRequestOptions.h> 33 #include <wtf/Variant.h> 34 #include <wtf/Vector.h> 30 #include "APIObject.h" 31 #include <wtf/UniqueRef.h> 32 #include <wtf/WeakPtr.h> 33 #include <wtf/text/WTFString.h> 35 34 36 namespace WebKit{35 namespace API { 37 36 38 struct WebAuthenticationRequestData { 39 Vector<uint8_t> hash; 40 Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options; 41 RefPtr<WebPreferences> preferences; 37 class WebAuthenticationPanelClient; 38 39 class WebAuthenticationPanel final : public ObjectImpl<Object::Type::WebAuthenticationPanel>, public CanMakeWeakPtr<WebAuthenticationPanel> { 40 public: 41 static Ref<WebAuthenticationPanel> create(const String& rpId); 42 ~WebAuthenticationPanel(); 43 44 WTF::String rpId() const { return m_rpId; } 45 46 const WebAuthenticationPanelClient& client() const { return m_client.get(); } 47 void setClient(UniqueRef<WebAuthenticationPanelClient>&&); 48 49 private: 50 WebAuthenticationPanel(const String& rpId); 51 52 WTF::String m_rpId; 53 UniqueRef<WebAuthenticationPanelClient> m_client; 42 54 }; 43 55 44 } // namespace WebKit56 } // namespace API 45 57 46 58 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanelClient.h
r250728 r250729 26 26 #pragma once 27 27 28 #i mport "_WKWebAuthenticationPanel.h"28 #if ENABLE(WEB_AUTHN) 29 29 30 @interface _WKWebAuthenticationPanel () 30 namespace WebKit { 31 enum class WebAuthenticationResult : bool; 32 } 31 33 32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID; 34 namespace API { 33 35 34 @end 36 class WebAuthenticationPanelClient { 37 WTF_MAKE_FAST_ALLOCATED; 38 public: 39 virtual ~WebAuthenticationPanelClient() = default; 40 41 virtual void dismissPanel(WebKit::WebAuthenticationResult) const { } 42 }; 43 44 } // namespace API 45 46 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r249275 r250729 117 117 118 118 template<> struct ClientTraits<WKPageUIClientBase> { 119 typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11, WKPageUIClientV12, WKPageUIClientV13 > Versions;119 typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11, WKPageUIClientV12, WKPageUIClientV13, WKPageUIClientV14> Versions; 120 120 }; 121 121 … … 2074 2074 m_client.handleAutoplayEvent(toAPI(&page), toWKAutoplayEvent(event), toWKAutoplayEventFlags(flags), m_client.base.clientInfo); 2075 2075 } 2076 2077 #if ENABLE(WEB_AUTHN) 2078 // The current method is specialized for WebKitTestRunner. 2079 void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) final 2080 { 2081 if (!m_client.runWebAuthenticationPanel) { 2082 completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable); 2083 return; 2084 } 2085 completionHandler(WebKit::WebAuthenticationPanelResult::Presented); 2086 } 2087 #endif 2076 2088 }; 2077 2089 -
trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h
r248797 r250729 137 137 typedef bool (*WKPageShouldAllowDeviceOrientationAndMotionAccessCallback)(WKPageRef page, WKSecurityOriginRef securityOrigin, const void *clientInfo); 138 138 139 typedef void (*WKPageRunWebAuthenticationPanelCallback)(); 140 139 141 // Deprecated 140 142 typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); … … 1246 1248 } WKPageUIClientV13; 1247 1249 1250 typedef struct WKPageUIClientV14 { 1251 WKPageUIClientBase base; 1252 1253 // Version 0. 1254 WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; 1255 WKPageUIClientCallback showPage; 1256 WKPageUIClientCallback close; 1257 WKPageTakeFocusCallback takeFocus; 1258 WKPageFocusCallback focus; 1259 WKPageUnfocusCallback unfocus; 1260 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; 1261 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; 1262 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; 1263 WKPageSetStatusTextCallback setStatusText; 1264 WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; 1265 WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; 1266 WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; 1267 WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; 1268 WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; 1269 WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; 1270 WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; 1271 WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; 1272 WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; 1273 WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; 1274 WKPageGetIsResizableCallback isResizable; 1275 WKPageSetIsResizableCallback setIsResizable; 1276 WKPageGetWindowFrameCallback getWindowFrame; 1277 WKPageSetWindowFrameCallback setWindowFrame; 1278 WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel_deprecatedForUseWithV6; 1279 WKPageUIClientCallback didDraw; 1280 WKPageUIClientCallback pageDidScroll; 1281 WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; 1282 WKPageRunOpenPanelCallback runOpenPanel; 1283 WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; 1284 WKPageHeaderHeightCallback headerHeight; 1285 WKPageFooterHeightCallback footerHeight; 1286 WKPageDrawHeaderCallback drawHeader; 1287 WKPageDrawFooterCallback drawFooter; 1288 WKPagePrintFrameCallback printFrame; 1289 WKPageUIClientCallback runModal; 1290 void* unused1; // Used to be didCompleteRubberBandForMainFrame 1291 WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; 1292 void* shouldInterruptJavaScript_unavailable; 1293 1294 // Version 1. 1295 WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage_deprecatedForUseWithV1; 1296 WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; 1297 WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; 1298 WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; 1299 1300 // Version 2. 1301 WKPageShowColorPickerCallback showColorPicker; 1302 WKPageHideColorPickerCallback hideColorPicker; 1303 WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; 1304 1305 // Version 3. 1306 WKPagePinnedStateDidChangeCallback pinnedStateDidChange; 1307 1308 // Version 4. 1309 void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. 1310 void* unused3; // Used to be didRecognizeLongMousePress. 1311 void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. 1312 WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; 1313 1314 // Version 5. 1315 WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; 1316 WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; 1317 WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert_deprecatedForUseWithV5; 1318 WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm_deprecatedForUseWithV5; 1319 WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt_deprecatedForUseWithV5; 1320 WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; 1321 1322 // Version 6. 1323 WKPageCreateNewPageCallback createNewPage; 1324 WKPageRunJavaScriptAlertCallback runJavaScriptAlert; 1325 WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; 1326 WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; 1327 WKCheckUserMediaPermissionCallback checkUserMediaPermissionForOrigin; 1328 1329 // Version 7. 1330 WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; 1331 WKFullscreenMayReturnToInlineCallback fullscreenMayReturnToInline; 1332 1333 // Version 8. 1334 WKRequestPointerLockCallback requestPointerLock; 1335 WKDidLosePointerLockCallback didLosePointerLock; 1336 1337 // Version 9. 1338 WKHandleAutoplayEventCallback handleAutoplayEvent; 1339 1340 // Version 10. 1341 WKHasVideoInPictureInPictureDidChangeCallback hasVideoInPictureInPictureDidChange; 1342 WKDidExceedBackgroundResourceLimitWhileInForegroundCallback didExceedBackgroundResourceLimitWhileInForeground; 1343 1344 // Version 11. 1345 WKPageDidResignInputElementStrongPasswordAppearanceCallback didResignInputElementStrongPasswordAppearance; 1346 1347 // Version 12. 1348 WKPageRequestStorageAccessConfirmCallback requestStorageAccessConfirm; 1349 1350 // Version 13. 1351 WKPageShouldAllowDeviceOrientationAndMotionAccessCallback shouldAllowDeviceOrientationAndMotionAccess; 1352 1353 // Version 14. 1354 WKPageRunWebAuthenticationPanelCallback runWebAuthenticationPanel; 1355 } WKPageUIClientV14; 1356 1248 1357 #ifdef __cplusplus 1249 1358 } -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm
r250658 r250729 25 25 26 26 #import "config.h" 27 #import "WebAuthenticationPanelClient.h" 27 28 #import "_WKWebAuthenticationPanelInternal.h" 28 29 29 30 #import <wtf/RetainPtr.h> 30 31 31 @implementation _WKWebAuthenticationPanel 32 RetainPtr<NSString> _relyingPartyID;32 @implementation _WKWebAuthenticationPanel { 33 WeakPtr<WebKit::WebAuthenticationPanelClient> _client; 33 34 } 34 35 35 - ( instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID36 - (void)dealloc 36 37 { 37 if (!(self = [super init])) 38 return nil; 39 _relyingPartyID = relayingPartyID; 40 return self; 38 _panel->~WebAuthenticationPanel(); 39 40 [super dealloc]; 41 41 } 42 42 43 43 - (NSString *)relyingPartyID 44 44 { 45 return _relyingPartyID.get(); 45 return _panel->rpId(); 46 } 47 48 - (id <_WKWebAuthenticationPanelDelegate>)delegate 49 { 50 if (!_client) 51 return nil; 52 return _client->delegate().autorelease(); 53 } 54 55 - (void)setDelegate:(id<_WKWebAuthenticationPanelDelegate>)delegate 56 { 57 auto client = WTF::makeUniqueRef<WebKit::WebAuthenticationPanelClient>(self, delegate); 58 _client = makeWeakPtr(client.get()); 59 _panel->setClient(WTFMove(client)); 46 60 } 47 61 … … 50 64 } 51 65 66 #pragma mark WKObject protocol implementation 67 68 - (API::Object&)_apiObject 69 { 70 return *_panel; 71 } 72 52 73 @end -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h
r250658 r250729 28 28 #import "_WKWebAuthenticationPanel.h" 29 29 30 @interface _WKWebAuthenticationPanel () 30 #import "APIWebAuthenticationPanel.h" 31 #import "WKObject.h" 31 32 32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID; 33 namespace WebKit { 33 34 35 template<> struct WrapperTraits<API::WebAuthenticationPanel> { 36 using WrapperClass = _WKWebAuthenticationPanel; 37 }; 38 39 } 40 41 @interface _WKWebAuthenticationPanel () <WKObject> { 42 @package 43 API::ObjectStorage<API::WebAuthenticationPanel> _panel; 44 } 34 45 @end -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r243210 r250729 155 155 void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) final; 156 156 void didShowSafeBrowsingWarning() final; 157 #if ENABLE(WEB_AUTHN) 158 void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, CompletionHandler<void(WebAuthenticationPanelResult)>&&) final; 159 #endif 157 160 158 161 UIDelegate& m_uiDelegate; … … 235 238 bool webViewHasVideoInPictureInPictureDidChange : 1; 236 239 bool webViewDidShowSafeBrowsingWarning : 1; 240 #if ENABLE(WEB_AUTHN) 241 bool webViewRunWebAuthenticationPanelInitiatedByFrameCompletionHandler : 1; 242 #endif 237 243 } m_delegateMethods; 238 244 }; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r248846 r250729 53 53 #import "_WKFrameHandleInternal.h" 54 54 #import "_WKHitTestResultInternal.h" 55 #import "_WKWebAuthenticationPanelInternal.h" 55 56 #import <WebCore/FontAttributes.h> 56 57 #import <WebCore/SecurityOriginData.h> … … 173 174 m_delegateMethods.webViewHasVideoInPictureInPictureDidChange = [delegate respondsToSelector:@selector(_webView:hasVideoInPictureInPictureDidChange:)]; 174 175 m_delegateMethods.webViewDidShowSafeBrowsingWarning = [delegate respondsToSelector:@selector(_webViewDidShowSafeBrowsingWarning:)]; 176 #if ENABLE(WEB_AUTHN) 177 m_delegateMethods.webViewRunWebAuthenticationPanelInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:)]; 178 #endif 175 179 } 176 180 … … 1262 1266 } 1263 1267 1268 #if ENABLE(WEB_AUTHN) 1269 1270 static WebAuthenticationPanelResult webAuthenticationPanelResult(_WKWebAuthenticationPanelResult result) 1271 { 1272 switch (result) { 1273 case _WKWebAuthenticationPanelResultUnavailable: 1274 return WebAuthenticationPanelResult::Unavailable; 1275 case _WKWebAuthenticationPanelResultPresented: 1276 return WebAuthenticationPanelResult::Presented; 1277 case _WKWebAuthenticationPanelResultDidNotPresent: 1278 return WebAuthenticationPanelResult::DidNotPresent; 1279 } 1280 ASSERT_NOT_REACHED(); 1281 return WebAuthenticationPanelResult::Unavailable; 1282 } 1283 1284 void UIDelegate::UIClient::runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel& panel, CompletionHandler<void(WebAuthenticationPanelResult)>&& completionHandler) 1285 { 1286 if (!m_uiDelegate.m_delegateMethods.webViewRunWebAuthenticationPanelInitiatedByFrameCompletionHandler) { 1287 completionHandler(WebAuthenticationPanelResult::Unavailable); 1288 return; 1289 } 1290 1291 auto delegate = m_uiDelegate.m_delegate.get(); 1292 if (!delegate) { 1293 completionHandler(WebAuthenticationPanelResult::Unavailable); 1294 return; 1295 } 1296 1297 auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:)); 1298 [(id <WKUIDelegatePrivate>)delegate webView:m_uiDelegate.m_webView runWebAuthenticationPanel:wrapper(panel) initiatedByFrame:nil completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (_WKWebAuthenticationPanelResult result) mutable { 1299 if (checker->completionHandlerHasBeenCalled()) 1300 return; 1301 checker->didCallCompletionHandler(); 1302 completionHandler(webAuthenticationPanelResult(result)); 1303 }).get()]; 1304 } 1305 1306 #endif // ENABLE(WEB_AUTHN) 1307 1264 1308 void UIDelegate::UIClient::hasVideoInPictureInPictureDidChange(WebPageProxy*, bool hasVideoInPictureInPicture) 1265 1309 { -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp
r250659 r250729 29 29 #if ENABLE(WEB_AUTHN) 30 30 31 #include "APIUIClient.h" 32 #include "APIWebAuthenticationPanel.h" 33 #include "APIWebAuthenticationPanelClient.h" 34 #include "WebPageProxy.h" 31 35 #include "WebPreferencesKeys.h" 32 36 #include <WebCore/AuthenticatorTransport.h> … … 37 41 using namespace WebCore; 38 42 39 namespace AuthenticatorManagerInternal{43 namespace { 40 44 41 45 const size_t maxTransportNumber = 3; … … 124 128 } 125 129 126 } // namespace AuthenticatorManagerInternal 130 static bool isFeatureEnabled(WebPageProxy* page, const String& featureKey) 131 { 132 if (!page) 133 return false; 134 return page->preferences().store().getBoolValueForKey(featureKey); 135 } 136 137 static String getRpId(const Variant<PublicKeyCredentialCreationOptions, PublicKeyCredentialRequestOptions>& options) 138 { 139 if (WTF::holds_alternative<PublicKeyCredentialCreationOptions>(options)) 140 return WTF::get<PublicKeyCredentialCreationOptions>(options).rp.id; 141 return WTF::get<PublicKeyCredentialRequestOptions>(options).rpId; 142 } 143 144 } // namespace 127 145 128 146 AuthenticatorManager::AuthenticatorManager() … … 133 151 void AuthenticatorManager::handleRequest(WebAuthenticationRequestData&& data, Callback&& callback) 134 152 { 135 using namespace AuthenticatorManagerInternal;136 137 153 if (m_pendingCompletionHandler) { 138 m_pendingCompletionHandler(ExceptionData { NotAllowedError, "This request has been cancelled by a new request."_s });154 invokePendingCompletionHandler(ExceptionData { NotAllowedError, "This request has been cancelled by a new request."_s }); 139 155 m_requestTimeOutTimer.stop(); 140 156 } … … 145 161 m_pendingCompletionHandler = WTFMove(callback); 146 162 147 // 2. Get available transports and start discovering authenticators on them. 148 WTF::switchOn(m_pendingRequestData.options, [&](const PublicKeyCredentialCreationOptions& options) { 149 initTimeOutTimer(options.timeout); 150 151 auto transports = collectTransports(options.authenticatorSelection); 152 processGoogleLegacyAppIdSupportExtension(options.extensions, transports); 153 startDiscovery(WTFMove(transports)); 154 }, [&](const PublicKeyCredentialRequestOptions& options) { 155 initTimeOutTimer(options.timeout); 156 startDiscovery(collectTransports(options.allowCredentials)); 157 }); 163 // 2. Ask clients to show appropriate UI if any and then start the request. 164 runPanel(); 158 165 } 159 166 … … 196 203 shouldComplete = WTF::get<ExceptionData>(respond).code == InvalidStateError; 197 204 if (shouldComplete) { 198 m_pendingCompletionHandler(WTFMove(respond));205 invokePendingCompletionHandler(WTFMove(respond)); 199 206 clearStateAsync(); 200 207 m_requestTimeOutTimer.stop(); … … 226 233 void AuthenticatorManager::startDiscovery(const TransportSet& transports) 227 234 { 228 using namespace AuthenticatorManagerInternal; 229 230 ASSERT(m_services.isEmpty() && transports.size() <= maxTransportNumber && m_pendingRequestData.preferences); 235 ASSERT(m_services.isEmpty() && transports.size() <= maxTransportNumber); 231 236 for (auto& transport : transports) { 232 if (transport == AuthenticatorTransport::Internal && !m_pendingRequestData.preferences->store().getBoolValueForKey(WebPreferencesKey::webAuthenticationLocalAuthenticatorEnabledKey())) 237 if (transport == AuthenticatorTransport::Internal && !isFeatureEnabled(m_pendingRequestData.page.get(), WebPreferencesKey::webAuthenticationLocalAuthenticatorEnabledKey())) 238 continue; 239 // Only allow USB authenticators when clients don't have dedicated UI. 240 if (transport != AuthenticatorTransport::Usb && (m_pendingRequestData.panelResult == WebAuthenticationPanelResult::Unavailable)) 233 241 continue; 234 242 auto service = createService(transport, *this); … … 240 248 void AuthenticatorManager::initTimeOutTimer(const Optional<unsigned>& timeOutInMs) 241 249 { 242 using namespace AuthenticatorManagerInternal;243 244 250 unsigned timeOutInMsValue = std::min(maxTimeOutValue, timeOutInMs.valueOr(maxTimeOutValue)); 245 251 m_requestTimeOutTimer.startOneShot(Seconds::fromMilliseconds(timeOutInMsValue)); … … 249 255 { 250 256 ASSERT(m_requestTimeOutTimer.isActive()); 251 m_pendingCompletionHandler((ExceptionData { NotAllowedError, "Operation timed out."_s }));257 invokePendingCompletionHandler((ExceptionData { NotAllowedError, "Operation timed out."_s })); 252 258 clearState(); 253 259 } 254 260 261 void AuthenticatorManager::runPanel() 262 { 263 auto* page = m_pendingRequestData.page.get(); 264 if (!page) 265 return; 266 267 m_pendingRequestData.panel = API::WebAuthenticationPanel::create(getRpId(m_pendingRequestData.options)); 268 auto& panel = *m_pendingRequestData.panel; 269 page->uiClient().runWebAuthenticationPanel(*page, panel, [weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) { 270 // The panel address is used to determine if the current pending request is still the same. 271 if (!weakThis || !weakPanel 272 || (result == WebAuthenticationPanelResult::DidNotPresent) 273 || (weakPanel.get() != m_pendingRequestData.panel.get())) 274 return; 275 m_pendingRequestData.panelResult = result; 276 startRequest(); 277 }); 278 } 279 280 void AuthenticatorManager::startRequest() 281 { 282 ASSERT(RunLoop::isMain()); 283 // Get available transports and start discovering authenticators on them. 284 WTF::switchOn(m_pendingRequestData.options, [&](const PublicKeyCredentialCreationOptions& options) { 285 initTimeOutTimer(options.timeout); 286 287 auto transports = collectTransports(options.authenticatorSelection); 288 processGoogleLegacyAppIdSupportExtension(options.extensions, transports); 289 startDiscovery(collectTransports(options.authenticatorSelection)); 290 }, [&](const PublicKeyCredentialRequestOptions& options) { 291 initTimeOutTimer(options.timeout); 292 startDiscovery(collectTransports(options.allowCredentials)); 293 }); 294 } 295 296 void AuthenticatorManager::invokePendingCompletionHandler(Respond&& respond) 297 { 298 if (auto *panel = m_pendingRequestData.panel.get()) { 299 WTF::switchOn(respond, [&](const WebCore::PublicKeyCredentialData&) { 300 panel->client().dismissPanel(WebAuthenticationResult::Succeeded); 301 }, [&](const WebCore::ExceptionData&) { 302 panel->client().dismissPanel(WebAuthenticationResult::Failed); 303 }); 304 } 305 m_pendingCompletionHandler(WTFMove(respond)); 306 } 307 255 308 } // namespace WebKit 256 309 -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h
r249949 r250729 60 60 61 61 protected: 62 Callback& pendingCompletionHandler() { return m_pendingCompletionHandler; }63 62 RunLoop::Timer<AuthenticatorManager>& requestTimeOutTimer() { return m_requestTimeOutTimer; } 64 63 void clearStateAsync(); // To void cyclic dependence. 65 64 void clearState(); 65 void invokePendingCompletionHandler(Respond&&); 66 66 67 67 private: … … 81 81 void initTimeOutTimer(const Optional<unsigned>& timeOutInMs); 82 82 void timeOutTimerFired(); 83 void runPanel(); 84 void startRequest(); 83 85 84 86 // Request: We only allow one request per time. A new request will cancel any pending ones. 85 87 WebAuthenticationRequestData m_pendingRequestData; 86 Callback m_pendingCompletionHandler; 88 Callback m_pendingCompletionHandler; // Should be invoked directly, use invokePendingCompletionHandler. 87 89 RunLoop::Timer<AuthenticatorManager> m_requestTimeOutTimer; 88 90 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcConnection.mm
r249108 r250729 52 52 { 53 53 [m_session setDelegate:m_delegate.get()]; 54 // FIXME(200933)55 [m_session updateUIAlertMessage:@"Insert your security key or hold the key against the top of your device."];56 54 [m_session startPolling]; 57 55 } -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcService.mm
r249059 r250729 92 92 }); 93 93 }); 94 [[getNFHardwareManagerClass() sharedHardwareManager] startReaderSession WithActionSheetUI:callback.get()];94 [[getNFHardwareManagerClass() sharedHardwareManager] startReaderSession:callback.get()]; 95 95 #endif // HAVE(NEAR_FIELD) 96 96 } -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h
r250728 r250729 1 1 /* 2 * Copyright (C) 201 8Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "WebPreferences.h" 31 #include <WebCore/PublicKeyCredentialCreationOptions.h> 32 #include <WebCore/PublicKeyCredentialRequestOptions.h> 33 #include <wtf/Variant.h> 34 #include <wtf/Vector.h> 30 #import "WKFoundation.h" 31 32 #import "APIWebAuthenticationPanelClient.h" 33 #import <wtf/RetainPtr.h> 34 #import <wtf/WeakObjCPtr.h> 35 #import <wtf/WeakPtr.h> 36 37 @class _WKWebAuthenticationPanel; 38 @protocol _WKWebAuthenticationPanelDelegate; 35 39 36 40 namespace WebKit { 37 41 38 struct WebAuthenticationRequestData { 39 Vector<uint8_t> hash; 40 Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options; 41 RefPtr<WebPreferences> preferences; 42 class WebAuthenticationPanelClient : public API::WebAuthenticationPanelClient, public CanMakeWeakPtr<WebAuthenticationPanelClient> { 43 public: 44 WebAuthenticationPanelClient(_WKWebAuthenticationPanel *, id <_WKWebAuthenticationPanelDelegate>); 45 46 RetainPtr<id <_WKWebAuthenticationPanelDelegate> > delegate(); 47 48 private: 49 // API::WebAuthenticationPanelClient 50 void dismissPanel(WebAuthenticationResult) const final; 51 52 _WKWebAuthenticationPanel *m_panel; 53 WeakObjCPtr<id <_WKWebAuthenticationPanelDelegate> > m_delegate; 54 55 struct { 56 bool panelDismissWebAuthenticationPanelWithResult : 1; 57 } m_delegateMethods; 42 58 }; 43 59 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm
r250728 r250729 1 1 /* 2 * Copyright (C) 201 8Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i nclude"config.h"27 #i nclude "MockAuthenticatorManager.h"26 #import "config.h" 27 #import "WebAuthenticationPanelClient.h" 28 28 29 29 #if ENABLE(WEB_AUTHN) 30 30 31 #import "WebAuthenticationPanelFlags.h" 32 #import "_WKWebAuthenticationPanel.h" 33 31 34 namespace WebKit { 32 35 33 MockAuthenticatorManager::MockAuthenticatorManager(MockWebAuthenticationConfiguration&& configuration) 34 : m_testConfiguration(WTFMove(configuration)) 36 WebAuthenticationPanelClient::WebAuthenticationPanelClient(_WKWebAuthenticationPanel *panel, id <_WKWebAuthenticationPanelDelegate> delegate) 37 : m_panel(panel) 38 , m_delegate(delegate) 35 39 { 40 m_delegateMethods.panelDismissWebAuthenticationPanelWithResult = [delegate respondsToSelector:@selector(panel:dismissWebAuthenticationPanelWithResult:)]; 36 41 } 37 42 38 UniqueRef<AuthenticatorTransportService> MockAuthenticatorManager::createService(WebCore::AuthenticatorTransport transport, AuthenticatorTransportService::Observer& observer) const 43 RetainPtr<id <_WKWebAuthenticationPanelDelegate> > WebAuthenticationPanelClient::delegate() 39 44 { 40 return AuthenticatorTransportService::createMock(transport, observer, m_testConfiguration);45 return m_delegate.get(); 41 46 } 42 47 43 void MockAuthenticatorManager::respondReceivedInternal(Respond&& respond)48 static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationResult result) 44 49 { 45 if (m_testConfiguration.silentFailure) 50 switch (result) { 51 case WebAuthenticationResult::Succeeded: 52 return _WKWebAuthenticationResultSucceeded; 53 case WebAuthenticationResult::Failed: 54 return _WKWebAuthenticationResultFailed; 55 } 56 ASSERT_NOT_REACHED(); 57 return _WKWebAuthenticationResultFailed; 58 } 59 60 void WebAuthenticationPanelClient::dismissPanel(WebAuthenticationResult result) const 61 { 62 if (!m_delegateMethods.panelDismissWebAuthenticationPanelWithResult) 46 63 return; 47 64 48 pendingCompletionHandler()(WTFMove(respond)); 49 clearStateAsync(); 50 requestTimeOutTimer().stop(); 65 auto delegate = m_delegate.get(); 66 if (!delegate) 67 return; 68 69 [delegate panel:m_panel dismissWebAuthenticationPanelWithResult:wkWebAuthenticationResult(result)]; 51 70 } 52 71 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
r239852 r250729 46 46 return; 47 47 48 pendingCompletionHandler()(WTFMove(respond));48 invokePendingCompletionHandler(WTFMove(respond)); 49 49 clearStateAsync(); 50 50 requestTimeOutTimer().stop(); -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h
r250728 r250729 26 26 #pragma once 27 27 28 #i mport "_WKWebAuthenticationPanel.h"28 #if ENABLE(WEB_AUTHN) 29 29 30 @interface _WKWebAuthenticationPanel () 30 namespace WebKit { 31 31 32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID; 32 enum class WebAuthenticationPanelResult : uint8_t { 33 Unavailable, 34 Presented, 35 DidNotPresent 36 }; 33 37 34 @end 38 enum class WebAuthenticationResult : bool { 39 Succeeded, 40 Failed 41 }; 42 43 } // namespace WebKit 44 45 #endif // ENABLE(WEB_AUTHN) -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h
r249949 r250729 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "WebPreferences.h" 30 #include "APIWebAuthenticationPanel.h" 31 #include "WebAuthenticationPanelFlags.h" 31 32 #include <WebCore/PublicKeyCredentialCreationOptions.h> 32 33 #include <WebCore/PublicKeyCredentialRequestOptions.h> 33 34 #include <wtf/Variant.h> 34 35 #include <wtf/Vector.h> 36 #include <wtf/WeakPtr.h> 35 37 36 38 namespace WebKit { 39 40 class WebPageProxy; 37 41 38 42 struct WebAuthenticationRequestData { 39 43 Vector<uint8_t> hash; 40 44 Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options; 41 RefPtr<WebPreferences> preferences; 45 WeakPtr<WebPageProxy> page; 46 WebAuthenticationPanelResult panelResult { WebAuthenticationPanelResult::Unavailable }; 47 RefPtr<API::WebAuthenticationPanel> panel; 42 48 }; 43 49 -
trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp
r249949 r250729 31 31 #include "AuthenticatorManager.h" 32 32 #include "LocalService.h" 33 #include "WebAuthenticationPanelFlags.h" 33 34 #include "WebAuthenticatorCoordinatorMessages.h" 34 35 #include "WebAuthenticatorCoordinatorProxyMessages.h" … … 56 57 void WebAuthenticatorCoordinatorProxy::makeCredential(uint64_t messageId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options) 57 58 { 58 handleRequest(messageId, { hash, options, m _webPageProxy.preferences().copy()});59 handleRequest(messageId, { hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr }); 59 60 } 60 61 61 62 void WebAuthenticatorCoordinatorProxy::getAssertion(uint64_t messageId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options) 62 63 { 63 handleRequest(messageId, { hash, options, m _webPageProxy.preferences().copy()});64 handleRequest(messageId, { hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr }); 64 65 } 65 66 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r250673 r250729 1049 1049 576CA9D722B862180030143C /* SOAuthorizationNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317322B35148008D0E8B /* SOAuthorizationNSURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1050 1050 5772F206217DBD6A0056BF2C /* HidService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5772F204217DBD6A0056BF2C /* HidService.h */; }; 1051 577FF7822346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */; }; 1052 577FF7852346ECAA004EDFB9 /* WebAuthenticationPanelClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */; }; 1051 1053 578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; }; 1052 1054 57AC8F50217FEED90055438C /* HidConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57AC8F4E217FEED90055438C /* HidConnection.h */; }; … … 1058 1060 57B8264C230603C100B72EB0 /* MockNfcService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B8264A230603C100B72EB0 /* MockNfcService.h */; }; 1059 1061 57BBEA6D22BC0BFE00273995 /* SOAuthorizationLoadPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57BBEA6C22BC0BFE00273995 /* SOAuthorizationLoadPolicy.h */; }; 1062 57C6244B234679A400383FE7 /* WebAuthenticationPanelFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 57C6244A234679A400383FE7 /* WebAuthenticationPanelFlags.h */; }; 1060 1063 57DCED6E2142EE5E0016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */; }; 1061 1064 57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED6A2142EAE20016B847 /* WebAuthenticatorCoordinatorMessages.h */; }; … … 1076 1079 57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; }; 1077 1080 57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */; }; 1081 57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */; }; 1078 1082 57FD318022B35158008D0E8B /* NavigationSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317822B35149008D0E8B /* NavigationSOAuthorizationSession.h */; }; 1079 1083 57FD318122B3515B008D0E8B /* PopUpSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */; }; … … 3526 3530 5772F204217DBD6A0056BF2C /* HidService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidService.h; sourceTree = "<group>"; }; 3527 3531 5772F205217DBD6A0056BF2C /* HidService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HidService.mm; sourceTree = "<group>"; }; 3532 577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIWebAuthenticationPanelClient.h; sourceTree = "<group>"; }; 3533 577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanelClient.h; sourceTree = "<group>"; }; 3534 577FF7842346ECAA004EDFB9 /* WebAuthenticationPanelClient.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAuthenticationPanelClient.mm; sourceTree = "<group>"; }; 3528 3535 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSoftLink.h; sourceTree = "<group>"; }; 3529 3536 57AC8F4E217FEED90055438C /* HidConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidConnection.h; sourceTree = "<group>"; }; … … 3539 3546 57B8264B230603C100B72EB0 /* MockNfcService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockNfcService.mm; sourceTree = "<group>"; }; 3540 3547 57BBEA6C22BC0BFE00273995 /* SOAuthorizationLoadPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SOAuthorizationLoadPolicy.h; sourceTree = "<group>"; }; 3548 57C6244A234679A400383FE7 /* WebAuthenticationPanelFlags.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanelFlags.h; sourceTree = "<group>"; }; 3541 3549 57DCED6A2142EAE20016B847 /* WebAuthenticatorCoordinatorMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAuthenticatorCoordinatorMessages.h; path = DerivedSources/WebKit2/WebAuthenticatorCoordinatorMessages.h; sourceTree = BUILT_PRODUCTS_DIR; }; 3542 3550 57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAuthenticatorCoordinatorMessageReceiver.cpp; path = DerivedSources/WebKit2/WebAuthenticatorCoordinatorMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; … … 3566 3574 57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = U2fAuthenticator.h; sourceTree = "<group>"; }; 3567 3575 57EB2E3921E1983E00B89CDF /* U2fAuthenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = U2fAuthenticator.cpp; sourceTree = "<group>"; }; 3576 57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIWebAuthenticationPanel.h; sourceTree = "<group>"; }; 3577 57EBE269234676C5008D8AF9 /* APIWebAuthenticationPanel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = APIWebAuthenticationPanel.cpp; sourceTree = "<group>"; }; 3568 3578 57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopUpSOAuthorizationSession.h; sourceTree = "<group>"; }; 3569 3579 57FD317122B35148008D0E8B /* WKSOAuthorizationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSOAuthorizationDelegate.h; sourceTree = "<group>"; }; … … 7069 7079 57DCED9921489F4D0016B847 /* AuthenticatorTransportService.cpp */, 7070 7080 57DCED8A214853130016B847 /* AuthenticatorTransportService.h */, 7081 57C6244A234679A400383FE7 /* WebAuthenticationPanelFlags.h */, 7071 7082 57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */, 7072 7083 57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */, … … 7110 7121 570DAAAC23026F5C00E8FC04 /* NfcService.h */, 7111 7122 570DAAAD23026F5C00E8FC04 /* NfcService.mm */, 7123 577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */, 7124 577FF7842346ECAA004EDFB9 /* WebAuthenticationPanelClient.mm */, 7112 7125 570DAAC423037F7E00E8FC04 /* WKNFReaderSessionDelegate.h */, 7113 7126 570DAAC523037F7E00E8FC04 /* WKNFReaderSessionDelegate.mm */, … … 7986 7999 2D8786211BDB58FF00D02ABB /* APIUserStyleSheet.cpp */, 7987 8000 2D8786221BDB58FF00D02ABB /* APIUserStyleSheet.h */, 8001 57EBE269234676C5008D8AF9 /* APIWebAuthenticationPanel.cpp */, 8002 57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */, 8003 577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */, 7988 8004 1AE286811C7F93860069AC4F /* APIWebsiteDataRecord.cpp */, 7989 8005 1AE286821C7F93860069AC4F /* APIWebsiteDataRecord.h */, … … 9392 9408 C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */, 9393 9409 C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */, 9410 57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */, 9411 577FF7822346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h in Headers */, 9394 9412 1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */, 9395 9413 1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */, … … 9830 9848 1A8E7D3D18C15149005A702A /* VisitedLinkTableControllerMessages.h in Headers */, 9831 9849 CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */, 9850 577FF7852346ECAA004EDFB9 /* WebAuthenticationPanelClient.h in Headers */, 9851 57C6244B234679A400383FE7 /* WebAuthenticationPanelFlags.h in Headers */, 9832 9852 57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */, 9833 9853 57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */, -
trunk/Tools/ChangeLog
r250728 r250729 1 2019-10-04 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Implement _WKWebAuthenticationPanel SPI 4 https://bugs.webkit.org/show_bug.cgi?id=202559 5 <rdar://problem/55932094> 6 7 Reviewed by Brent Fulgham. 8 9 This patch adds a very limited test case to _WKWebAuthenticationPanel. 10 Bug 202560 and Bug 202565 will follow up to write more tests. 11 12 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 13 * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: Added. 14 (-[TestWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:]): 15 (-[TestWebAuthenticationPanelUIDelegate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]): 16 (TestWebKitAPI::TEST): 17 * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion.html: Added. 18 * WebKitTestRunner/TestController.cpp: 19 (WTR::runWebAuthenticationPanel): 20 (WTR::TestController::createWebViewWithOptions): 21 1 22 2019-10-04 Alex Christensen <achristensen@webkit.org> 2 23 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r250256 r250729 345 345 57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */; }; 346 346 57C3FA661F7C248F009D4B80 /* WeakPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */; }; 347 57C6244E2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57C6244D2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm */; }; 348 57C624502346C21E00383FE7 /* web-authentication-get-assertion.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57C6244F2346C1EC00383FE7 /* web-authentication-get-assertion.html */; }; 347 349 57F4AAA0208FAEF000A68E9E /* SSLKeyGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57F4AA9F208FA83D00A68E9E /* SSLKeyGenerator.mm */; }; 348 350 57F56A5C1C7F8CC100F31D7E /* IsNavigationActionTrusted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */; }; … … 1435 1437 2EBD9D0A2134730D002DA758 /* video.html in Copy Resources */, 1436 1438 CD577799211CE0E4001B371E /* web-audio-only.html in Copy Resources */, 1439 57C624502346C21E00383FE7 /* web-authentication-get-assertion.html in Copy Resources */, 1437 1440 1C2B81861C89259D00A5529F /* webfont.html in Copy Resources */, 1438 1441 51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */, … … 1861 1864 5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; }; 1862 1865 57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCryptoMasterKey.mm; sourceTree = "<group>"; }; 1866 57C6244D2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebAuthenticationPanel.mm; sourceTree = "<group>"; }; 1867 57C6244F2346C1EC00383FE7 /* web-authentication-get-assertion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "web-authentication-get-assertion.html"; sourceTree = "<group>"; }; 1863 1868 57D1D75E21DCB7A80093E86A /* U2fCommandConstructorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = U2fCommandConstructorTest.cpp; sourceTree = "<group>"; }; 1864 1869 57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; }; … … 2726 2731 5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */, 2727 2732 7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */, 2733 57C6244D2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm */, 2728 2734 0746645822FF630500E3451A /* AccessibilityTestPlugin.mm */, 2729 2735 0746645722FF62D000E3451A /* AccessibilityTestSupportProtocol.h */, … … 3365 3371 CD57779B211CE6CE001B371E /* video-with-audio-and-web-audio.html */, 3366 3372 CD577798211CDE8F001B371E /* web-audio-only.html */, 3373 57C6244F2346C1EC00383FE7 /* web-authentication-get-assertion.html */, 3367 3374 51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */, 3368 3375 51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */, … … 4389 4396 5CEAB5E11FA939F400A77FAA /* _WKInputDelegate.mm in Sources */, 4390 4397 7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */, 4398 57C6244E2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm in Sources */, 4391 4399 7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */, 4392 4400 7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */, -
trunk/Tools/WebKitTestRunner/TestController.cpp
r250621 r250729 294 294 { 295 295 return TestController::singleton().handleDeviceOrientationAndMotionAccessRequest(origin); 296 } 297 298 // A placeholder to tell WebKit the client is WebKitTestRunner. 299 static void runWebAuthenticationPanel() 300 { 296 301 } 297 302 … … 618 623 619 624 platformCreateWebView(configuration.get(), options); 620 WKPageUIClientV1 3pageUIClient = {621 { 1 3, m_mainWebView.get() },625 WKPageUIClientV14 pageUIClient = { 626 { 14, m_mainWebView.get() }, 622 627 0, // createNewPage_deprecatedForUseWithV0 623 628 0, // showPage … … 691 696 0, // didResignInputElementStrongPasswordAppearance 692 697 0, // requestStorageAccessConfirm 693 shouldAllowDeviceOrientationAndMotionAccess 698 shouldAllowDeviceOrientationAndMotionAccess, 699 runWebAuthenticationPanel 694 700 }; 695 701 WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
Note: See TracChangeset
for help on using the changeset viewer.