Bug 205730 - [Apple Pay] Provide a better error message when Apple Pay blocks user agent script evaluation
Summary: [Apple Pay] Provide a better error message when Apple Pay blocks user agent s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andy Estes
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-03 09:54 PST by Andy Estes
Modified: 2020-01-03 14:31 PST (History)
5 users (show)

See Also:


Attachments
Patch (8.87 KB, patch)
2020-01-03 09:55 PST, Andy Estes
no flags Details | Formatted Diff | Diff
Patch (8.94 KB, patch)
2020-01-03 10:54 PST, Andy Estes
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2020-01-03 09:54:20 PST
[Apple Pay] Provide a better error message when Apple Pay blocks user agent script evaluation
Comment 1 Andy Estes 2020-01-03 09:55:55 PST
Created attachment 386692 [details]
Patch
Comment 2 Brady Eidson 2020-01-03 10:51:12 PST
Comment on attachment 386692 [details]
Patch

Andy and I discussed some refinements to the error message text IRL.
Comment 3 Alex Christensen 2020-01-03 10:52:19 PST
Comment on attachment 386692 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=386692&action=review

> Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp:162
> +    return "Unable to run user agent scripts because this document uses Apple Pay. Apple Pay can be disabled in this web view by injecting a WKUserScript."_s;

This is confusing.  It seems like it's unable to run scripts because of Apple Pay, but running scripts can disable Apple Pay.  "user agent scripts" is unclear.
I think what you're trying to say is that to run scripts using evaluteJavaScript on pages that try to use Apple Pay, use WKUserScripts to disable Apple Pay.  Is that correct?
Comment 4 Andy Estes 2020-01-03 10:54:18 PST
Created attachment 386698 [details]
Patch
Comment 5 Andy Estes 2020-01-03 10:56:03 PST
(In reply to Alex Christensen from comment #3)
> Comment on attachment 386692 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=386692&action=review
> 
> > Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp:162
> > +    return "Unable to run user agent scripts because this document uses Apple Pay. Apple Pay can be disabled in this web view by injecting a WKUserScript."_s;
> 
> This is confusing.  It seems like it's unable to run scripts because of
> Apple Pay, but running scripts can disable Apple Pay.  "user agent scripts"
> is unclear.

It was confusing :(

> I think what you're trying to say is that to run scripts using
> evaluteJavaScript on pages that try to use Apple Pay, use WKUserScripts to
> disable Apple Pay.  Is that correct?

That's correct.
Comment 6 Andy Estes 2020-01-03 11:01:40 PST
Posted a new patch with the refinements Brady suggested.
Comment 7 Andy Estes 2020-01-03 14:30:17 PST
Committed r254015: <https://trac.webkit.org/changeset/254015>
Comment 8 Radar WebKit Bug Importer 2020-01-03 14:31:19 PST
<rdar://problem/58307301>