[Bug 25048] consider whether an IDL attribute of type Promise<T> should catch exceptions and wrap them up as a rejected Promise like they are for operations

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25048

--- Comment #6 from Cameron McCormack <cam@mcc.id.au> ---
(In reply to Domenic Denicola from comment #5)
> > Hmm, what if you had an IDL attribute of a Promise<T> type that throws when assigning?
> 
> Yeah, this is trickier to reason about---mainly because I don't know of a
> reasonable use case for promise attributes with setters. I assume there'd be
> coercion behavior, so e.g. for a Promise<long> attribute these would be fine:
> 
> foo.bar = 5;
> foo.bar = Promise.resolve(5);
> 
> but these would not:
> 
> foo.bar = {};
> foo.bar = Promise.resolve(function () { });
> 
> I would probably again argue that the result should be `foo.bar` set to a
> promise rejected with a `TypeError`, since people would access the result of
> the set via
> 
> foo.bar.then(processValueRepresentedByBar, couldNotGetValue);

That's my initial feeling too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Friday, 14 March 2014 02:37:20 UTC