Closed anba closed 10 years ago
Oh man, I totally thought it was required. More evidence for the thenable coercion map being more trouble than it's worth (#79).
Thanks so much for finding these types of things; much appreciated to have this kind of close inspection.
It's not really close inspection, but rather a picky Java compiler. :-p
@anba you just ruined the mystery, i can't look at your username the same anymore.
@amba
It is not required for Callable objects to have a [[Realm]] internal slot, so the access to [[Realm]]
Actually, the intent is that [[Realm]] is required: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects
Do you think that requirement needs to be more clearly stated in 9.3?
@allenwb Non-standard, callable objects are not required to have a [[Realm]] property. Per 6.1.7.2, Table 6, callable objects are only required to have a [[Callable]] internal method.
Oh, and bound function exotic objects and proxied functions also do not have a [[Realm]] internal slot. Test case from my repo: Array/prototype/concat_realm.js.
@anba Created https://bugs.ecmascript.org/show_bug.cgi?id=2411 to cover this.
Basically any callable that requires access to any intrinsic objects must have a [[Realm] association. This isn't a problem for bond functions because its [[Call]] does not access any intrinsics. However, Proxy internal methods do. This seems to suggest that all Proxy object must have a [[Realm]] slot.
Basically any callable that requires access to any intrinsic objects must have a [[Realm] association.
I don't fully understand this requirement. Normally access to intrinsics is controlled through the running execution context, so in this case, any intrinsic object created within a Proxy internal method is from the same realm as the execution context which was active when the internal method was called. Adding a [[Realm]] slot to Proxy objects won't alter this behaviour, unless Proxy internal methods are changed to push a new frame on the execution context stack.
It is not required for Callable objects to have a [[Realm]] internal slot, so the access to [[Realm]] in ExecutePromiseReaction, step 3 should be guarded with an if-condition. Also see GetPrototypeFromConstructor for a similar guard.