Changeset 287957 in webkit


Ignore:
Timestamp:
Jan 12, 2022 3:45:51 PM (6 months ago)
Author:
J Pascoe
Message:

[WebAuthn] Fix freebie call without user gesture not being given
https://bugs.webkit.org/show_bug.cgi?id=235078
rdar://87327557

Reviewed by Brent Fulgham.

Source/WebKit:

This logic was previously always requiring a user gesture. The desired
behavior of giving pages a single "freebie" webauthn call without gesture
was lost in a refactor.

Tested manually on iOS device with webauthn.me.

  • WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:

(WebKit::WebAuthenticatorCoordinator::processingUserGesture):

Tools:

Updated API test to reflect user gesture freebie.

  • TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-no-mock.html:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r287955 r287957  
     12022-01-12  J Pascoe  <j_pascoe@apple.com>
     2
     3        [WebAuthn] Fix freebie call without user gesture not being given
     4        https://bugs.webkit.org/show_bug.cgi?id=235078
     5        rdar://87327557
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This logic was previously always requiring a user gesture. The desired
     10        behavior of giving pages a single "freebie" webauthn call without gesture
     11        was lost in a refactor.
     12
     13        Tested manually on iOS device with webauthn.me.
     14
     15        * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
     16        (WebKit::WebAuthenticatorCoordinator::processingUserGesture):
     17
    1182022-01-12  Brandon Stewart  <brandonstewart@apple.com>
    219
  • trunk/Source/WebKit/WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp

    r286785 r287957  
    127127{
    128128    auto processingUserGesture = UserGestureIndicator::processingUserGestureForMedia();
    129     if (!processingUserGesture && m_requireUserGesture)
     129    bool processingUserGestureOrFreebie = processingUserGesture || !m_requireUserGesture;
     130    if (!processingUserGestureOrFreebie)
    130131        m_webPage.addConsoleMessage(frameID, MessageSource::Other, MessageLevel::Warning, "User gesture is not detected. To use the WebAuthn API, call 'navigator.credentials.create' or 'navigator.credentials.get' within user activated events."_s);
     132
    131133    if (processingUserGesture && m_requireUserGesture)
    132134        m_requireUserGesture = false;
    133     else
     135    else if (!processingUserGesture)
    134136        m_requireUserGesture = true;
    135     return processingUserGesture || !m_requireUserGesture;
     137    return processingUserGestureOrFreebie;
    136138}
    137139
  • trunk/Tools/ChangeLog

    r287956 r287957  
     12022-01-12  J Pascoe  <j_pascoe@apple.com>
     2
     3        [WebAuthn] Fix freebie call without user gesture not being given
     4        https://bugs.webkit.org/show_bug.cgi?id=235078
     5        rdar://87327557
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Updated API test to reflect user gesture freebie.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-no-mock.html:
     12
    1132022-01-12  Elliott Williams  <emw@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-la-no-mock.html

    r260983 r287957  
    2121
    2222    navigator.credentials.create(options).then(credential => {
    23         // console.log("Succeeded!");
    2423        window.webkit.messageHandlers.testHandler.postMessage("Succeeded!");
    2524    }, error => {
    26         // console.log(error.message);
     25        // The first call will consume the freebie, the second will give the no user gesture error.
     26        navigator.credentials.create(options).then(credential => {
     27            window.webkit.messageHandlers.testHandler.postMessage("Succeeded!");
     28        }, error => {
     29            window.webkit.messageHandlers.testHandler.postMessage(error.message);
     30        });
    2731        window.webkit.messageHandlers.testHandler.postMessage(error.message);
    2832    });
Note: See TracChangeset for help on using the changeset viewer.