New issue
Advanced search Search tips

Issue 763784 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug


Participants' hotlists:
Payment-Interop


Sign in to add a comment

PaymentRequest Event registration seems broken

Reported by mcace...@mozilla.com, Sep 11 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3212.0 Safari/537.36

Steps to reproduce the problem:
1. Got to https://w3c-test.org/payment-request/algorithms-manual.https.html
2. Follow the instructions for the manual tests. 
3. Test 2 will get stuck, and test 3 won't work at all. 

If you debug the test, you will see that the listeners promises never resolve - the events never seem to get fired. 

What is the expected behavior?
Expect all the two event listeners AND the event handler to all fire. Right now, only the hander is firing. 

What went wrong?
In test 2, when the events get registered, the listeners don't fire and the tests get stuck. 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 63.0.3212.0  Channel: canary
OS Version: OS X 10.12.6
Flash Version: 

It seems to be order dependent... it's as if the handler trashes the listener registration.
 
Owner: rouslan@chromium.org
Status: Assigned (was: Unconfirmed)
Thank you for the report. I will look into it.
This is happening because updateWith() in the handler stops event propagation, so the listeners don't get fired after the handler. Not supposed to happen?
The "immediate" propagation is stopped in the code.
Cc: mek@chromium.org
Marijn: Do you know much about immediate event propagation? The PR spec says:

"Set event's stop propagation flag and stop immediate propagation flag."

https://w3c.github.io/payment-request/#idl-def-paymentrequestupdateevent-updatewith(detailspromise)

It's relying on the DOM spec to resume immediate event propagation per:

https://dom.spec.whatwg.org/#dispatching-events

Blink does this in EventDispatcher::DispatchEventPostProcess, but that appears to be too late for us:

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/events/EventDispatcher.cpp?rcl=defd75b9fb377e866044db43128cd2d9f366f17d&l=272

Do you know why that could be happening? I certainly could re-enable immediate event propagation in PaymentRequestUpdateEvent::OnUpdatePaymentDetails, but I'm not sure whether that would be correct.

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp?rcl=3131414035a033d1fb624913474dbdac04158198&l=132

Comment 5 by mek@chromium.org, Sep 26 2017

As you point out, the spec says to stop (immediate) event propagation when updateWith is called, so it seems like our implementation matches the spec (and the test doesn't match the spec). So doesn't seem like there is anything wrong here? (other than the test that is)
Marcos: You wrote both the spec and the test. Is there a discrepancy? 

Comment 7 by mar...@marcosc.com, Sep 27 2017

We might need to bring in Domenic here (`git blame` on the spec blames him for this one 😸) - but I'm sure he had a good reason for setting both propagation flags. 

Personally, I think it would be weird/racy for developers if not all listeners get called, so this might be a spec bug? 
Cc: domenic@chromium.org
Domenic: Please see Marcos's comment #7.
I believe the idea is that, like with other updateWith()-esque methods, once one listener has updated, other listeners can't interfere. It's "first past the post", so to speak.

What would you expect to happen if two listeners called updateWith()?
First one wins, other throws. But I was thinking that being notified that the address or shipping option has changed is useful on its own, even if the second one doesn’t call .updateWith().
I’ve given this more thought and now agree we should change the test to match the spec. There is no case that can’t be covered by having the single handler. 

Apologies for the noise - will get that fixed up in the next few days.

Comment 12 by mar...@marcosc.com, Sep 28 2017

Filed https://github.com/w3c/web-platform-tests/issues/7516 

Please feel free to close this bug as invalid. 
Status: WontFix (was: Assigned)
Thank you for the clarification.

Sign in to add a comment