Bug 246207
Summary: | Modules with invalid "type" assertion should throw | ||
---|---|---|---|
Product: | WebKit | Reporter: | Nicolò Ribaudo <nribaudo> |
Component: | WebCore JavaScript | Assignee: | Yusuke Suzuki <ysuzuki> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | mark.lam, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | Other | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Nicolò Ribaudo
Consider these two files:
// main.js
await import("./dep.js", { assert: { type: "<invalid>" } });
// dep.js
console.log("Hi from dep!");
Step 6 of https://html.spec.whatwg.org/#fetch-an-import()-module-script-graph stops the import process if "type" is not a supported type assertion, so dep.js shouldn't be fetched and executed.
However, WebKit ignores the "type" assertions and loads dep.js as JavaScript.
Tested in Epiphani TP 43.0-12.
I believe that this bug comes from the .value_or call at https://github.com/WebKit/WebKit/blob/5d0f369579801f91293bcae0845cca26c816ea44/Source/WebCore/bindings/js/ScriptModuleLoader.cpp#L318.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/101166148>
Yusuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/5399
EWS
Committed 255574@main (902de48a7da9): <https://commits.webkit.org/255574@main>
Reviewed commits have been landed. Closing PR #5399 and removing active labels.