Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify that returned Promises are created in the relevant realm #598

Closed
wants to merge 1 commit into from

Conversation

littledan
Copy link
Collaborator

@littledan littledan commented Dec 12, 2018

Note that these semantics differ from JavaScript async functions, which
create a Promise in the current Realm.

Verified in Chromium and Firefox that HTMLImageElement.decode and
CustomElementsRegistry.whenDefined return Promise instances from
the relevant realm.

(I'm not sure what's the preferred way to typeset "this", or if it would
be preferred to thread it explicitly through the algorithm. Also, it's
not quite necessary to use the relevant Promise.resolve function, since
resolve effectively uses the relevant realm of its receiver(!))

Resolves part of #135


Preview | Diff

Note that these semantics differ from JavaScript async functions, which
create a Promise in the current Realm.

Verified in Chromium and Firefox that HTMLImageElement.decode and
CustomElementsRegistry.whenDefined return Promise instances from
the relevant realm.

(I'm not sure what's the preferred way to typeset "this", or if it would
be preferred to thread it explicitly through the algorithm. Also, it's
not quite necessary to use the relevant Promise.resolve function, since
resolve effectively uses the relevant realm of its receiver(!))

Resolves part of whatwg#135
@annevk
Copy link
Member

annevk commented Dec 12, 2018

We don't have a convention yet for "this", but it would be really great if we made it available on the IDL side of things as well (i.e., for specification algorithms). https://www.w3.org/Bugs/Public/show_bug.cgi?id=27301 requested that a long time ago. #495 adds it, but couples it with other things that were harder to reach agreement on.

@Ms2ger
Copy link
Member

Ms2ger commented Dec 12, 2018

It seems kinda strange to refer to a this value in #dfn-convert-ecmascript-to-idl-value. Should we pass a Realm into all variants of that algorithm?

@littledan
Copy link
Collaborator Author

OK, seems like this patch (as well as #595) will need to block on the infrastructure for this.

@Ms2ger
Copy link
Member

Ms2ger commented Jan 14, 2019

Related: #371

@annevk annevk added the do not merge yet Pull request must not be merged per rationale in comment label Jan 31, 2019
@annevk
Copy link
Member

annevk commented Apr 30, 2020

We now have "this". Do you still wish to pursue this?

@Ms2ger
Copy link
Member

Ms2ger commented Apr 30, 2020

Note that we don't have this in the "converted to an IDL value" algorithm. I don't think this PR makes a great deal of sense without fixing #371 first.

@domenic
Copy link
Member

domenic commented Aug 2, 2021

Let's close this and continue trying for the more ambitious plan in #135 (comment).

@domenic domenic closed this Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge yet Pull request must not be merged per rationale in comment
Development

Successfully merging this pull request may close these issues.

4 participants