Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (251754 => 251755)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-10-30 01:25:48 UTC (rev 251755)
@@ -1,5 +1,78 @@
2019-10-29 Alan Coon <[email protected]>
+ Cherry-pick r251489. rdar://problem/56579665
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Source/WebCore:
+
+ Covered by new test contents within existing tests.
+
+ * Modules/webauthn/AuthenticatorCoordinator.cpp:
+ (WebCore::AuthenticatorCoordinator::create const):
+ (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
+ * Modules/webauthn/AuthenticatorCoordinatorClient.h:
+
+ Source/WebKit:
+
+ This patch makes WKFrameInfo available to clients via the above SPI. To do so,
+ SecuirtyOrigin of the caller document is passed from WebContent Process.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runWebAuthenticationPanel):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
+ * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+ (WebKit::AuthenticatorManager::runPanel):
+ * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
+ (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
+ (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+ (WebKit::WebAuthenticatorCoordinator::makeCredential):
+ (WebKit::WebAuthenticatorCoordinator::getAssertion):
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
+
+ Tools:
+
+ Adds new test contents into existing tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (-[TestWebAuthenticationPanelUIDelegate init]):
+ (-[TestWebAuthenticationPanelUIDelegate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
+ (-[TestWebAuthenticationPanelUIDelegate frame]):
+ (TestWebKitAPI::TEST):
+
+ LayoutTests:
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+ Imporves the flakiness.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-22 Jiewen Tan <[email protected]>
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+ Imporves the flakiness.
+
+2019-10-29 Alan Coon <[email protected]>
+
Cherry-pick r251295. rdar://problem/56579665
[WebAuthn] Implement AuthenticatorCancel
Modified: branches/safari-608-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html (251754 => 251755)
--- branches/safari-608-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html 2019-10-30 01:25:48 UTC (rev 251755)
@@ -90,7 +90,13 @@
}
};
+
+ // Stall the first request to wait for cancellation.
+ if (window.internals)
+ internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64], expectCancel: true } });
promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "This request has been cancelled by a new request.");
+ if (window.internals)
+ internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });
return navigator.credentials.get(options).then(credential => {
return checkCtapGetAssertionResult(credential);
});
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (251754 => 251755)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-10-30 01:25:48 UTC (rev 251755)
@@ -1,5 +1,82 @@
2019-10-29 Alan Coon <[email protected]>
+ Cherry-pick r251489. rdar://problem/56579665
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Source/WebCore:
+
+ Covered by new test contents within existing tests.
+
+ * Modules/webauthn/AuthenticatorCoordinator.cpp:
+ (WebCore::AuthenticatorCoordinator::create const):
+ (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
+ * Modules/webauthn/AuthenticatorCoordinatorClient.h:
+
+ Source/WebKit:
+
+ This patch makes WKFrameInfo available to clients via the above SPI. To do so,
+ SecuirtyOrigin of the caller document is passed from WebContent Process.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runWebAuthenticationPanel):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
+ * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+ (WebKit::AuthenticatorManager::runPanel):
+ * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
+ (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
+ (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+ (WebKit::WebAuthenticatorCoordinator::makeCredential):
+ (WebKit::WebAuthenticatorCoordinator::getAssertion):
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
+
+ Tools:
+
+ Adds new test contents into existing tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (-[TestWebAuthenticationPanelUIDelegate init]):
+ (-[TestWebAuthenticationPanelUIDelegate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
+ (-[TestWebAuthenticationPanelUIDelegate frame]):
+ (TestWebKitAPI::TEST):
+
+ LayoutTests:
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+ Imporves the flakiness.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-22 Jiewen Tan <[email protected]>
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Covered by new test contents within existing tests.
+
+ * Modules/webauthn/AuthenticatorCoordinator.cpp:
+ (WebCore::AuthenticatorCoordinator::create const):
+ (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
+ * Modules/webauthn/AuthenticatorCoordinatorClient.h:
+
+2019-10-29 Alan Coon <[email protected]>
+
Cherry-pick r251295. rdar://problem/56579665
[WebAuthn] Implement AuthenticatorCancel
Modified: branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp (251754 => 251755)
--- branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp 2019-10-30 01:25:48 UTC (rev 251755)
@@ -203,7 +203,7 @@
promise.reject(exception.toException());
};
// Async operations are dispatched and handled in the messenger.
- m_client->makeCredential(*frame, clientDataJsonHash, options, WTFMove(callback));
+ m_client->makeCredential(*frame, callerOrigin, clientDataJsonHash, options, WTFMove(callback));
}
void AuthenticatorCoordinator::discoverFromExternalSource(const Document& document, const PublicKeyCredentialRequestOptions& options, bool sameOriginWithAncestors, RefPtr<AbortSignal>&& abortSignal, CredentialPromise&& promise) const
@@ -274,7 +274,7 @@
promise.reject(exception.toException());
};
// Async operations are dispatched and handled in the messenger.
- m_client->getAssertion(*frame, clientDataJsonHash, options, WTFMove(callback));
+ m_client->getAssertion(*frame, callerOrigin, clientDataJsonHash, options, WTFMove(callback));
}
void AuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable(DOMPromiseDeferred<IDLBoolean>&& promise) const
Modified: branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -36,6 +36,7 @@
class DeferredPromise;
class Frame;
+class SecurityOrigin;
struct PublicKeyCredentialCreationOptions;
struct PublicKeyCredentialData;
@@ -51,8 +52,8 @@
AuthenticatorCoordinatorClient() = default;
virtual ~AuthenticatorCoordinatorClient() = default;
- virtual void makeCredential(const Frame&, const Vector<uint8_t>&, const PublicKeyCredentialCreationOptions&, RequestCompletionHandler&&) { };
- virtual void getAssertion(const Frame&, const Vector<uint8_t>&, const PublicKeyCredentialRequestOptions&, RequestCompletionHandler&&) { };
+ virtual void makeCredential(const Frame&, const SecurityOrigin&, const Vector<uint8_t>&, const PublicKeyCredentialCreationOptions&, RequestCompletionHandler&&) { };
+ virtual void getAssertion(const Frame&, const SecurityOrigin&, const Vector<uint8_t>&, const PublicKeyCredentialRequestOptions&, RequestCompletionHandler&&) { };
virtual void isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&&) { };
};
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-10-30 01:25:48 UTC (rev 251755)
@@ -1,5 +1,99 @@
2019-10-29 Alan Coon <[email protected]>
+ Cherry-pick r251489. rdar://problem/56579665
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Source/WebCore:
+
+ Covered by new test contents within existing tests.
+
+ * Modules/webauthn/AuthenticatorCoordinator.cpp:
+ (WebCore::AuthenticatorCoordinator::create const):
+ (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
+ * Modules/webauthn/AuthenticatorCoordinatorClient.h:
+
+ Source/WebKit:
+
+ This patch makes WKFrameInfo available to clients via the above SPI. To do so,
+ SecuirtyOrigin of the caller document is passed from WebContent Process.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runWebAuthenticationPanel):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
+ * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+ (WebKit::AuthenticatorManager::runPanel):
+ * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
+ (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
+ (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+ (WebKit::WebAuthenticatorCoordinator::makeCredential):
+ (WebKit::WebAuthenticatorCoordinator::getAssertion):
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
+
+ Tools:
+
+ Adds new test contents into existing tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (-[TestWebAuthenticationPanelUIDelegate init]):
+ (-[TestWebAuthenticationPanelUIDelegate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
+ (-[TestWebAuthenticationPanelUIDelegate frame]):
+ (TestWebKitAPI::TEST):
+
+ LayoutTests:
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+ Imporves the flakiness.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-22 Jiewen Tan <[email protected]>
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ This patch makes WKFrameInfo available to clients via the above SPI. To do so,
+ SecuirtyOrigin of the caller document is passed from WebContent Process.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runWebAuthenticationPanel):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
+ * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+ (WebKit::AuthenticatorManager::runPanel):
+ * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
+ (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
+ (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+ (WebKit::WebAuthenticatorCoordinator::makeCredential):
+ (WebKit::WebAuthenticatorCoordinator::getAssertion):
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
+
+2019-10-29 Alan Coon <[email protected]>
+
Cherry-pick r251295. rdar://problem/56579665
[WebAuthn] Implement AuthenticatorCancel
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/APIUIClient.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/API/APIUIClient.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/APIUIClient.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -196,7 +196,7 @@
virtual void didShowSafeBrowsingWarning() { }
#if ENABLE(WEB_AUTHN)
- virtual void runWebAuthenticationPanel(WebKit::WebPageProxy&, WebAuthenticationPanel&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) { completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable); }
+ virtual void runWebAuthenticationPanel(WebKit::WebPageProxy&, WebAuthenticationPanel&, WebKit::WebFrameProxy&, const WebCore::SecurityOriginData&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) { completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable); }
#endif
};
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp 2019-10-30 01:25:48 UTC (rev 251755)
@@ -2072,7 +2072,7 @@
#if ENABLE(WEB_AUTHN)
// The current method is specialized for WebKitTestRunner.
- void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) final
+ void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, WebFrameProxy&, const WebCore::SecurityOriginData&, CompletionHandler<void(WebKit::WebAuthenticationPanelResult)>&& completionHandler) final
{
if (!m_client.runWebAuthenticationPanel) {
completionHandler(WebKit::WebAuthenticationPanelResult::Unavailable);
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -155,7 +155,7 @@
void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) final;
void didShowSafeBrowsingWarning() final;
#if ENABLE(WEB_AUTHN)
- void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, CompletionHandler<void(WebAuthenticationPanelResult)>&&) final;
+ void runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel&, WebFrameProxy&, const WebCore::SecurityOriginData&, CompletionHandler<void(WebAuthenticationPanelResult)>&&) final;
#endif
UIDelegate& m_uiDelegate;
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2019-10-30 01:25:48 UTC (rev 251755)
@@ -1281,7 +1281,7 @@
return WebAuthenticationPanelResult::Unavailable;
}
-void UIDelegate::UIClient::runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel& panel, CompletionHandler<void(WebAuthenticationPanelResult)>&& completionHandler)
+void UIDelegate::UIClient::runWebAuthenticationPanel(WebPageProxy&, API::WebAuthenticationPanel& panel, WebFrameProxy& webFrameProxy, const WebCore::SecurityOriginData& origin, CompletionHandler<void(WebAuthenticationPanelResult)>&& completionHandler)
{
if (!m_uiDelegate.m_delegateMethods.webViewRunWebAuthenticationPanelInitiatedByFrameCompletionHandler) {
completionHandler(WebAuthenticationPanelResult::Unavailable);
@@ -1295,7 +1295,7 @@
}
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:));
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView runWebAuthenticationPanel:wrapper(panel) initiatedByFrame:nil completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (_WKWebAuthenticationPanelResult result) mutable {
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView runWebAuthenticationPanel:wrapper(panel) initiatedByFrame:wrapper(API::FrameInfo::create(webFrameProxy, origin.securityOrigin())) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (_WKWebAuthenticationPanelResult result) mutable {
if (checker->completionHandlerHasBeenCalled())
return;
checker->didCallCompletionHandler();
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp 2019-10-30 01:25:48 UTC (rev 251755)
@@ -285,10 +285,14 @@
auto* page = m_pendingRequestData.page.get();
if (!page)
return;
+ ASSERT(m_pendingRequestData.frameID && page->webPageID() == m_pendingRequestData.frameID->pageID);
+ auto* frame = page->process().webFrame(m_pendingRequestData.frameID->frameID);
+ if (!frame)
+ return;
m_pendingRequestData.panel = API::WebAuthenticationPanel::create(*this, getRpId(m_pendingRequestData.options));
auto& panel = *m_pendingRequestData.panel;
- page->uiClient().runWebAuthenticationPanel(*page, panel, [weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) {
+ page->uiClient().runWebAuthenticationPanel(*page, panel, *frame, m_pendingRequestData.origin, [weakPanel = makeWeakPtr(panel), weakThis = makeWeakPtr(*this), this] (WebAuthenticationPanelResult result) {
// The panel address is used to determine if the current pending request is still the same.
if (!weakThis || !weakPanel
|| (result == WebAuthenticationPanelResult::DidNotPresent)
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -32,6 +32,7 @@
#include <WebCore/GlobalFrameIdentifier.h>
#include <WebCore/PublicKeyCredentialCreationOptions.h>
#include <WebCore/PublicKeyCredentialRequestOptions.h>
+#include <WebCore/SecurityOriginData.h>
#include <wtf/Variant.h>
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
@@ -47,6 +48,7 @@
WebAuthenticationPanelResult panelResult { WebAuthenticationPanelResult::Unavailable };
RefPtr<API::WebAuthenticationPanel> panel;
WTF::Optional<WebCore::GlobalFrameIdentifier> frameID;
+ WebCore::SecurityOriginData origin;
};
} // namespace WebKit
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp 2019-10-30 01:25:48 UTC (rev 251755)
@@ -37,10 +37,12 @@
#include "WebsiteDataStore.h"
#include <WebCore/ExceptionData.h>
#include <WebCore/PublicKeyCredentialData.h>
+#include <WebCore/SecurityOriginData.h>
#include <wtf/MainThread.h>
#include <wtf/RunLoop.h>
namespace WebKit {
+using namespace WebCore;
WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy(WebPageProxy& webPageProxy)
: m_webPageProxy(webPageProxy)
@@ -53,23 +55,23 @@
m_webPageProxy.process().removeMessageReceiver(Messages::WebAuthenticatorCoordinatorProxy::messageReceiverName(), m_webPageProxy.pageID());
}
-void WebAuthenticatorCoordinatorProxy::makeCredential(FrameIdentifier frameId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options, RequestCompletionHandler&& handler)
+void WebAuthenticatorCoordinatorProxy::makeCredential(FrameIdentifier frameId, SecurityOriginData&& origin, Vector<uint8_t>&& hash, PublicKeyCredentialCreationOptions&& options, RequestCompletionHandler&& handler)
{
- handleRequest({ hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr, GlobalFrameIdentifier { m_webPageProxy.webPageID(), frameId } }, WTFMove(handler));
+ handleRequest({ WTFMove(hash), WTFMove(options), makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr, GlobalFrameIdentifier { m_webPageProxy.webPageID(), frameId }, WTFMove(origin) }, WTFMove(handler));
}
-void WebAuthenticatorCoordinatorProxy::getAssertion(FrameIdentifier frameId, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options, RequestCompletionHandler&& handler)
+void WebAuthenticatorCoordinatorProxy::getAssertion(FrameIdentifier frameId, SecurityOriginData&& origin, Vector<uint8_t>&& hash, PublicKeyCredentialRequestOptions&& options, RequestCompletionHandler&& handler)
{
- handleRequest({ hash, options, makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr, GlobalFrameIdentifier { m_webPageProxy.webPageID(), frameId } }, WTFMove(handler));
+ handleRequest({ WTFMove(hash), WTFMove(options), makeWeakPtr(m_webPageProxy), WebAuthenticationPanelResult::Unavailable, nullptr, GlobalFrameIdentifier { m_webPageProxy.webPageID(), frameId }, WTFMove(origin) }, WTFMove(handler));
}
void WebAuthenticatorCoordinatorProxy::handleRequest(WebAuthenticationRequestData&& data, RequestCompletionHandler&& handler)
{
- auto callback = [handler = WTFMove(handler)] (Variant<WebCore::PublicKeyCredentialData, WebCore::ExceptionData>&& result) mutable {
+ auto callback = [handler = WTFMove(handler)] (Variant<PublicKeyCredentialData, ExceptionData>&& result) mutable {
ASSERT(RunLoop::isMain());
- WTF::switchOn(result, [&](const WebCore::PublicKeyCredentialData& data) {
+ WTF::switchOn(result, [&](const PublicKeyCredentialData& data) {
handler(data, { });
- }, [&](const WebCore::ExceptionData& exception) {
+ }, [&](const ExceptionData& exception) {
handler({ }, exception);
});
};
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -37,6 +37,7 @@
struct PublicKeyCredentialCreationOptions;
struct PublicKeyCredentialData;
struct PublicKeyCredentialRequestOptions;
+struct SecurityOriginData;
}
namespace WebKit {
@@ -60,8 +61,8 @@
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
// Receivers.
- void makeCredential(WebCore::FrameIdentifier, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions&, RequestCompletionHandler&&);
- void getAssertion(WebCore::FrameIdentifier, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions&, RequestCompletionHandler&&);
+ void makeCredential(WebCore::FrameIdentifier, WebCore::SecurityOriginData&&, Vector<uint8_t>&& hash, WebCore::PublicKeyCredentialCreationOptions&&, RequestCompletionHandler&&);
+ void getAssertion(WebCore::FrameIdentifier, WebCore::SecurityOriginData&&, Vector<uint8_t>&& hash, WebCore::PublicKeyCredentialRequestOptions&&, RequestCompletionHandler&&);
void isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&&);
void handleRequest(WebAuthenticationRequestData&&, RequestCompletionHandler&&);
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in 2019-10-30 01:25:48 UTC (rev 251755)
@@ -26,8 +26,8 @@
messages -> WebAuthenticatorCoordinatorProxy {
- MakeCredential(WebCore::FrameIdentifier frameID, Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialCreationOptions options) -> (struct WebCore::PublicKeyCredentialData data, struct WebCore::ExceptionData exception) Async
- GetAssertion(WebCore::FrameIdentifier frameID, Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialRequestOptions options) -> (struct WebCore::PublicKeyCredentialData data, struct WebCore::ExceptionData exception) Async
+ MakeCredential(WebCore::FrameIdentifier frameID, struct WebCore::SecurityOriginData origin, Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialCreationOptions options) -> (struct WebCore::PublicKeyCredentialData data, struct WebCore::ExceptionData exception) Async
+ GetAssertion(WebCore::FrameIdentifier frameID, struct WebCore::SecurityOriginData origin, Vector<uint8_t> hash, struct WebCore::PublicKeyCredentialRequestOptions options) -> (struct WebCore::PublicKeyCredentialData data, struct WebCore::ExceptionData exception) Async
IsUserVerifyingPlatformAuthenticatorAvailable() -> (bool result) Async
}
Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp 2019-10-30 01:25:48 UTC (rev 251755)
@@ -34,6 +34,7 @@
#include <WebCore/PublicKeyCredentialCreationOptions.h>
#include <WebCore/PublicKeyCredentialData.h>
#include <WebCore/PublicKeyCredentialRequestOptions.h>
+#include <WebCore/SecurityOrigin.h>
namespace WebKit {
using namespace WebCore;
@@ -43,20 +44,20 @@
{
}
-void WebAuthenticatorCoordinator::makeCredential(const Frame& frame, const Vector<uint8_t>& hash, const PublicKeyCredentialCreationOptions& options, RequestCompletionHandler&& handler)
+void WebAuthenticatorCoordinator::makeCredential(const Frame& frame, const SecurityOrigin& origin, const Vector<uint8_t>& hash, const PublicKeyCredentialCreationOptions& options, RequestCompletionHandler&& handler)
{
auto* webFrame = WebFrame::fromCoreFrame(frame);
if (!webFrame)
return;
- m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::MakeCredential(webFrame->frameID(), hash, options), WTFMove(handler));
+ m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::MakeCredential(webFrame->frameID(), origin.data(), hash, options), WTFMove(handler));
}
-void WebAuthenticatorCoordinator::getAssertion(const Frame& frame, const Vector<uint8_t>& hash, const PublicKeyCredentialRequestOptions& options, RequestCompletionHandler&& handler)
+void WebAuthenticatorCoordinator::getAssertion(const Frame& frame, const SecurityOrigin& origin, const Vector<uint8_t>& hash, const PublicKeyCredentialRequestOptions& options, RequestCompletionHandler&& handler)
{
auto* webFrame = WebFrame::fromCoreFrame(frame);
if (!webFrame)
return;
- m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::GetAssertion(webFrame->frameID(), hash, options), WTFMove(handler));
+ m_webPage.sendWithAsyncReply(Messages::WebAuthenticatorCoordinatorProxy::GetAssertion(webFrame->frameID(), origin.data(), hash, options), WTFMove(handler));
}
void WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&& handler)
Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h (251754 => 251755)
--- branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h 2019-10-30 01:25:48 UTC (rev 251755)
@@ -39,8 +39,8 @@
private:
// WebCore::AuthenticatorCoordinatorClient
- void makeCredential(const WebCore::Frame&, const Vector<uint8_t>&, const WebCore::PublicKeyCredentialCreationOptions&, WebCore::RequestCompletionHandler&&) final;
- void getAssertion(const WebCore::Frame&, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions&, WebCore::RequestCompletionHandler&&) final;
+ void makeCredential(const WebCore::Frame&, const WebCore::SecurityOrigin&, const Vector<uint8_t>&, const WebCore::PublicKeyCredentialCreationOptions&, WebCore::RequestCompletionHandler&&) final;
+ void getAssertion(const WebCore::Frame&, const WebCore::SecurityOrigin&, const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions&, WebCore::RequestCompletionHandler&&) final;
void isUserVerifyingPlatformAuthenticatorAvailable(WebCore::QueryCompletionHandler&&) final;
WebPage& m_webPage;
Modified: branches/safari-608-branch/Tools/ChangeLog (251754 => 251755)
--- branches/safari-608-branch/Tools/ChangeLog 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Tools/ChangeLog 2019-10-30 01:25:48 UTC (rev 251755)
@@ -1,5 +1,83 @@
2019-10-29 Alan Coon <[email protected]>
+ Cherry-pick r251489. rdar://problem/56579665
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Source/WebCore:
+
+ Covered by new test contents within existing tests.
+
+ * Modules/webauthn/AuthenticatorCoordinator.cpp:
+ (WebCore::AuthenticatorCoordinator::create const):
+ (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
+ * Modules/webauthn/AuthenticatorCoordinatorClient.h:
+
+ Source/WebKit:
+
+ This patch makes WKFrameInfo available to clients via the above SPI. To do so,
+ SecuirtyOrigin of the caller document is passed from WebContent Process.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runWebAuthenticationPanel):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
+ * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+ (WebKit::AuthenticatorManager::runPanel):
+ * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
+ (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
+ (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
+ (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
+ * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
+ (WebKit::WebAuthenticatorCoordinator::makeCredential):
+ (WebKit::WebAuthenticatorCoordinator::getAssertion):
+ * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
+
+ Tools:
+
+ Adds new test contents into existing tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (-[TestWebAuthenticationPanelUIDelegate init]):
+ (-[TestWebAuthenticationPanelUIDelegate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
+ (-[TestWebAuthenticationPanelUIDelegate frame]):
+ (TestWebKitAPI::TEST):
+
+ LayoutTests:
+
+ * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+ Imporves the flakiness.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-22 Jiewen Tan <[email protected]>
+
+ [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
+ https://bugs.webkit.org/show_bug.cgi?id=202563
+ <rdar://problem/55973968>
+
+ Reviewed by Brent Fulgham.
+
+ Adds new test contents into existing tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+ (-[TestWebAuthenticationPanelUIDelegate init]):
+ (-[TestWebAuthenticationPanelUIDelegate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]):
+ (-[TestWebAuthenticationPanelUIDelegate frame]):
+ (TestWebKitAPI::TEST):
+
+2019-10-29 Alan Coon <[email protected]>
+
Cherry-pick r251295. rdar://problem/56579665
[WebAuthn] Implement AuthenticatorCancel
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (251754 => 251755)
--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm 2019-10-30 01:25:40 UTC (rev 251754)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm 2019-10-30 01:25:48 UTC (rev 251755)
@@ -72,12 +72,16 @@
@implementation TestWebAuthenticationPanelUIDelegate {
RetainPtr<TestWebAuthenticationPanelDelegate> _delegate;
BlockPtr<void(_WKWebAuthenticationPanelResult)> _callback;
+ RetainPtr<WKFrameInfo> _frameInfo;
}
- (instancetype)init
{
- if (self = [super init])
+ if (self = [super init]) {
self.isRacy = false;
+ self.isFake = false;
+ self.isNull = false;
+ }
return self;
}
@@ -84,6 +88,7 @@
- (void)_webView:(WKWebView *)webView runWebAuthenticationPanel:(_WKWebAuthenticationPanel *)panel initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(_WKWebAuthenticationPanelResult))completionHandler
{
webAuthenticationPanelRan = true;
+ _frameInfo = frame;
_delegate = adoptNS([[TestWebAuthenticationPanelDelegate alloc] init]);
ASSERT_NE(panel, nil);
@@ -102,6 +107,11 @@
completionHandler(_WKWebAuthenticationPanelResultPresented);
}
+- (WKFrameInfo *)frame
+{
+ return _frameInfo.get();
+}
+
@end
namespace TestWebKitAPI {
@@ -150,6 +160,16 @@
gPanel = nullptr;
}
+static void checkFrameInfo(WKFrameInfo *frame, bool isMainFrame, NSString *url, NSString *protocol, NSString *host, int port, WKWebView *webView)
+{
+ EXPECT_EQ(frame.mainFrame, isMainFrame);
+ EXPECT_TRUE([frame.request.URL.absoluteString isEqual:url]);
+ EXPECT_WK_STREQ(frame.securityOrigin.protocol, protocol);
+ EXPECT_WK_STREQ(frame.securityOrigin.host, host);
+ EXPECT_EQ(frame.securityOrigin.port, port);
+ EXPECT_EQ(frame.webView, webView);
+}
+
} // namesapce;
TEST(WebAuthenticationPanel, NoPanelTimeout)
@@ -210,6 +230,9 @@
[webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
Util::run(&webAuthenticationPanelRan);
Util::run(&webAuthenticationPanelSucceded);
+
+ // A bit of extra checks.
+ checkFrameInfo([delegate frame], true, [testURL absoluteString], @"file", @"", 0, webView.get());
}
#if HAVE(NEAR_FIELD)
@@ -387,10 +410,15 @@
auto delegate = adoptNS([[TestWebAuthenticationPanelUIDelegate alloc] init]);
[webView setUIDelegate:delegate.get()];
- [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:(id)makeString("http://localhost:", static_cast<unsigned>(server.port()))]]];
+ auto port = static_cast<unsigned>(server.port());
+ auto url = "" port);
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:(id)url]]];
Util::run(&webAuthenticationPanelRan);
[webView evaluateJavaScript:@"theFrame.src = ''" completionHandler:nil];
Util::run(&webAuthenticationPanelFailed);
+
+ // A bit of extra checks.
+ checkFrameInfo([delegate frame], false, (id)makeString(url, "/iFrame.html"), @"http", @"localhost", port, webView.get());
}
TEST(WebAuthenticationPanel, SubFrameDestructionHidCancel)