Title: [252248] trunk
Revision
252248
Author
[email protected]
Date
2019-11-08 11:44:34 -0800 (Fri, 08 Nov 2019)

Log Message

[WebAuthn] Return NotAllowedError immediately for UI cancellations
https://bugs.webkit.org/show_bug.cgi?id=203937
<rdar://problem/56962420>

Reviewed by Brent Fulgham.

Source/WebKit:

NotAllowedError representing UI cancellations should be returned to sites
immediately such that sites could show appropriate error page immediately.

Covered by existing tests.

* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::cancelRequest):
(WebKit::AuthenticatorManager::clearState):
(WebKit::AuthenticatorManager::resetState): Deleted.
* UIProcess/WebAuthentication/AuthenticatorManager.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (252247 => 252248)


--- trunk/Source/WebKit/ChangeLog	2019-11-08 19:37:54 UTC (rev 252247)
+++ trunk/Source/WebKit/ChangeLog	2019-11-08 19:44:34 UTC (rev 252248)
@@ -1,3 +1,22 @@
+2019-11-06  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Return NotAllowedError immediately for UI cancellations
+        https://bugs.webkit.org/show_bug.cgi?id=203937
+        <rdar://problem/56962420>
+
+        Reviewed by Brent Fulgham.
+
+        NotAllowedError representing UI cancellations should be returned to sites
+        immediately such that sites could show appropriate error page immediately.
+
+        Covered by existing tests.
+
+        * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
+        (WebKit::AuthenticatorManager::cancelRequest):
+        (WebKit::AuthenticatorManager::clearState):
+        (WebKit::AuthenticatorManager::resetState): Deleted.
+        * UIProcess/WebAuthentication/AuthenticatorManager.h:
+
 2019-11-08  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Add pointer lock permission request API

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (252247 => 252248)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2019-11-08 19:37:54 UTC (rev 252247)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2019-11-08 19:44:34 UTC (rev 252248)
@@ -198,7 +198,9 @@
     RELEASE_ASSERT(RunLoop::isMain());
     if (!m_pendingCompletionHandler || m_pendingRequestData.panel.get() != &panel)
         return;
-    resetState();
+    invokePendingCompletionHandler(ExceptionData { NotAllowedError, "This request has been cancelled by the user."_s });
+    clearState();
+    m_requestTimeOutTimer.stop();
 }
 
 void AuthenticatorManager::clearStateAsync()
@@ -214,7 +216,9 @@
 {
     if (m_pendingCompletionHandler)
         return;
-    resetState();
+    m_authenticators.clear();
+    m_services.clear();
+    m_pendingRequestData = { };
 }
 
 void AuthenticatorManager::authenticatorAdded(Ref<Authenticator>&& authenticator)
@@ -354,13 +358,6 @@
     m_pendingCompletionHandler(WTFMove(respond));
 }
 
-void AuthenticatorManager::resetState()
-{
-    m_authenticators.clear();
-    m_services.clear();
-    m_pendingRequestData = { };
-}
-
 void AuthenticatorManager::restartDiscovery()
 {
     for (auto& service : m_services)

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h (252247 => 252248)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2019-11-08 19:37:54 UTC (rev 252247)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2019-11-08 19:44:34 UTC (rev 252248)
@@ -92,7 +92,6 @@
     void initTimeOutTimer();
     void timeOutTimerFired();
     void runPanel();
-    void resetState();
     void restartDiscovery();
     TransportSet getTransports() const;
 

Modified: trunk/Tools/ChangeLog (252247 => 252248)


--- trunk/Tools/ChangeLog	2019-11-08 19:37:54 UTC (rev 252247)
+++ trunk/Tools/ChangeLog	2019-11-08 19:44:34 UTC (rev 252248)
@@ -1,3 +1,14 @@
+2019-11-06  Jiewen Tan  <[email protected]>
+
+        [WebAuthn] Return NotAllowedError immediately for UI cancellations
+        https://bugs.webkit.org/show_bug.cgi?id=203937
+        <rdar://problem/56962420>
+
+        Reviewed by Brent Fulgham.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+        (TestWebKitAPI::TEST):
+
 2019-11-08  Aakash Jain  <[email protected]>
 
         [ews] Prioritize builders over testers when a bot is shared over multiple queues

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (252247 => 252248)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2019-11-08 19:37:54 UTC (rev 252247)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2019-11-08 19:44:34 UTC (rev 252248)
@@ -558,9 +558,8 @@
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
     Util::run(&webAuthenticationPanelRan);
     [[delegate panel] cancel];
-    [webView waitForMessage:@"Operation timed out."];
-    EXPECT_FALSE(webAuthenticationPanelFailed);
-    EXPECT_FALSE(webAuthenticationPanelSucceded);
+    [webView waitForMessage:@"This request has been cancelled by the user."];
+    EXPECT_TRUE(webAuthenticationPanelFailed);
 }
 
 TEST(WebAuthenticationPanel, PanelHidCtapNoCredentialsFound)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to