[heycam/webidl] Realm to use for promises (#932)

I think we should give more advice to specifications how to deal with promises and realms.

I think typically promises are created in the relevant realm of this.

However, this might lead to inconsistencies for immediately rejected promises depending on how they are implemented. Implementations might rely on throwing being tackled by the IDL layer, which would use the current realm for such rejected promises.

Given what we have, the simplest advice to me would be that for promise-returning methods you throw in the synchronous section and let IDL deal with it, and create a promise in the relevant realm of this that you return at the end of the synchronous section (and operate on in the in parallel part).

This is fairly subjective though so I would love to hear other perspectives.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/932

Received on Thursday, 15 October 2020 09:14:47 UTC