Add tests for text modules#56812
Conversation
html/semantics/scripting-1/the-script-element/text-module/repeated-imports.any.js
Show resolved
Hide resolved
|
Might consider adding a test that the request has a Also, you could add a test that importing a module as JS, from a server which responds with valid JS file with a content type of |
Done. There are some test for the JSON module fetch headers already at
Done; added those to |
|
New tests look great, thanks. |
| promise_test(async test => { | ||
| await promise_rejects_js(test, SyntaxError, | ||
| import('./bom-utf-16be.txt', { with: { type: 'text' } }), 'Expected parse error from UTF-16BE BOM'); | ||
| }, 'UTF-16BE BOM should result in parse error in text module script'); |
There was a problem hiding this comment.
This feels needlessly inconsistent from the precedent that has been set for always decoding as UTF-8. Why account for the UTF-16 BOM when we don't account for many other things.
There was a problem hiding this comment.
You're right, this was a copy-paste error from the JSON module tests, which will consider these errors because they're not valid JSON. For text modules, we should get the file contents, parsed as UTF-8.
annevk
left a comment
There was a problem hiding this comment.
These look good to me. I didn't verify every line though.
This is to support the spec changes in:
I've effectively tried to duplicate and appropriately modify all the tests for JSON modules that I was able to find.