diff --git a/source b/source index 3bc951b106c..7f92362b4c1 100644 --- a/source +++ b/source @@ -89564,8 +89564,8 @@ dictionary DragEventInit : MouseEventInit {
Let value be originalDesc.[[Value]].
If IsCallable(value) is true, then set value to - an anonymous built-in function, created in the current principal realm, that - performs the same steps as the IDL operation P on object O.
Set crossOriginDesc to PropertyDescriptor{ [[Value]]: value, @@ -89582,14 +89582,14 @@ dictionary DragEventInit : MouseEventInit {
Let crossOriginGet be undefined.
If e.[[NeedsGet]] is true, then set crossOriginGet to an - anonymous built-in function, created in the current principal realm, that - performs the same steps as the getter of the IDL attribute P on object + anonymous built-in function, created in the current realm, that performs the + same steps as the getter of the IDL attribute P on object O.
Let crossOriginSet be undefined.
If e.[[NeedsSet]] is true, then set crossOriginSet to an - anonymous built-in function, created in the current principal realm, that + anonymous built-in function, created in the current realm, that performs the same steps as the setter of the IDL attribute P on object O.
The agent equivalent of the current principal realm is the - surrounding agent.
+The agent equivalent of the current realm or + current principal realm is the surrounding agent.
@@ -106479,6 +106479,28 @@ new PaymentRequest(…); // Allowed to use object's relevant agent's event loop. +Each synthetic realm has an associated synthetic realm settings object + with the following fields:
+ +An execution context
The JavaScript execution context for the scripts within this realm.
A principal realm
The principal realm which this synthetic realm exists within.
A module map
A module map that is used when importing JavaScript modules.
A global object is a JavaScript object that is the [[GlobalObject]] field of @@ -106608,32 +106630,7 @@ new PaymentRequest(…); // Allowed to use
Return realm execution context.
Each synthetic realm has an associated synthetic realm settings object - with the following fields:
- -An execution context
The JavaScript execution context for the scripts within this realm.
A principal realm
The principal realm which this synthetic realm exists within.
A module map
A module map that is used when importing JavaScript modules.
Synthetic realms are created with global objects which are initialized by the JavaScript specification's - SetDefaultGlobalBindings algorithm. Synthetic - global objects implement only certain specifically exposed interfaces.
+Analogously, there is always a 1-to-1-to-1 mapping between synthetic realms, synthetic global
@@ -106726,9 +106723,9 @@ new PaymentRequest(…); // Allowed to use
When defining algorithm steps throughout this specification, it is often important to indicate
- what principal realm is to be used—or, equivalently, what principal global
- object or environment settings object is to be used. In general, there are at
- least four possibilities:
The incumbent realm is that of b.html
.
The current principal realm is that of The current realm is that of c.html
(since it is the print()
method from
c.html
whose code is running).
The relevant realm of the object on which @@ -106868,13 +106865,13 @@ new PaymentRequest(…); // Allowed to use </script>
If the algorithm for the getBattery()
method
- had instead used the current principal realm, all the results would be reversed.
- That is, after the first call to getBattery()
in
- outer.html
, the Navigator
object in current realm, all the results would be reversed. That is,
+ after the first call to
function would thus return a promise from the "wrong" realm. Since
+ this is undesirable, the algorithm instead uses the relevant realm, giving the sensible results indicated in
the comments above.getBattery()
in outer.html
, the Navigator
object in inner.html
would be permanently storing a Promise
object
created in outer.html
's realm, and calls like that inside the
- hello()
function would thus return a promise from the "wrong" realm.
- Since this is undesirable, the algorithm instead uses the hello()
Note that the current realm, unlike the entry, incumbent and - relevant concepts, can refer to a synthetic realm. Almost all uses of the "current" - concept in this document and other Web specifications need to refer to the current principal - realm as well. One exception is JavaScript module processing, as synthetic realms have a separate set of module instances (derived from a common - module map across the shared environment settings object).
-Then, the current principal settings object is the environment settings object of the current principal realm.
Similarly, the current principal global object is the global object of the current principal realm.
+ data-x="concept-realm-global">global object of the + current principal realm. + +Note that the current realm can refer to a synthetic realm. + Whether to use the "current" or "current principal" concept depends on the situation. + It appears to be the case that in most situations where a realm is needed, + the current realm is a better choice than the current principal realm, + while it is more likely that for a settings object, the current principal settings object + is to be used; notably the settings object for a synthetic realm contains much less + information. + Note that in the context of APIs that are not exposed in a synthetic realm, both + concepts coincide.