[w3c/browser-payment-api] updateWith() "InvalidStateError" DOMException (#544)

@domenic, in `updateWith()` step 2-4, are: 

> 2. Let request be the value of event's target attribute.
> 3. If request is not a PaymentRequest object, then throw a TypeError.
> 4. If the dispatch flag is unset, then throw an "InvalidStateError" DOMException.

It seems impossible to ever throw in 4 because an event's `.target` cannot be set without dispatching the event through another object (thus the dispatch flag is set). 

If we want to catch 4, we would need to swap it with 3. So:

```JS
const ev = new PaymentRequestUpateEvent("test");
ev.updateWith(Promise.resolve({})); // would throws InvalidStateError, not TypeError.
```

However, that seems slightly pointless - unless there is precedence in the platform to do that. 

WDTY? Swap 3-4, or just delete 4?  

 
  


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/544

Received on Tuesday, 6 June 2017 09:22:55 UTC