[Webkit-unassigned] [Bug 246207] New: Modules with invalid "type" assertion should throw

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 7 03:14:47 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=246207

            Bug ID: 246207
           Summary: Modules with invalid "type" assertion should throw
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nicolo.ribaudo at gmail.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221007/a92f1867/attachment.htm>


More information about the webkit-unassigned mailing list