WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
190058
[Payment Request] Implement MerchantValidationEvent.methodName
https://bugs.webkit.org/show_bug.cgi?id=190058
Summary
[Payment Request] Implement MerchantValidationEvent.methodName
Andy Estes
Reported
2018-09-27 15:36:55 PDT
[Payment Request] Implement MerchantValidationEvent.methodName
Attachments
Patch
(10.17 KB, patch)
2018-09-27 15:42 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(14.63 KB, patch)
2018-09-29 08:38 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(14.76 KB, patch)
2018-09-29 11:09 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(14.98 KB, patch)
2018-10-01 10:32 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(15.20 KB, patch)
2018-10-01 11:27 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(11.84 KB, patch)
2018-10-28 06:12 PDT
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Andy Estes
Comment 1
2018-09-27 15:42:15 PDT
Comment hidden (obsolete)
Created
attachment 351014
[details]
Patch
EWS Watchlist
Comment 2
2018-09-27 15:45:19 PDT
Comment hidden (obsolete)
Attachment 351014
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:56: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3
2018-09-28 17:35:09 PDT
Comment on
attachment 351014
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=351014&action=review
> Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:486 > + m_paymentRequest->dispatchEvent(MerchantValidationEvent::create(eventNames().merchantvalidationEvent, WTF::get<URL>(m_identifier).string(), WTFMove(validationURL)).get());
I must admit I don’t understand why it’s guaranteed that m_identifier is a URL, and not some other type. But I do see this idiom elsewhere in the class so it must be OK.
> Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:49 > + if (!methodName.isEmpty() && !convertAndValidatePaymentMethodIdentifier(methodName)) > + return Exception { RangeError, makeString('"', methodName, "\" is an invalid payment method identifier.") };
If convertAndValidatePaymentMethodIdentifier is used elsewhere, I wonder if this exception is also needed elsewhere. Could share the code.
Andy Estes
Comment 4
2018-09-29 08:19:02 PDT
(In reply to Darin Adler from
comment #3
)
> Comment on
attachment 351014
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=351014&action=review
> > > Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:486 > > + m_paymentRequest->dispatchEvent(MerchantValidationEvent::create(eventNames().merchantvalidationEvent, WTF::get<URL>(m_identifier).string(), WTFMove(validationURL)).get()); > > I must admit I don’t understand why it’s guaranteed that m_identifier is a > URL, and not some other type. But I do see this idiom elsewhere in the class > so it must be OK.
Apple Pay's payment method identifier is always a URL (enforced by ApplePayPaymentHandler::handlesIdentifier). Given that, m_identifier could just be a URL. Alternatively, PaymentRequest::MethodIdentifier could just be a String. We only need to verify that URL-based identifiers have the correct properties (https, no username or password), but after that we can just store a string representation of the URL. I'll think about how to make this better.
> > > Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:49 > > + if (!methodName.isEmpty() && !convertAndValidatePaymentMethodIdentifier(methodName)) > > + return Exception { RangeError, makeString('"', methodName, "\" is an invalid payment method identifier.") }; > > If convertAndValidatePaymentMethodIdentifier is used elsewhere, I wonder if > this exception is also needed elsewhere. Could share the code.
Good call, I'll change this to return an ExceptionOr<PaymentRequest::MethodIdentifier>. Thanks for reviewing!
Andy Estes
Comment 5
2018-09-29 08:38:30 PDT
Comment hidden (obsolete)
Created
attachment 351182
[details]
Patch
EWS Watchlist
Comment 6
2018-09-29 08:39:52 PDT
Comment hidden (obsolete)
Attachment 351182
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:59: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andy Estes
Comment 7
2018-09-29 11:09:24 PDT
Comment hidden (obsolete)
Created
attachment 351188
[details]
Patch
EWS Watchlist
Comment 8
2018-09-29 11:12:50 PDT
Comment hidden (obsolete)
Attachment 351188
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:59: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 9
2018-09-30 19:35:13 PDT
Comment on
attachment 351188
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=351188&action=review
> Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:51 > + auto validatedMethodName = convertAndValidatePaymentMethodIdentifier(methodName); > + if (validatedMethodName.hasException()) > + return validatedMethodName.releaseException();
I think there is a missing line of code here: methodName = validatedMethodName.releaseReturnValue();
> Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h:45 > + static Ref<MerchantValidationEvent> create(const AtomicString& type, String methodName, URL&& validationURL);
Surprised that this uses String, and neither String&& or const String&.
Andy Estes
Comment 10
2018-10-01 10:25:14 PDT
(In reply to Darin Adler from
comment #9
)
> Comment on
attachment 351188
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=351188&action=review
> > > Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:51 > > + auto validatedMethodName = convertAndValidatePaymentMethodIdentifier(methodName); > > + if (validatedMethodName.hasException()) > > + return validatedMethodName.releaseException(); > > I think there is a missing line of code here: > > methodName = validatedMethodName.releaseReturnValue();
It's ok to use methodName as-is so long as the validation didn't raise an exception. I'm only interested in the exception, not the converted identifier.
> > > Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h:45 > > + static Ref<MerchantValidationEvent> create(const AtomicString& type, String methodName, URL&& validationURL); > > Surprised that this uses String, and neither String&& or const String&.
Yeah, I guess one copy is slightly better than one copy and one move.
Andy Estes
Comment 11
2018-10-01 10:32:10 PDT
Comment hidden (obsolete)
Created
attachment 351260
[details]
Patch
Andy Estes
Comment 12
2018-10-01 10:33:11 PDT
(In reply to Andy Estes from
comment #10
)
> (In reply to Darin Adler from
comment #9
) > > Comment on
attachment 351188
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=351188&action=review
> > > > > Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h:45 > > > + static Ref<MerchantValidationEvent> create(const AtomicString& type, String methodName, URL&& validationURL); > > > > Surprised that this uses String, and neither String&& or const String&. > > Yeah, I guess one copy is slightly better than one copy and one move.
Forgot to say: Changed to use const String&.
EWS Watchlist
Comment 13
2018-10-01 10:35:36 PDT
Comment hidden (obsolete)
Attachment 351260
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:59: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andy Estes
Comment 14
2018-10-01 11:27:32 PDT
Comment hidden (obsolete)
Created
attachment 351279
[details]
Patch
EWS Watchlist
Comment 15
2018-10-01 11:28:47 PDT
Comment hidden (obsolete)
Attachment 351279
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:59: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andy Estes
Comment 16
2018-10-28 06:12:41 PDT
Created
attachment 353256
[details]
Patch
EWS Watchlist
Comment 17
2018-10-28 06:13:47 PDT
Attachment 353256
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp:59: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 18
2018-10-28 07:34:20 PDT
Comment on
attachment 353256
[details]
Patch Clearing flags on attachment: 353256 Committed
r237521
: <
https://trac.webkit.org/changeset/237521
>
WebKit Commit Bot
Comment 19
2018-10-28 07:34:22 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 20
2018-10-28 07:35:31 PDT
<
rdar://problem/45620511
>
Andy Estes
Comment 21
2018-11-02 14:45:57 PDT
***
Bug 189548
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug