diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-12-15 19:22:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-15 19:22:36 +0100 |
| commit | a1f0796fccfafee19b2fe06155efe746da2e9654 (patch) | |
| tree | 01942b1bc202352418c88dbf8a1c447e72f6f976 /tools/wpt | |
| parent | ec7d90666f68ae0bf6036a6915296622adc9b65c (diff) | |
feat: Add support for import assertions and JSON modules (#12866)
This commit adds proper support for import assertions and JSON modules.
Implementation of "core/modules.rs" was changed to account for multiple possible
module types, instead of always assuming that the code is an "ES module". In
effect "ModuleMap" now has knowledge about each modules' type (stored via
"ModuleType" enum). Module loading pipeline now stores information about
expected module type for each request and validates that expected type matches
discovered module type based on file's "MediaType".
Relevant tests were added to "core/modules.rs" and integration tests,
additionally multiple WPT tests were enabled.
There are still some rough edges in the implementation and not all WPT were
enabled, due to:
a) unclear BOM handling in source code by "FileFetcher"
b) design limitation of Deno's "FileFetcher" that doesn't download the same
module multiple times in a single run
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'tools/wpt')
| -rw-r--r-- | tools/wpt/expectation.json | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 0d9c0a5e2..dc5bb12a7 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -6352,52 +6352,25 @@ "semantics": { "scripting-1": { "the-script-element": { - "import-assertions": { - "dynamic-import-with-assertion-argument.any.html": [ - "Dynamic import with an unsupported type assertion should fail" - ], - "dynamic-import-with-assertion-argument.any.worker.html": [ - "Dynamic import with an unsupported type assertion should fail" - ] - }, + "import-assertions": true, "json-module": { "charset-bom.any.html": [ - "UTF-8 BOM should be stripped when decoding JSON module script", "UTF-16BE BOM should result in parse error in JSON module script", "UTF-16LE BOM should result in parse error in JSON module script" ], "charset-bom.any.worker.html": [ - "UTF-8 BOM should be stripped when decoding JSON module script", "UTF-16BE BOM should result in parse error in JSON module script", "UTF-16LE BOM should result in parse error in JSON module script" ], "invalid-content-type.any.html": true, "invalid-content-type.any.worker.html": true, - "non-object.any.html": [ - "Non-object: null", - "Non-object: true", - "Non-object: false", - "Non-object: string", - "Non-object: array" - ], - "non-object.any.worker.html": [ - "Non-object: null", - "Non-object: true", - "Non-object: false", - "Non-object: string", - "Non-object: array" - ], + "non-object.any.html": true, + "non-object.any.worker.html": true, "repeated-imports.any.html": [ - "Importing a specifier that previously failed due to an incorrect type assertion can succeed if the correct assertion is later given", - "Importing a specifier that previously succeeded with the correct type assertion should fail if the incorrect assertion is later given", - "Two modules of different type with the same specifier can load if the server changes its responses", - "If an import previously succeeded for a given specifier/type assertion pair, future uses of that pair should yield the same result" + "Two modules of different type with the same specifier can load if the server changes its responses" ], "repeated-imports.any.worker.html": [ - "Importing a specifier that previously failed due to an incorrect type assertion can succeed if the correct assertion is later given", - "Importing a specifier that previously succeeded with the correct type assertion should fail if the incorrect assertion is later given", - "Two modules of different type with the same specifier can load if the server changes its responses", - "If an import previously succeeded for a given specifier/type assertion pair, future uses of that pair should yield the same result" + "Two modules of different type with the same specifier can load if the server changes its responses" ] }, "microtasks": { |
