Changeset 250729 in webkit


Ignore:
Timestamp:
Oct 4, 2019 9:50:01 AM (4 years ago)
Author:
jiewen_tan@apple.com
Message:

[WebAuthn] Implement _WKWebAuthenticationPanel SPI
https://bugs.webkit.org/show_bug.cgi?id=202559
<rdar://problem/55932094>

Reviewed by Brent Fulgham.

Source/WebKit:

This patch implements _WKWebAuthenticationPanel SPI. Here is the structure:
1) API::WebAuthenticationPanel is the APIObject of _WKWebAuthenticationPanel. It is owned by AuthenticatorManager.
The lifetime of _WKWebAuthenticationPanel on the other hand is managed by clients. This binding is the surface
where clients could interact with WebKit's WebAuthentication implementation.
2) API::WebAuthenticationPanelClient is a base class representing _WKWebAuthenticationPanelDelegate. Its subclass
WebKit::WebAuthenticationPanelClient implements bridges to _WKWebAuthenticationPanelDelegate methods. It is owned by
API::WebAuthenticationPanel. A weak pointer of WebKit::WebAuthenticationPanelClient is kept in _WKWebAuthenticationPanel
to get the _WKWebAuthenticationPanelDelegate set by clients or nil otherwise. This binding is the surface where WebKit
interacts with clients.
3) WebAuthenticationPanelFlags is the mirror of enums within _WKWebAuthenticationPanel.

Implementation wise, this patch implements:
1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:], this is bridged from
the regular UIDelegate route. Noted, WKFrameInfo is nil for now, a follow up on Bug 202563 will take care of it. This
will be called from AuthenticatorManager::runPanel() which gates the start of discovery on the callback. For clients
that don't implement the delegate, the callback will always be called with _WKWebAuthenticationPanelResultUnavailable
to allow WebKit run on non-UI mode. A specific C API hack is added to always return _WKWebAuthenticationPanelResultPresented
in WebKitTestRunner for layout tests.
2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] will be implemented in Bug 200932.
3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:], this is bridged from
API::WebAuthenticationPanel/API::WebAuthenticationPanelClient. This will be called whenever AuthenticatorManager::m_pendingCompletionHandler
is invoked. Depending on the respond, _WKWebAuthenticationResult will be returned accordingly. To facilitate that,
invokePendingCompletionHandler is crafted to bundle those two operations.
4) -[_WKWebAuthenticationPanel cancel] will be implemented in Bug 191523.

Besides the above, this patch also silents the NFC action sheet.

  • Platform/spi/Cocoa/NearFieldSPI.h:
  • Shared/API/APIObject.h:
  • Shared/Cocoa/APIObject.mm:

(API::Object::newObject):

  • Sources.txt:
  • SourcesCocoa.txt:
  • UIProcess/API/APIUIClient.h:

(API::UIClient::runWebAuthenticationPanel):

  • UIProcess/API/APIWebAuthenticationPanel.cpp: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm.

(API::WebAuthenticationPanel::create):
(API::WebAuthenticationPanel::WebAuthenticationPanel):
(API::WebAuthenticationPanel::setClient):

  • UIProcess/API/APIWebAuthenticationPanel.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
  • UIProcess/API/APIWebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.

(API::WebAuthenticationPanelClient::dismissPanel const):

  • UIProcess/API/C/WKPage.cpp:

(WKPageSetPageUIClient):

  • UIProcess/API/C/WKPageUIClient.h:
  • UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:

(-[_WKWebAuthenticationPanel dealloc]):
(-[_WKWebAuthenticationPanel relyingPartyID]):
(-[_WKWebAuthenticationPanel delegate]):
(-[_WKWebAuthenticationPanel setDelegate:]):
(-[_WKWebAuthenticationPanel _apiObject]):
(-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]): Deleted.

  • UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
  • UIProcess/Cocoa/UIDelegate.h:
  • UIProcess/Cocoa/UIDelegate.mm:

(WebKit::UIDelegate::setDelegate):
(WebKit::webAuthenticationPanelResult):
(WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):

  • UIProcess/WebAuthentication/AuthenticatorManager.cpp:

(WebKit::WebCore::isFeatureEnabled):
(WebKit::WebCore::getRpId):
(WebKit::AuthenticatorManager::handleRequest):
(WebKit::AuthenticatorManager::respondReceived):
(WebKit::AuthenticatorManager::startDiscovery):
(WebKit::AuthenticatorManager::initTimeOutTimer):
(WebKit::AuthenticatorManager::timeOutTimerFired):
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::startRequest):
(WebKit::AuthenticatorManager::invokePendingCompletionHandler):
(WebKit::AuthenticatorManagerInternal::collectTransports): Deleted.
(WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension): Deleted.

  • UIProcess/WebAuthentication/AuthenticatorManager.h:

(WebKit::AuthenticatorManager::pendingCompletionHandler): Deleted.

  • UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:

(WebKit::NfcConnection::NfcConnection):

  • UIProcess/WebAuthentication/Cocoa/NfcService.mm:

(WebKit::NfcService::platformStartDiscovery):

  • UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
  • UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp.

(WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
(WebKit::wkWebAuthenticationResult):
(WebKit::WebAuthenticationPanelClient::dismissPanel const):

  • UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:

(WebKit::MockAuthenticatorManager::respondReceivedInternal):

  • UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.
  • UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
  • UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:

(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):

  • WebKit.xcodeproj/project.pbxproj:

Tools:

This patch adds a very limited test case to _WKWebAuthenticationPanel.
Bug 202560 and Bug 202565 will follow up to write more tests.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: Added.

(-[TestWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:]):
(-[TestWebAuthenticationPanelUIDelegate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKitCocoa/web-authentication-get-assertion.html: Added.
  • WebKitTestRunner/TestController.cpp:

(WTR::runWebAuthenticationPanel):
(WTR::TestController::createWebViewWithOptions):

Location:
trunk
Files:
2 added
24 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r250728 r250729  
     12019-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
    11002019-10-04  Alex Christensen  <achristensen@webkit.org>
    2101
  • trunk/Source/WebKit/Platform/spi/Cocoa/NearFieldSPI.h

    r249059 r250729  
    109109@interface NFHardwareManager : NSObject
    110110+ (instancetype)sharedHardwareManager;
    111 - (NSObject<NFSession> *)startReaderSessionWithActionSheetUI:(void(^)(NFReaderSession *session, NSError *error))theStartCallback;
     111- (NSObject<NFSession> *)startReaderSession:(void(^)(NFReaderSession *session, NSError *error))theStartCallback;
    112112- (BOOL)areFeaturesSupported:(NFFeature)featureMask outError:(NSError**)outError;
    113113@end
  • trunk/Source/WebKit/Shared/API/APIObject.h

    r246856 r250729  
    179179#endif
    180180
     181#if ENABLE(WEB_AUTHN)
     182        WebAuthenticationPanel,
     183#endif
     184
    181185        // Bundle types
    182186        Bundle,
  • trunk/Source/WebKit/Shared/Cocoa/APIObject.mm

    r247281 r250729  
    8585#import "_WKUserStyleSheetInternal.h"
    8686#import "_WKVisitedLinkStoreInternal.h"
     87#import "_WKWebAuthenticationPanelInternal.h"
    8788#import "_WKWebsiteDataStoreConfigurationInternal.h"
    8889
     
    365366        break;
    366367
     368#if ENABLE(WEB_AUTHN)
     369    case Type::WebAuthenticationPanel:
     370        wrapper = [_WKWebAuthenticationPanel alloc];
     371        break;
     372#endif
     373
    367374    case Type::BundleFrame:
    368375        wrapper = [WKWebProcessPlugInFrame alloc];
  • trunk/Source/WebKit/Sources.txt

    r250169 r250729  
    319319UIProcess/API/APIUserScript.cpp
    320320UIProcess/API/APIUserStyleSheet.cpp
     321UIProcess/API/APIWebAuthenticationPanel.cpp
    321322UIProcess/API/APIWebsitePolicies.cpp
    322323UIProcess/API/APIWindowFeatures.cpp
  • trunk/Source/WebKit/SourcesCocoa.txt

    r250658 r250729  
    504504UIProcess/WebAuthentication/Cocoa/NfcService.mm
    505505UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm
     506UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm
    506507
    507508UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
  • trunk/Source/WebKit/UIProcess/API/APIUIClient.h

    r248762 r250729  
    3939#endif
    4040
     41#if ENABLE(WEB_AUTHN)
     42#include "WebAuthenticationPanelFlags.h"
     43#endif
     44
    4145namespace WebCore {
    4246class RegistrableDomain;
     
    7074class OpenPanelParameters;
    7175class SecurityOrigin;
     76#if ENABLE(WEB_AUTHN)
     77class WebAuthenticationPanel;
     78#endif
    7279
    7380class UIClient {
     
    189196   
    190197    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
    191202};
    192203
  • trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp

    r250728 r250729  
    2424 */
    2525
    26 #import "config.h"
    27 #import "_WKWebAuthenticationPanelInternal.h"
     26#include "config.h"
     27#include "APIWebAuthenticationPanel.h"
    2828
    29 #import <wtf/RetainPtr.h>
     29#if ENABLE(WEB_AUTHN)
    3030
    31 @implementation _WKWebAuthenticationPanel  {
    32     RetainPtr<NSString> _relyingPartyID;
     31#include "APIWebAuthenticationPanelClient.h"
     32
     33namespace API {
     34
     35Ref<WebAuthenticationPanel> WebAuthenticationPanel::create(const String& rpId)
     36{
     37    return adoptRef(*new WebAuthenticationPanel(rpId));
    3338}
    3439
    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
     40WebAuthenticationPanel::WebAuthenticationPanel(const String& rpId)
     41    : m_rpId(rpId)
     42    , m_client(WTF::makeUniqueRef<WebAuthenticationPanelClient>())
    4943{
    5044}
    5145
    52 @end
     46WebAuthenticationPanel::~WebAuthenticationPanel() = default;
     47
     48void 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  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828#if ENABLE(WEB_AUTHN)
    2929
    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>
    3534
    36 namespace WebKit {
     35namespace API {
    3736
    38 struct WebAuthenticationRequestData {
    39     Vector<uint8_t> hash;
    40     Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options;
    41     RefPtr<WebPreferences> preferences;
     37class WebAuthenticationPanelClient;
     38
     39class WebAuthenticationPanel final : public ObjectImpl<Object::Type::WebAuthenticationPanel>, public CanMakeWeakPtr<WebAuthenticationPanel> {
     40public:
     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
     49private:
     50    WebAuthenticationPanel(const String& rpId);
     51
     52    WTF::String m_rpId;
     53    UniqueRef<WebAuthenticationPanelClient> m_client;
    4254};
    4355
    44 } // namespace WebKit
     56} // namespace API
    4557
    4658#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanelClient.h

    r250728 r250729  
    2626#pragma once
    2727
    28 #import "_WKWebAuthenticationPanel.h"
     28#if ENABLE(WEB_AUTHN)
    2929
    30 @interface _WKWebAuthenticationPanel ()
     30namespace WebKit {
     31enum class WebAuthenticationResult : bool;
     32}
    3133
    32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID;
     34namespace API {
    3335
    34 @end
     36class WebAuthenticationPanelClient {
     37    WTF_MAKE_FAST_ALLOCATED;
     38public:
     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  
    117117
    118118template<> 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;
    120120};
    121121
     
    20742074            m_client.handleAutoplayEvent(toAPI(&page), toWKAutoplayEvent(event), toWKAutoplayEventFlags(flags), m_client.base.clientInfo);
    20752075        }
     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
    20762088    };
    20772089
  • trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h

    r248797 r250729  
    137137typedef bool (*WKPageShouldAllowDeviceOrientationAndMotionAccessCallback)(WKPageRef page, WKSecurityOriginRef securityOrigin, const void *clientInfo);
    138138
     139typedef void (*WKPageRunWebAuthenticationPanelCallback)();
     140
    139141// Deprecated
    140142typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
     
    12461248} WKPageUIClientV13;
    12471249
     1250typedef 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
    12481357#ifdef __cplusplus
    12491358}
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm

    r250658 r250729  
    2525
    2626#import "config.h"
     27#import "WebAuthenticationPanelClient.h"
    2728#import "_WKWebAuthenticationPanelInternal.h"
    2829
    2930#import <wtf/RetainPtr.h>
    3031
    31 @implementation _WKWebAuthenticationPanel  {
    32     RetainPtr<NSString> _relyingPartyID;
     32@implementation _WKWebAuthenticationPanel {
     33    WeakPtr<WebKit::WebAuthenticationPanelClient> _client;
    3334}
    3435
    35 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID
     36- (void)dealloc
    3637{
    37     if (!(self = [super init]))
    38         return nil;
    39     _relyingPartyID = relayingPartyID;
    40     return self;
     38    _panel->~WebAuthenticationPanel();
     39
     40    [super dealloc];
    4141}
    4242
    4343- (NSString *)relyingPartyID
    4444{
    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));
    4660}
    4761
     
    5064}
    5165
     66#pragma mark WKObject protocol implementation
     67
     68- (API::Object&)_apiObject
     69{
     70    return *_panel;
     71}
     72
    5273@end
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h

    r250658 r250729  
    2828#import "_WKWebAuthenticationPanel.h"
    2929
    30 @interface _WKWebAuthenticationPanel ()
     30#import "APIWebAuthenticationPanel.h"
     31#import "WKObject.h"
    3132
    32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID;
     33namespace WebKit {
    3334
     35template<> 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}
    3445@end
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h

    r243210 r250729  
    155155        void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) final;
    156156        void didShowSafeBrowsingWarning() final;
     157#if ENABLE(WEB_AUTHN)
     158        void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, CompletionHandler<void(WebAuthenticationPanelResult)>&&) final;
     159#endif
    157160
    158161        UIDelegate& m_uiDelegate;
     
    235238        bool webViewHasVideoInPictureInPictureDidChange : 1;
    236239        bool webViewDidShowSafeBrowsingWarning : 1;
     240#if ENABLE(WEB_AUTHN)
     241        bool webViewRunWebAuthenticationPanelInitiatedByFrameCompletionHandler : 1;
     242#endif
    237243    } m_delegateMethods;
    238244};
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm

    r248846 r250729  
    5353#import "_WKFrameHandleInternal.h"
    5454#import "_WKHitTestResultInternal.h"
     55#import "_WKWebAuthenticationPanelInternal.h"
    5556#import <WebCore/FontAttributes.h>
    5657#import <WebCore/SecurityOriginData.h>
     
    173174    m_delegateMethods.webViewHasVideoInPictureInPictureDidChange = [delegate respondsToSelector:@selector(_webView:hasVideoInPictureInPictureDidChange:)];
    174175    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
    175179}
    176180
     
    12621266}
    12631267
     1268#if ENABLE(WEB_AUTHN)
     1269
     1270static 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
     1284void 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
    12641308void UIDelegate::UIClient::hasVideoInPictureInPictureDidChange(WebPageProxy*, bool hasVideoInPictureInPicture)
    12651309{
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp

    r250659 r250729  
    2929#if ENABLE(WEB_AUTHN)
    3030
     31#include "APIUIClient.h"
     32#include "APIWebAuthenticationPanel.h"
     33#include "APIWebAuthenticationPanelClient.h"
     34#include "WebPageProxy.h"
    3135#include "WebPreferencesKeys.h"
    3236#include <WebCore/AuthenticatorTransport.h>
     
    3741using namespace WebCore;
    3842
    39 namespace AuthenticatorManagerInternal {
     43namespace {
    4044
    4145const size_t maxTransportNumber = 3;
     
    124128}
    125129
    126 } // namespace AuthenticatorManagerInternal
     130static bool isFeatureEnabled(WebPageProxy* page, const String& featureKey)
     131{
     132    if (!page)
     133        return false;
     134    return page->preferences().store().getBoolValueForKey(featureKey);
     135}
     136
     137static 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
    127145
    128146AuthenticatorManager::AuthenticatorManager()
     
    133151void AuthenticatorManager::handleRequest(WebAuthenticationRequestData&& data, Callback&& callback)
    134152{
    135     using namespace AuthenticatorManagerInternal;
    136 
    137153    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 });
    139155        m_requestTimeOutTimer.stop();
    140156    }
     
    145161    m_pendingCompletionHandler = WTFMove(callback);
    146162
    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();
    158165}
    159166
     
    196203        shouldComplete = WTF::get<ExceptionData>(respond).code == InvalidStateError;
    197204    if (shouldComplete) {
    198         m_pendingCompletionHandler(WTFMove(respond));
     205        invokePendingCompletionHandler(WTFMove(respond));
    199206        clearStateAsync();
    200207        m_requestTimeOutTimer.stop();
     
    226233void AuthenticatorManager::startDiscovery(const TransportSet& transports)
    227234{
    228     using namespace AuthenticatorManagerInternal;
    229 
    230     ASSERT(m_services.isEmpty() && transports.size() <= maxTransportNumber && m_pendingRequestData.preferences);
     235    ASSERT(m_services.isEmpty() && transports.size() <= maxTransportNumber);
    231236    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))
    233241            continue;
    234242        auto service = createService(transport, *this);
     
    240248void AuthenticatorManager::initTimeOutTimer(const Optional<unsigned>& timeOutInMs)
    241249{
    242     using namespace AuthenticatorManagerInternal;
    243 
    244250    unsigned timeOutInMsValue = std::min(maxTimeOutValue, timeOutInMs.valueOr(maxTimeOutValue));
    245251    m_requestTimeOutTimer.startOneShot(Seconds::fromMilliseconds(timeOutInMsValue));
     
    249255{
    250256    ASSERT(m_requestTimeOutTimer.isActive());
    251     m_pendingCompletionHandler((ExceptionData { NotAllowedError, "Operation timed out."_s }));
     257    invokePendingCompletionHandler((ExceptionData { NotAllowedError, "Operation timed out."_s }));
    252258    clearState();
    253259}
    254260
     261void 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
     280void 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
     296void 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
    255308} // namespace WebKit
    256309
  • trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h

    r249949 r250729  
    6060
    6161protected:
    62     Callback& pendingCompletionHandler() { return m_pendingCompletionHandler; }
    6362    RunLoop::Timer<AuthenticatorManager>& requestTimeOutTimer() { return m_requestTimeOutTimer; }
    6463    void clearStateAsync(); // To void cyclic dependence.
    6564    void clearState();
     65    void invokePendingCompletionHandler(Respond&&);
    6666
    6767private:
     
    8181    void initTimeOutTimer(const Optional<unsigned>& timeOutInMs);
    8282    void timeOutTimerFired();
     83    void runPanel();
     84    void startRequest();
    8385
    8486    // Request: We only allow one request per time. A new request will cancel any pending ones.
    8587    WebAuthenticationRequestData m_pendingRequestData;
    86     Callback m_pendingCompletionHandler;
     88    Callback m_pendingCompletionHandler; // Should be invoked directly, use invokePendingCompletionHandler.
    8789    RunLoop::Timer<AuthenticatorManager> m_requestTimeOutTimer;
    8890
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcConnection.mm

    r249108 r250729  
    5252{
    5353    [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."];
    5654    [m_session startPolling];
    5755}
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/NfcService.mm

    r249059 r250729  
    9292        });
    9393    });
    94     [[getNFHardwareManagerClass() sharedHardwareManager] startReaderSessionWithActionSheetUI:callback.get()];
     94    [[getNFHardwareManagerClass() sharedHardwareManager] startReaderSession:callback.get()];
    9595#endif // HAVE(NEAR_FIELD)
    9696}
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h

    r250728 r250729  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828#if ENABLE(WEB_AUTHN)
    2929
    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;
    3539
    3640namespace WebKit {
    3741
    38 struct WebAuthenticationRequestData {
    39     Vector<uint8_t> hash;
    40     Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options;
    41     RefPtr<WebPreferences> preferences;
     42class WebAuthenticationPanelClient : public API::WebAuthenticationPanelClient, public CanMakeWeakPtr<WebAuthenticationPanelClient> {
     43public:
     44    WebAuthenticationPanelClient(_WKWebAuthenticationPanel *, id <_WKWebAuthenticationPanelDelegate>);
     45
     46    RetainPtr<id <_WKWebAuthenticationPanelDelegate> > delegate();
     47
     48private:
     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;
    4258};
    4359
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm

    r250728 r250729  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "MockAuthenticatorManager.h"
     26#import "config.h"
     27#import "WebAuthenticationPanelClient.h"
    2828
    2929#if ENABLE(WEB_AUTHN)
    3030
     31#import "WebAuthenticationPanelFlags.h"
     32#import "_WKWebAuthenticationPanel.h"
     33
    3134namespace WebKit {
    3235
    33 MockAuthenticatorManager::MockAuthenticatorManager(MockWebAuthenticationConfiguration&& configuration)
    34     : m_testConfiguration(WTFMove(configuration))
     36WebAuthenticationPanelClient::WebAuthenticationPanelClient(_WKWebAuthenticationPanel *panel, id <_WKWebAuthenticationPanelDelegate> delegate)
     37    : m_panel(panel)
     38    , m_delegate(delegate)
    3539{
     40    m_delegateMethods.panelDismissWebAuthenticationPanelWithResult = [delegate respondsToSelector:@selector(panel:dismissWebAuthenticationPanelWithResult:)];
    3641}
    3742
    38 UniqueRef<AuthenticatorTransportService> MockAuthenticatorManager::createService(WebCore::AuthenticatorTransport transport, AuthenticatorTransportService::Observer& observer) const
     43RetainPtr<id <_WKWebAuthenticationPanelDelegate> > WebAuthenticationPanelClient::delegate()
    3944{
    40     return AuthenticatorTransportService::createMock(transport, observer, m_testConfiguration);
     45    return m_delegate.get();
    4146}
    4247
    43 void MockAuthenticatorManager::respondReceivedInternal(Respond&& respond)
     48static _WKWebAuthenticationResult wkWebAuthenticationResult(WebAuthenticationResult result)
    4449{
    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
     60void WebAuthenticationPanelClient::dismissPanel(WebAuthenticationResult result) const
     61{
     62    if (!m_delegateMethods.panelDismissWebAuthenticationPanelWithResult)
    4663        return;
    4764
    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)];
    5170}
    5271
  • trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp

    r239852 r250729  
    4646        return;
    4747
    48     pendingCompletionHandler()(WTFMove(respond));
     48    invokePendingCompletionHandler(WTFMove(respond));
    4949    clearStateAsync();
    5050    requestTimeOutTimer().stop();
  • trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h

    r250728 r250729  
    2626#pragma once
    2727
    28 #import "_WKWebAuthenticationPanel.h"
     28#if ENABLE(WEB_AUTHN)
    2929
    30 @interface _WKWebAuthenticationPanel ()
     30namespace WebKit {
    3131
    32 - (instancetype)_initWithRelayingPartyID:(NSString *)relayingPartyID;
     32enum class WebAuthenticationPanelResult : uint8_t {
     33    Unavailable,
     34    Presented,
     35    DidNotPresent
     36};
    3337
    34 @end
     38enum 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  
    2828#if ENABLE(WEB_AUTHN)
    2929
    30 #include "WebPreferences.h"
     30#include "APIWebAuthenticationPanel.h"
     31#include "WebAuthenticationPanelFlags.h"
    3132#include <WebCore/PublicKeyCredentialCreationOptions.h>
    3233#include <WebCore/PublicKeyCredentialRequestOptions.h>
    3334#include <wtf/Variant.h>
    3435#include <wtf/Vector.h>
     36#include <wtf/WeakPtr.h>
    3537
    3638namespace WebKit {
     39
     40class WebPageProxy;
    3741
    3842struct WebAuthenticationRequestData {
    3943    Vector<uint8_t> hash;
    4044    Variant<WebCore::PublicKeyCredentialCreationOptions, WebCore::PublicKeyCredentialRequestOptions> options;
    41     RefPtr<WebPreferences> preferences;
     45    WeakPtr<WebPageProxy> page;
     46    WebAuthenticationPanelResult panelResult { WebAuthenticationPanelResult::Unavailable };
     47    RefPtr<API::WebAuthenticationPanel> panel;
    4248};
    4349
  • trunk/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp

    r249949 r250729  
    3131#include "AuthenticatorManager.h"
    3232#include "LocalService.h"
     33#include "WebAuthenticationPanelFlags.h"
    3334#include "WebAuthenticatorCoordinatorMessages.h"
    3435#include "WebAuthenticatorCoordinatorProxyMessages.h"
     
    5657void WebAuthenticatorCoordinatorProxy::makeCredential(uint64_t messageId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options)
    5758{
    58     handleRequest(messageId, { hash, options, m_webPageProxy.preferences().copy() });
     59    handleRequest(messageId, { hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr });
    5960}
    6061
    6162void WebAuthenticatorCoordinatorProxy::getAssertion(uint64_t messageId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options)
    6263{
    63     handleRequest(messageId, { hash, options, m_webPageProxy.preferences().copy() });
     64    handleRequest(messageId, { hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr });
    6465}
    6566
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r250673 r250729  
    10491049                576CA9D722B862180030143C /* SOAuthorizationNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317322B35148008D0E8B /* SOAuthorizationNSURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10501050                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 */; };
    10511053                578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; };
    10521054                57AC8F50217FEED90055438C /* HidConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57AC8F4E217FEED90055438C /* HidConnection.h */; };
     
    10581060                57B8264C230603C100B72EB0 /* MockNfcService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B8264A230603C100B72EB0 /* MockNfcService.h */; };
    10591061                57BBEA6D22BC0BFE00273995 /* SOAuthorizationLoadPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57BBEA6C22BC0BFE00273995 /* SOAuthorizationLoadPolicy.h */; };
     1062                57C6244B234679A400383FE7 /* WebAuthenticationPanelFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 57C6244A234679A400383FE7 /* WebAuthenticationPanelFlags.h */; };
    10601063                57DCED6E2142EE5E0016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */; };
    10611064                57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED6A2142EAE20016B847 /* WebAuthenticatorCoordinatorMessages.h */; };
     
    10761079                57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; };
    10771080                57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */; };
     1081                57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */; };
    10781082                57FD318022B35158008D0E8B /* NavigationSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317822B35149008D0E8B /* NavigationSOAuthorizationSession.h */; };
    10791083                57FD318122B3515B008D0E8B /* PopUpSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */; };
     
    35263530                5772F204217DBD6A0056BF2C /* HidService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidService.h; sourceTree = "<group>"; };
    35273531                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>"; };
    35283535                578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSoftLink.h; sourceTree = "<group>"; };
    35293536                57AC8F4E217FEED90055438C /* HidConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidConnection.h; sourceTree = "<group>"; };
     
    35393546                57B8264B230603C100B72EB0 /* MockNfcService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockNfcService.mm; sourceTree = "<group>"; };
    35403547                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>"; };
    35413549                57DCED6A2142EAE20016B847 /* WebAuthenticatorCoordinatorMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAuthenticatorCoordinatorMessages.h; path = DerivedSources/WebKit2/WebAuthenticatorCoordinatorMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
    35423550                57DCED6B2142EAE20016B847 /* WebAuthenticatorCoordinatorMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAuthenticatorCoordinatorMessageReceiver.cpp; path = DerivedSources/WebKit2/WebAuthenticatorCoordinatorMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
     
    35663574                57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = U2fAuthenticator.h; sourceTree = "<group>"; };
    35673575                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>"; };
    35683578                57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopUpSOAuthorizationSession.h; sourceTree = "<group>"; };
    35693579                57FD317122B35148008D0E8B /* WKSOAuthorizationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSOAuthorizationDelegate.h; sourceTree = "<group>"; };
     
    70697079                                57DCED9921489F4D0016B847 /* AuthenticatorTransportService.cpp */,
    70707080                                57DCED8A214853130016B847 /* AuthenticatorTransportService.h */,
     7081                                57C6244A234679A400383FE7 /* WebAuthenticationPanelFlags.h */,
    70717082                                57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */,
    70727083                                57608296202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.cpp */,
     
    71107121                                570DAAAC23026F5C00E8FC04 /* NfcService.h */,
    71117122                                570DAAAD23026F5C00E8FC04 /* NfcService.mm */,
     7123                                577FF7832346ECAA004EDFB9 /* WebAuthenticationPanelClient.h */,
     7124                                577FF7842346ECAA004EDFB9 /* WebAuthenticationPanelClient.mm */,
    71127125                                570DAAC423037F7E00E8FC04 /* WKNFReaderSessionDelegate.h */,
    71137126                                570DAAC523037F7E00E8FC04 /* WKNFReaderSessionDelegate.mm */,
     
    79867999                                2D8786211BDB58FF00D02ABB /* APIUserStyleSheet.cpp */,
    79878000                                2D8786221BDB58FF00D02ABB /* APIUserStyleSheet.h */,
     8001                                57EBE269234676C5008D8AF9 /* APIWebAuthenticationPanel.cpp */,
     8002                                57EBE268234676C5008D8AF9 /* APIWebAuthenticationPanel.h */,
     8003                                577FF7812346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h */,
    79888004                                1AE286811C7F93860069AC4F /* APIWebsiteDataRecord.cpp */,
    79898005                                1AE286821C7F93860069AC4F /* APIWebsiteDataRecord.h */,
     
    93929408                                C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */,
    93939409                                C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */,
     9410                                57EBE26A234676C5008D8AF9 /* APIWebAuthenticationPanel.h in Headers */,
     9411                                577FF7822346E81C004EDFB9 /* APIWebAuthenticationPanelClient.h in Headers */,
    93949412                                1AE286841C7F93860069AC4F /* APIWebsiteDataRecord.h in Headers */,
    93959413                                1A6563E51B7A8C50009CF787 /* APIWindowFeatures.h in Headers */,
     
    98309848                                1A8E7D3D18C15149005A702A /* VisitedLinkTableControllerMessages.h in Headers */,
    98319849                                CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */,
     9850                                577FF7852346ECAA004EDFB9 /* WebAuthenticationPanelClient.h in Headers */,
     9851                                57C6244B234679A400383FE7 /* WebAuthenticationPanelFlags.h in Headers */,
    98329852                                57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */,
    98339853                                57DCED6F2142EE630016B847 /* WebAuthenticatorCoordinatorMessages.h in Headers */,
  • trunk/Tools/ChangeLog

    r250728 r250729  
     12019-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
    1222019-10-04  Alex Christensen  <achristensen@webkit.org>
    223
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r250256 r250729  
    345345                57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */; };
    346346                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 */; };
    347349                57F4AAA0208FAEF000A68E9E /* SSLKeyGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57F4AA9F208FA83D00A68E9E /* SSLKeyGenerator.mm */; };
    348350                57F56A5C1C7F8CC100F31D7E /* IsNavigationActionTrusted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */; };
     
    14351437                                2EBD9D0A2134730D002DA758 /* video.html in Copy Resources */,
    14361438                                CD577799211CE0E4001B371E /* web-audio-only.html in Copy Resources */,
     1439                                57C624502346C21E00383FE7 /* web-authentication-get-assertion.html in Copy Resources */,
    14371440                                1C2B81861C89259D00A5529F /* webfont.html in Copy Resources */,
    14381441                                51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
     
    18611864                5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; };
    18621865                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>"; };
    18631868                57D1D75E21DCB7A80093E86A /* U2fCommandConstructorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = U2fCommandConstructorTest.cpp; sourceTree = "<group>"; };
    18641869                57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; };
     
    27262731                                5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */,
    27272732                                7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */,
     2733                                57C6244D2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm */,
    27282734                                0746645822FF630500E3451A /* AccessibilityTestPlugin.mm */,
    27292735                                0746645722FF62D000E3451A /* AccessibilityTestSupportProtocol.h */,
     
    33653371                                CD57779B211CE6CE001B371E /* video-with-audio-and-web-audio.html */,
    33663372                                CD577798211CDE8F001B371E /* web-audio-only.html */,
     3373                                57C6244F2346C1EC00383FE7 /* web-authentication-get-assertion.html */,
    33673374                                51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */,
    33683375                                51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */,
     
    43894396                                5CEAB5E11FA939F400A77FAA /* _WKInputDelegate.mm in Sources */,
    43904397                                7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */,
     4398                                57C6244E2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm in Sources */,
    43914399                                7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */,
    43924400                                7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */,
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r250621 r250729  
    294294{
    295295    return TestController::singleton().handleDeviceOrientationAndMotionAccessRequest(origin);
     296}
     297
     298// A placeholder to tell WebKit the client is WebKitTestRunner.
     299static void runWebAuthenticationPanel()
     300{
    296301}
    297302
     
    618623
    619624    platformCreateWebView(configuration.get(), options);
    620     WKPageUIClientV13 pageUIClient = {
    621         { 13, m_mainWebView.get() },
     625    WKPageUIClientV14 pageUIClient = {
     626        { 14, m_mainWebView.get() },
    622627        0, // createNewPage_deprecatedForUseWithV0
    623628        0, // showPage
     
    691696        0, // didResignInputElementStrongPasswordAppearance
    692697        0, // requestStorageAccessConfirm
    693         shouldAllowDeviceOrientationAndMotionAccess
     698        shouldAllowDeviceOrientationAndMotionAccess,
     699        runWebAuthenticationPanel
    694700    };
    695701    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
Note: See TracChangeset for help on using the changeset viewer.