Bug 229020 - ApplePaySession methods hold main thread for 250ms
Summary: ApplePaySession methods hold main thread for 250ms
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Other
Hardware: Mac (Apple Silicon) Other
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-11 20:58 PDT by finesserus
Modified: 2021-08-18 20:58 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description finesserus 2021-08-11 20:58:02 PDT
I face the bug in Safari 15.0 (17612.1.26.1.3) on macOS 12.0 Beta (21A5304g) on MacBook Air 2020 (M1).
I don't face the bug in Safari 15.0 on iOS 15.0 Beta (19A5307g) on iPhone 12 mini.
I don't face the bug in Safari TP 15.0 (16612.1.24.11.7) on macOS 11.5.1 on macBook Pro 15" 2015.
I don't face the bug in Safari 13.1.2 on iOS 13.6.1 on iPhone SE (1st gen).

Calling ApplePaySession.canMakePayments() holds the main JS thread for 250ms regardless. It takes less than 15ms in other versions of Safari.

Calling ApplePaySession.canMakePaymentsWithActiveCard('anyid') holds the main JS thread for 250ms when checking for Apple Pay is disabled in Safari settings. It takes less than 1ms in other versions of Safari (the synchronous part, no the promise resolution time).

In order to reproduce, open any HTTPS page and run the following code in the browser console:

    console.time('canMakePayments');
    console.log(ApplePaySession.canMakePayments());
    console.timeEnd('canMakePayments');
    console.time('canMakePaymentsWithActiveCard promise initialization');
    ApplePaySession.canMakePaymentsWithActiveCard('anyid').then(() => {
      console.timeEnd('canMakePaymentsWithActiveCard promise resolution');
    });
    console.timeEnd('canMakePaymentsWithActiveCard promise initialization');
    console.time('canMakePaymentsWithActiveCard promise resolution');

The "canMakePayments" and "canMakePaymentsWithActiveCard promise initialization" durations are expected to be small (<16ms) in order not to block the browser.
Comment 1 finesserus 2021-08-11 20:59:46 PDT
Update: in order to reproduce, disable checking for Apple Pay in Safari settings, open any HTTPS page and run the code from the previous message
Comment 2 finesserus 2021-08-11 21:10:42 PDT
I've tried to disable all the Safari extensions, the result is the same.
Comment 3 finesserus 2021-08-15 23:44:56 PDT
I face the bug in Safari 14.1 (16611.1.21.161.1) on macOS 11.3.1 on MacBook Pro 2020 (M1) with a couple of debit cards added to the Apple Pay. So the issue can be caused by the hardware, not the software.
Comment 4 Radar WebKit Bug Importer 2021-08-18 20:58:15 PDT
<rdar://problem/82108249>