Bug 246207

Summary: Modules with invalid "type" assertion should throw
Product: WebKit Reporter: Nicolò Ribaudo <nribaudo>
Component: WebCore JavaScriptAssignee: 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
Reported 2022-10-07 03:14:47 PDT
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
Radar WebKit Bug Importer
Comment 1 2022-10-14 03:15:18 PDT
Yusuke Suzuki
Comment 2 2022-10-14 15:35:44 PDT
EWS
Comment 3 2022-10-15 01:26:00 PDT
Committed 255574@main (902de48a7da9): <https://commits.webkit.org/255574@main> Reviewed commits have been landed. Closing PR #5399 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.