Prevent modules from being imported with a type: 'javascript' assertion#7350
Conversation
domenic
left a comment
There was a problem hiding this comment.
LGTM, very nice. Will give people some time over the weekend to double-check.
|
I think the spec should include some examples and expected outcomes. It’s not clear to me what the spec intends to happen for each of the following: const url = 'data:text/javascript,export default "hello"';
import(url);
import(url, { assert: { type: 'javascript' } });
import(url, { assert: { type: '' } });
import(url, { assert: { type: null } });
import(url, { assert: { type: undefined } });And if |
Prevent modules from being loaded with a
type: 'javascript'assertion. This was the original intent of the import assertions integration, buttype: 'javascript'was unintentionally allowed to work due to a bug involving the spec's internal use of the "javascript" module type for JavaScript module scripts.Chromium already implements the behavior in this PR, i.e. Chromium passes https://github.com/web-platform-tests/wpt/blob/master/html/semantics/scripting-1/the-script-element/import-assertions/invalid-type-assertion-error.html.
Resolves #7342.
/webappapis.html ( diff )