Bug 201692
| Summary: | ES Modules should respect <base> tag | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Guy Bedford <guybedford> |
| Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> |
| Status: | NEW | ||
| Severity: | Normal | CC: | fpizlo, mark.lam, m.goleb+bugzilla, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 12 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Guy Bedford
When using the <base href> tag, the value should affect the resolution of ES modules when resolving top-level module scripts with relative imports.
For example:
```
<base href="/modules/" />
<script type="module">
import './module.js';
</script>
```
should load `/modules/module.js` and not `/module.js`.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Guy Bedford
Correction: the problem is specifically for dynamic imports:
```
<base href="/modules/" />
<script type="module">
import('./module.js');
</script>
```
where the top-level parent for the dynamic import should still respect the base.
Radar WebKit Bug Importer
<rdar://problem/55361194>
Yusuke Suzuki
The problem is that import is using SourceOrigin information. We should add a flag to that like, "this source is inlined script etc.".