Description was changed from ========== PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side) BUG= ========== to ...
3 years, 9 months ago
(2017-03-07 15:15:47 UTC)
#1
Description was changed from
==========
PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side)
BUG=
==========
to
==========
PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side)
The respondWith() method is used by the payment app to provide a
PaymentAppResponse when the payment successfully completes.
This CL includes a content-side implementation and browser test. Especially, add
a callback to InvokePaymentApp() in PaymentAppProvider. The callback is used to
pass a response data from payment app using respondWith().
Related Spec Link:
https://w3c.github.io/webpayments-payment-apps-api/#idl-def-paymentrequestevent
See the other CLs in this series:
[1/3] https://codereview.chromium.org/2715663002/ (RespondWithObserver)
[2/3] https://codereview.chromium.org/2705293010/ (blink side patch)
[3/3] This patch
BUG=661608
TEST=payment_app_browsertest.cc
==========
zino
Description was changed from ========== PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side) The respondWith() method ...
3 years, 9 months ago
(2017-03-07 15:18:55 UTC)
#2
Description was changed from
==========
PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side)
The respondWith() method is used by the payment app to provide a
PaymentAppResponse when the payment successfully completes.
This CL includes a content-side implementation and browser test. Especially, add
a callback to InvokePaymentApp() in PaymentAppProvider. The callback is used to
pass a response data from payment app using respondWith().
Related Spec Link:
https://w3c.github.io/webpayments-payment-apps-api/#idl-def-paymentrequestevent
See the other CLs in this series:
[1/3] https://codereview.chromium.org/2715663002/ (RespondWithObserver)
[2/3] https://codereview.chromium.org/2705293010/ (blink side patch)
[3/3] This patch
BUG=661608
TEST=payment_app_browsertest.cc
==========
to
==========
PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side)
The respondWith() method is used by the payment app to provide a
PaymentAppResponse when the payment successfully completes.
Related Spec Link:
https://w3c.github.io/webpayments-payment-apps-api/#idl-def-paymentrequestevent
See the other CLs in this series:
[1/3] https://codereview.chromium.org/2715663002/ (RespondWithObserver)
[2/3] This patch
[3/3] https://codereview.chromium.org/2718013004/ (content side and test)
BUG=661608
TEST=payment_app_browsertest.cc
==========
drive-by comments: https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h File third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h (right): https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h#newcode20 third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h:20: class MODULES_EXPORT PaymentRequestRespondWithObserver I feel this class ...
3 years, 9 months ago
(2017-03-08 01:39:25 UTC)
#6
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp (right): https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp#newcode45 third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp:45: default: I'd recommend not to use 'default' for WebServiceWorkerResponseError ...
3 years, 9 months ago
(2017-03-08 02:28:16 UTC)
#7
Thank you for input and reviews! I addressed your comments. PTAL. https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp File third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp (right): ...
3 years, 9 months ago
(2017-03-10 17:57:52 UTC)
#9
Thank you for input and reviews!
I addressed your comments. PTAL.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp
(right):
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp:45:
default:
On 2017/03/08 02:28:16, nhiroki (ooo until Mar 14) wrote:
> I'd recommend not to use 'default' for WebServiceWorkerResponseError because
> it's used from some APIs and this code could silently get broken if one of
them
> adds a very common error type.
Done.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.cpp:100:
DummyExceptionStateForTesting exceptionState;
On 2017/03/08 02:28:16, nhiroki (ooo until Mar 13) wrote:
> Using a dummy exception state looks strange. I don't know the proper way, but
> maybe you can get/create it from ExecutionContext/ScriptState...?
Done.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h
(right):
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h:18:
// This class observes the service worker's handling of a PaymentReqestEvent and
On 2017/03/08 02:28:16, nhiroki (ooo until Mar 14) wrote:
> s/PaymentReqestEvent/PaymentRequestEvent/
Done.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h:20:
class MODULES_EXPORT PaymentRequestRespondWithObserver
On 2017/03/08 01:39:25, shimazu (OOO till Mar 20) wrote:
> I feel this class could be placed under modules/payments/ rather than
> serviceworkers/ because it's used only for PaymentRequestEvent.
Done.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/serviceworkers/PaymentRequestRespondWithObserver.h:35:
protected:
On 2017/03/08 02:28:16, nhiroki (ooo until Mar 14) wrote:
> private?
Done.
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp (right):
https://codereview.chromium.org/2705293010/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp:344:
ScriptState::Scope scope(
On 2017/03/08 09:28:06, haraken wrote:
> On 2017/03/08 02:28:16, nhiroki (slow) wrote:
> > You enter the scope because toPaymentAppRequestData() internally uses
> > ScriptState, right? Can you add a comment about it here so that future
readers
> > can easily understand it?
>
> Alternately, how about making toPaymentAppRequest enter the ScriptState?
Done.
zino
Ping nhiroki@ and haraken@
3 years, 9 months ago
(2017-03-14 14:11:23 UTC)
#10
Ping nhiroki@ and haraken@
haraken
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp (right): https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp#newcode90 third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp:90: if (!scriptState || !scriptState->contextIsValid()) scriptState should not be null. ...
3 years, 9 months ago
(2017-03-14 16:15:52 UTC)
#11
Sorry for my delayed review. LGTM from ServiceWorker's point of view. https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp File third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp (right): ...
3 years, 9 months ago
(2017-03-16 13:24:47 UTC)
#12
Thank you for review. I left some comments. haraken@ Thanks :) https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp (right): ...
3 years, 9 months ago
(2017-03-16 13:47:31 UTC)
#13
nhiroki: Would there be any way to reduce code duplication with FetchRespondWithObserver? https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp ...
3 years, 9 months ago
(2017-03-16 15:16:52 UTC)
#17
nhiroki: Would there be any way to reduce code duplication with
FetchRespondWithObserver?
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp
(right):
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp:90:
if (!scriptState || !scriptState->contextIsValid())
On 2017/03/16 13:47:31, zino wrote:
> Sorry, I don't understand exactly.
> Did you mean that I have to use DCHECK instead of null check?
> Or is it unncessary to check whether it is null?
Yeah, you can use DCHECK.
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp
(right):
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:23:
const String getMessageForResponseError(WebServiceWorkerResponseError error) {
Would there be any way to avoid code duplication with FetchRespondWithObserver?
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:77:
getExecutionContext()->addConsoleMessage(ConsoleMessage::create(
On 2017/03/16 13:47:31, zino wrote:
> On 2017/03/14 16:15:51, haraken wrote:
> >
> > getExecutionContext() returns nullptr after the context gets detached.
> >
> > What should we do in that case?
>
> The PaymentRequestRespondWithObserver is derived from RespondWithObserver
> abstract class[1].
> So, if the context is gone, this function will not be called.
> In other words, the getExecutionContext() will be always non-null in this
> function.
> Therefore, I'll add a DCHECK in the next patch set.
>
> [1]
>
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/servic...
Makes sense. You're adding a bunch of getExecutionContext()'s to many methods in
this file, but are all the methods guaranteed not to be called after the context
detachment?
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:94:
exceptionState.clearException();
On 2017/03/16 13:47:31, zino wrote:
> On 2017/03/14 16:15:51, haraken wrote:
> >
> > Why is it okay to ignore the exception?
>
> I hoped to use the same pattern with existing code style.
> The onResponseRejected() takes WebServiceWorkerResponseError type instead of
> string or other values.
> IMHO, we don't need to make a new function to take other values or string.
>
> The pattern is already used in ForeignFetchRespondWithObserver.cpp [1].
>
> [1]
>
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/servic...
Makes sense.
zino
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp (right): https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp#newcode90 third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp:90: if (!scriptState || !scriptState->contextIsValid()) On 2017/03/16 15:16:52, haraken wrote: ...
3 years, 9 months ago
(2017-03-16 16:34:19 UTC)
#18
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp
(right):
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentAppRequestConversion.cpp:90:
if (!scriptState || !scriptState->contextIsValid())
On 2017/03/16 15:16:52, haraken wrote:
> On 2017/03/16 13:47:31, zino wrote:
> > Sorry, I don't understand exactly.
> > Did you mean that I have to use DCHECK instead of null check?
> > Or is it unncessary to check whether it is null?
>
> Yeah, you can use DCHECK.
Done.
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp
(right):
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:23:
const String getMessageForResponseError(WebServiceWorkerResponseError error) {
On 2017/03/16 15:16:52, haraken wrote:
>
> Would there be any way to avoid code duplication with
FetchRespondWithObserver?
>
It might be possible but the |request_url| will not display in the error message
in FetchEvent.
In the FetchRespondWithObserver, the getMessageForResponseError() function takes
|request_url| as well as |error|.
On the other hands, this getMessageForResponseError() only takes |error|.
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:77:
getExecutionContext()->addConsoleMessage(ConsoleMessage::create(
On 2017/03/16 15:16:52, haraken wrote:
> On 2017/03/16 13:47:31, zino wrote:
> > On 2017/03/14 16:15:51, haraken wrote:
> > >
> > > getExecutionContext() returns nullptr after the context gets detached.
> > >
> > > What should we do in that case?
> >
> > The PaymentRequestRespondWithObserver is derived from RespondWithObserver
> > abstract class[1].
> > So, if the context is gone, this function will not be called.
> > In other words, the getExecutionContext() will be always non-null in this
> > function.
> > Therefore, I'll add a DCHECK in the next patch set.
> >
> > [1]
> >
>
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/servic...
>
> Makes sense. You're adding a bunch of getExecutionContext()'s to many methods
in
> this file, but are all the methods guaranteed not to be called after the
context
> detachment?
Yeah, before my patch, the RespondWithObserver::responseWasReject() uses
ASSERT(getExecutionContext()); (other places as well)
Please see this comment: https://codereview.chromium.org/571843003#msg16
nhiroki
On 2017/03/16 15:16:52, haraken wrote: > nhiroki: Would there be any way to reduce code ...
3 years, 9 months ago
(2017-03-17 07:44:52 UTC)
#19
On 2017/03/16 15:16:52, haraken wrote:
> nhiroki: Would there be any way to reduce code duplication with
> FetchRespondWithObserver?
I think this is already deduped enough because the patch [1/3] factored out the
common code into RespondWithObserver and almost all code in
PaymentRequestRespondWithObserver is now PaymentRequestAPI specific.
nhiroki
https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp File third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp (right): https://codereview.chromium.org/2705293010/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp#newcode35 third_party/WebKit/Source/modules/payments/PaymentRequestEvent.cpp:35: if (m_observer) { On 2017/03/16 14:32:02, zino wrote: > ...
3 years, 9 months ago
(2017-03-17 07:45:12 UTC)
#20
LGTM https://codereview.chromium.org/2705293010/diff/100001/third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp File third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp (right): https://codereview.chromium.org/2705293010/diff/100001/third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp#newcode92 third_party/WebKit/Source/modules/payments/PaymentRequestRespondWithObserver.cpp:92: V8PaymentAppResponse::toImpl(toIsolate(getExecutionContext()), Can we use ScriptValue<PaymentAppResponse>::to(...) just like what ...
3 years, 9 months ago
(2017-03-17 11:55:57 UTC)
#21
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/409255)
3 years, 9 months ago
(2017-03-17 16:29:31 UTC)
#27
Issue 2705293010: PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side)
(Closed)
Created 3 years, 10 months ago by zino
Modified 3 years, 9 months ago
Reviewers: haraken, please use gerrit instead, nhiroki, shimazu
Base URL:
Comments: 38