Title: [252327] branches/safari-608.4.9.1-branch
Revision
252327
Author
[email protected]
Date
2019-11-11 09:07:04 -0800 (Mon, 11 Nov 2019)

Log Message

Cherry-pick r252248. rdar://problem/57058391

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.4.9.1-branch/Source/WebKit/ChangeLog (252326 => 252327)


--- branches/safari-608.4.9.1-branch/Source/WebKit/ChangeLog	2019-11-11 16:58:25 UTC (rev 252326)
+++ branches/safari-608.4.9.1-branch/Source/WebKit/ChangeLog	2019-11-11 17:07:04 UTC (rev 252327)
@@ -1,3 +1,52 @@
+2019-11-11  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r252248. rdar://problem/57058391
+
+    [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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-10  Kocsen Chung  <[email protected]>
 
         Cherry-pick r252297. rdar://problem/57058404

Modified: branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp (252326 => 252327)


--- branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2019-11-11 16:58:25 UTC (rev 252326)
+++ branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.cpp	2019-11-11 17:07:04 UTC (rev 252327)
@@ -188,7 +188,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()
@@ -204,7 +206,9 @@
 {
     if (m_pendingCompletionHandler)
         return;
-    resetState();
+    m_authenticators.clear();
+    m_services.clear();
+    m_pendingRequestData = { };
 }
 
 void AuthenticatorManager::authenticatorAdded(Ref<Authenticator>&& authenticator)
@@ -347,13 +351,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: branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h (252326 => 252327)


--- branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2019-11-11 16:58:25 UTC (rev 252326)
+++ branches/safari-608.4.9.1-branch/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h	2019-11-11 17:07:04 UTC (rev 252327)
@@ -91,7 +91,6 @@
     void timeOutTimerFired();
     void runPanel();
     void startRequest();
-    void resetState();
     void restartDiscovery();
 
     // Request: We only allow one request per time. A new request will cancel any pending ones.

Modified: branches/safari-608.4.9.1-branch/Tools/ChangeLog (252326 => 252327)


--- branches/safari-608.4.9.1-branch/Tools/ChangeLog	2019-11-11 16:58:25 UTC (rev 252326)
+++ branches/safari-608.4.9.1-branch/Tools/ChangeLog	2019-11-11 17:07:04 UTC (rev 252327)
@@ -1,3 +1,44 @@
+2019-11-11  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r252248. rdar://problem/57058391
+
+    [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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-05  Alan Coon  <[email protected]>
 
         Apply patch. rdar://problem/56903274

Modified: branches/safari-608.4.9.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (252326 => 252327)


--- branches/safari-608.4.9.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2019-11-11 16:58:25 UTC (rev 252326)
+++ branches/safari-608.4.9.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2019-11-11 17:07:04 UTC (rev 252327)
@@ -510,9 +510,8 @@
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
     Util::run(&webAuthenticationPanelRan);
     [gPanel 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