Skip to content

Commit 688df8c

Browse files
committed
Specify that returned Promises are created in the relevant realm
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
1 parent 5a20e34 commit 688df8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.bs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7855,11 +7855,15 @@ objects.
78557855
An ECMAScript value |V| is [=converted to an IDL value|converted=]
78567856
to an IDL <a interface lt="Promise">Promise<var ignore>T</var></a> value as follows:
78577857

7858-
1. Let |promise| be [=!=] <a abstract-op>Call</a>({{%Promise_resolve%}}, {{%Promise%}}, «|V|»).
7858+
1. Let |realm| be the [=relevant Realm=] of the |this| value that led to the execution of this algorithm.
7859+
1. Let |promise| be [=!=] <a abstract-op>Call</a>(|realm|.\[[Intrinsics]].[[{{%Promise_resolve%}}]], |realm|.\[[Intrinsics]].[[{{%Promise%}}]], «|V|»).
78597860
1. Return the IDL [=promise type=] value that is a reference to the
78607861
same object as |promise|.
78617862
</div>
78627863

7864+
Issue: The relevant |this| value is not always well-defined; see
7865+
<a href="https://github.com/heycam/webidl/issues/135">#135</a> for discussion.
7866+
78637867
<p id="promise-to-es">
78647868
The result of [=converted to an ECMAScript value|converting=]
78657869
an IDL [=promise type=] value to an ECMAScript

0 commit comments

Comments
 (0)