PaymentRequest Event registration seems broken
Reported by
mcace...@mozilla.com,
Sep 11 2017
|
||||
Issue descriptionUserAgent: 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.
,
Sep 26 2017
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?
,
Sep 26 2017
The "immediate" propagation is stopped in the code.
,
Sep 26 2017
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
,
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)
,
Sep 26 2017
Marcos: You wrote both the spec and the test. Is there a discrepancy?
,
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?
,
Sep 27 2017
Domenic: Please see Marcos's comment #7.
,
Sep 27 2017
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()?
,
Sep 27 2017
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().
,
Sep 28 2017
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.
,
Sep 28 2017
Filed https://github.com/w3c/web-platform-tests/issues/7516 Please feel free to close this bug as invalid.
,
Sep 28 2017
Thank you for the clarification. |
||||
►
Sign in to add a comment |
||||
Comment 1 by rouslan@chromium.org
, Sep 11 2017Status: Assigned (was: Unconfirmed)