-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 Module Loader runtime objects #1472
Add Module Loader runtime objects #1472
Conversation
Based on the W3C Module Loader spec: https://whatwg.github.io/loader Includes more or less complete implementations of the runtime objects: %Registry% %RegistryPrototype% %Loader% %LoaderPrototype% %ModuleStatus% %ModuleStatusPrototype% Includes a stub implementation of %Module%. Most of the abstract operations in the spec are implemented completely but we are missing some key ones such as SatisfyInstance. The next step will be to merge the existing ModuleRecord implementation with the ModuleStatus object and set of abstract operations. In particular, this pull request does not plug-in any of the dependency graph resolution or export name resolution because a refactor of existing ModuleRecord code is required. There are some open issues with the code in this change. For example, it's not clear from the spec what we should do if transforming a promise object with a fulfillment handler returns a non-promise object. It seems possible that user code could replace the constructor property on the promise instance which could cause the transformed promise to be anything. Should we throw here? Should we just wrap whatever the object is in a resolved promise? It's not clear. Most of the machinery in the spec requires promise objects so I have taken the approach that we should throw anytime an object is not a promise when we expect it should be.
@Yongqu Please take a look over this one, thanks! 😀 |
BUILTIN(JavascriptLoader, GetterRegistry, EntryGetterRegistry, FunctionInfo::ErrorOnNew) | ||
BUILTIN(JavascriptLoader, EnsureRegisteredAndEvaluatedFulfillmentHandler, EntryEnsureRegisteredAndEvaluatedFulfillmentHandler, FunctionInfo::ErrorOnNew | FunctionInfo::DoNotProfile) | ||
BUILTIN(JavascriptLoader, EnsureRegisteredFulfillmentHandler, EntryEnsureRegisteredFulfillmentHandler, FunctionInfo::ErrorOnNew | FunctionInfo::DoNotProfile) | ||
BUILTIN(JavascriptLoader, EnsureEvaluatedFulfillmentHandler, EntryEnsureEvaluatedFulfillmentHandler, FunctionInfo::ErrorOnNew | FunctionInfo::DoNotProfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this an official builtin?
Followed up with @boingoing offline. Seems some design change might render this PR obsolete but salvageable. Adding Waiting label. |
Closing this for now, it doesn't appear that we will be implementing this in the near future. |
Based on the W3C Module Loader spec:
https://whatwg.github.io/loader
Includes more or less complete implementations of the runtime objects:
%Registry%
%RegistryPrototype%
%Loader%
%LoaderPrototype%
%ModuleStatus%
%ModuleStatusPrototype%
Includes a stub implementation of %Module%.
Most of the abstract operations in the spec are implemented completely but
we are missing some key ones such as SatisfyInstance. The next step will
be to merge the existing ModuleRecord implementation with the ModuleStatus
object and set of abstract operations.
In particular, this pull request does not plug-in any of the dependency
graph resolution or export name resolution because a refactor of existing
ModuleRecord code is required.
There are some open issues with the code in this change. For example, it's
not clear from the spec what we should do if transforming a promise object
with a fulfillment handler returns a non-promise object. It seems possible
that user code could replace the constructor property on the promise
instance which could cause the transformed promise to be anything. Should
we throw here? Should we just wrap whatever the object is in a resolved
promise? It's not clear. Most of the machinery in the spec requires
promise objects so I have taken the approach that we should throw anytime
an object is not a promise when we expect it should be.