-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add hooks for all implementation-defined/host behaviour (that's possible at realm level) #210
Comments
This level of control can be exercised at the evaluator level, the realm will not provide any hooks. I have tagged accordingly, so we can move it to the other repo at some point. |
@caridy so none of these hooks (particularly HostEnsureCanCompileStrings) will be provided by this api? |
correct! no hooks at the Realm level. Eventually, once a Realm Object is created, it can resolve what parameterized evaluator it belongs to (if any), and use that as a host, providing the level of control that you might need at the evaluator level. |
@caridy would it be possible to link to this "parameterized evaluator" in the proposal repo somewhere, combine the information, etc? I'm finding it incredibly difficult to get a complete picture of what the realms api is, what "parameterized evaluators" are, how they fit together, etc. |
The "parameterized evaluator" is now the attn @jfparadis The SES group have not yet discussed the semantics of A consequence of this decision is that the |
@erights so to verify if i understand this... Realms will not include methods for evaluation, just the ability to create new realm records from js. Compartments are like Realms except that they inherit their intrinsics from a realm instead of creating their own from scratch. Compartments would expose the methods for actually running scripts and modules. Something like this? (pseudo-ish code): const r = new Realm(global inits and whatnot);
// r.lockdown() // optionally call if you need frozen
const c = r.createCompartment(hooks and whatnot);
c.evaluateScript('1 + 1'); |
yes! As explained in the talk, the sooner we stop using the term "realm record" the better. The per-realm info is the shared intrinsics. (or shared primordials depending on where the definitions settle attn @allenwb ). The record-formerly-known-as-realm-record is now per-compartment rather than per-realm. |
I previously opened this issue on the SES proposal but decided to open it here as well as it's relevant for all Realms not just SES ones.
ECMA262 has a number of "implementation-defined" and "host" defined operations.
It would be nice to be able to hook into any of these when creating a new Realm e.g.:
This is a list of things that are marked as implementation-defined or host operations in ECMA262:
Should include in realms:
HostResolveImportedModule
HostImportModuleDynamically
InitializeHostDefinedRealm
makeRootRealm
but using an exotic object (e.g.Proxy
) as the global isn't currently available in the current proposalglobalThis
HostHasSourceTextAvailable
NativeError
messageLocalTZA
TimeZoneString
locale
or add hooks to provide implementation of.localeCompare()
/etcHostPromiseRejectionTracker
Math.random()
Date.now
/new Date()
HostEnsureCanCompileStrings
Unnecessary or not at the realm level:
RunJobs
EnqueueJob
[[Call]]
[[Construct]]
[[Call]]
debugger
HostReportErrors
try
/catch
can be used directly when creating/evaluating modules/scripts to do the same[[IsHTMLDDA]]
hostDefined
in Script/Module recordsMap
/WeakMap
host-synchronizes-with
and other atomics stuffThe text was updated successfully, but these errors were encountered: