Closed Bug 1684329 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 27012 - Make invalid 'type' import assertion cause a module to fail to load

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 27012 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/27012
Details from upstream follow.

b'Daniel Clark <daniec@microsoft.com>' wrote:

Make invalid 'type' import assertion cause a module to fail to load

Add Modulator::ModuleTypeFromRequest to get the asserted type from
a ModuleRequest's list of import assertions, and use it to make module
creation fail if an invalid type is asserted.

Pull the ModuleType enum out of the ModuleScriptCreationParams class
so that the full class definition of ModuleScriptCreationParams doesn't
need to be included in modulator.h. Also make the name of the enum
values a bit less redundant, and add kInvalid to be used by
ModuleTypeFromRequest.

In preparation for subsequent import assertions changes, plumb this
module type through GetFetchedModuleScript, where it will be needed
for module map lookups since module type will be used in the module
map cache key.

Add tests for the invalid module type failure, along with tests
verifying that JS modules can still load with an empty import assertions
clause and an unsupported import assertion.

A subsequent change will require the correct type assertion to be
present to load a JSON or CSS module, and the existing JSON/CSSS module
tests will be updated to reflect the new behavior at that time.

Bug: 1132413
Change-Id: I33e3e6ae68b14d6f6c561a58c0e260a7b129d930
Reviewed-on: https://chromium-review.googlesource.com/2603420
WPT-Export-Revision: 15168406a9c4d6158d1ca9e2f849c8fc0535a4a8

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 14 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 3 tests and 1 subtests

Status Summary

Firefox

OK : 1
FAIL : 3
ERROR: 2

Chrome

OK : 1
FAIL : 3
ERROR: 2

Safari

OK : 3
FAIL : 3

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/html/semantics/scripting-1/the-script-element/import-assertions/empty-assertion-clause.html: ERROR (Chrome: ERROR, Safari: OK)
Test that no error occurs when an empty import assertion clause is provided.: FAIL (Chrome: FAIL, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/import-assertions/invalid-type-assertion-error.html
Test that invalid module type assertion leads to TypeError on window.: FAIL (Chrome: FAIL, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/import-assertions/unsupported-assertion.html: ERROR (Chrome: ERROR, Safari: OK)
Test that no error occurs when an unsupported import assertion is provided.: FAIL (Chrome: FAIL, Safari: FAIL)

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b2c19839264c [wpt PR 27012] - Make invalid 'type' import assertion cause a module to fail to load, a=testonly https://hg.mozilla.org/integration/autoland/rev/a5d11a646337 [wpt PR 27012] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.