Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add <script type="module"> and module resolution/fetching/evaluation
This adds support for <script type="module"> for loading JavaScript modules, as well as all the infrastructure necessary for resolving, fetching, parsing, and evaluating module graphs rooted at such <script type="module">s. Policy decisions encoded here: - Always use the UTF-8 decoder, ignoring the charset="" attribute or the Content-Type header. - Always use "cors" fetch mode and "omit" credentials mode, ignoring the crossorigin="" attribute. (I am not so sure on the credentials mode and crossorigin attribute parts of this.) - Use <script defer>-like semantics: do not execute until parsing is finished, and execute in order. Ignore the async="" attribute (for now?). - In HostResolveImportedModule: - Allow absolute URLs and anything starting with "./" or "../", with the latter being then interpreted as relative URLs. Everything else (e.g. bare specifiers like "jquery") fails for now, and no automatic ".js" is appended. - We do a URL parse instead of a basic URL parse, i.e., we allow blob URLs theoretically. (I am not sure about this and happy to change it.) - We throw a TypeError as the resolution error. (Honestly I could see arguments for any of EvalError, ReferenceError, SyntaxError, or URIError. Maybe we should repurpose EvalError.)
- Loading branch information