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
Realms and Compartments (as module-loaders) have a host-defined load hook and a resolve hook. In #50, we are considering ways that the host-defined hooks could be passed from host to guest. There is a way to make this work without ever revealing the loadHook or resolveHook to user code, only revealing their behavior as a side-effect of using a compartment. However, the design may be simpler if we simply revealed the host compartment’s hooks, for example as Compartment.loadHook and Compartment.resolveHook static methods, or like a parentLoadHook argument to loadHook.
Would it be possible to expose these functions such that user code could call it directly, or pass it to a new compartment?
Summary of the proposed hooks: loadHook(specifier: string) returns a promise for a “module descriptor”, which in turn may contain a StaticModuleRecord or a synthetic static module record. The descriptor may also provide a bag of importMeta properties, and other module descriptors indicate aliases from one specifier to another. The resolveHook is synchronous and produces memoization table keys from import specifiers and the referrer specifier.
The text was updated successfully, but these errors were encountered:
Which suggests, categorically, Node.js would be fine revealing its host hooks to guest code. So, we can narrow the question to whether browser vendors could do the same.
Realms and Compartments (as module-loaders) have a host-defined load hook and a resolve hook. In #50, we are considering ways that the host-defined hooks could be passed from host to guest. There is a way to make this work without ever revealing the loadHook or resolveHook to user code, only revealing their behavior as a side-effect of using a compartment. However, the design may be simpler if we simply revealed the host compartment’s hooks, for example as
Compartment.loadHook
andCompartment.resolveHook
static methods, or like aparentLoadHook
argument toloadHook
.Would it be possible to expose these functions such that user code could call it directly, or pass it to a new compartment?
Summary of the proposed hooks:
loadHook(specifier: string)
returns a promise for a “module descriptor”, which in turn may contain aStaticModuleRecord
or a synthetic static module record. The descriptor may also provide a bag ofimportMeta
properties, and other module descriptors indicate aliases from one specifier to another. TheresolveHook
is synchronous and produces memoization table keys from import specifiers and the referrer specifier.The text was updated successfully, but these errors were encountered: