You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
createRealm installs a full $262 on the new realm and returns it (#3044)
test262's INTERPRETING.md says $262.createRealm() "creates a new ECMAScript
Realm, defines this API on the new realm's global object, and returns the $262
property of the new realm's global object". Jint returned the bare global and
put only `global` and `evalScript` on it, so `otherGlobal.$262` was undefined
and `otherGlobal.$262.detachArrayBuffer` unreachable; `other.global` resolved
only because the global was made to point at itself.
Install(Engine) now delegates to a new Install(Engine, Realm) that builds the
whole API out of the target realm's intrinsics and returns it, with the realm's
global carrying it under `$262`. Every function on it is created through the
realm-pinned ClrFunction constructor, and the $262 object and the
%AbstractModuleSource% prototype are created with OrdinaryObjectCreate against
the realm's Object.prototype rather than Intrinsics.Object.Construct - a plain
construction lands on `new JsObject(engine)`, which takes whichever realm is
active, so the object would have come back wearing the caller's prototype.
IsHTMLDDA takes a realm for the same reason. createRealm is part of the API it
installs, so realms nest, and evalScript now always routes through
EvaluateInRealm, which also gains RetainFunctionSourceText.
`$262.global` exists at the top level too, which it did not before, and the
created realm's global no longer carries a `global` self-reference: across all
284 test262 files that call createRealm, `.global` and `.evalScript` are the
only properties ever read off the result, and nothing reads `.global` off the
global itself.
Frees staging/sm/TypedArray/set-wrapped.js. Its neighbour
constructor-buffer-sequence.js gets further but still fails, for a reason that
has nothing to do with realms - Jint evaluates ToIndex(length) before the
"byteOffset modulo elementSize" RangeError of InitializeTypedArrayFromArrayBuffer
step 3 - so it moves to a block of its own with that reason. The cross-realm
banner is reworded: error creation is not realm-blind in general, most built-ins
already throw through their own _realm; what is left is a handful of paths that
take the running realm instead of the called function's, for the throw and for
the allocated result alike.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments