Closed Bug 1690933 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 27497 - Check MIME type against asserted module type in ModuleScriptFetcher

Categories

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

task

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

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

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

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

Check MIME type against asserted module type in ModuleScriptFetcher

Add module type to the module map key.

Plumb module type into ModuleScriptFetcher and its subclasses, and
require that the MIME type match the type that was specified with
import assertions.

Add the necessary import assertions to the JSON/CSS module web tests
so that they continue passing. Add tests to ensure that the modules
don't load when the correct assertion is not present.

A minor functional change to JSON modules is that trying to start a
a Worker with a top-level JSON module (e.g. new Worker("./foo.json"))
now results in a rejected Promise, instead of loading a no-op worker
without an error. This change follows the spec change at
https://github.com/whatwg/html/pull/5658/; note that the invocation
of 'fetch a single module script' from 'fetch a worklet/module worker
script graph' doesn't pass a ModuleRequest, so the type is assumed to
be JavaScript, and a failure will be triggered if the MIME type is
not JavaScript.

Some of the non-virtual versions of the tests now time out because
the import assertion syntax is seen as a syntax error when
--harmony-import-assertions is not enabled, causing \<script>s not to
run. TestExpectations is updated to account for these.

Bug: 1132413
Change-Id: I01bf7d907a96e791208534c9c4f2af11434c76db
Reviewed-on: https://chromium-review.googlesource.com/2674259
WPT-Export-Revision: 8b7fea306a57c18aed5d536493a245b46759b088

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

CI Results

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

Total 12 tests and 4 subtests

Status Summary

Firefox

OK : 2
PASS : 5
FAIL : 5
TIMEOUT: 2
ERROR : 9
NOTRUN : 13

Chrome

OK : 2
PASS : 3
FAIL : 7
TIMEOUT: 2
ERROR : 9
NOTRUN : 13

Safari

OK : 6
PASS : 6
FAIL : 17
TIMEOUT: 2
ERROR : 5

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/html/semantics/scripting-1/the-script-element/css-module/css-module-worker-test.html: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
A dynamic import CSS Module within a web worker should not load.: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
/html/semantics/scripting-1/the-script-element/css-module/import-css-module-basic.html
A CSS Module should load: FAIL (Chrome: FAIL, Safari: FAIL)
A large CSS Module should load: FAIL (Chrome: FAIL, Safari: FAIL)
An @import CSS Module should not load, but should not throw an exception: FAIL (Chrome: FAIL, Safari: PASS)
/html/semantics/scripting-1/the-script-element/css-module/import-css-module-dynamic.html: ERROR (Chrome: ERROR, Safari: ERROR)
/html/semantics/scripting-1/the-script-element/css-module/utf8.tentative.html: ERROR (Chrome: ERROR, Safari: OK)
utf-8: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
shift-jis: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
windows-1252: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
utf-7: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.tentative.html
Javascript importing JSON Module should load within the context of a service worker: FAIL (Chrome: FAIL, Safari: FAIL)
JSON Module dynamic import should not load within the context of a service worker: FAIL (Chrome: FAIL, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/json-module/module.tentative.html: ERROR (Chrome: ERROR, Safari: OK)
JSON modules: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.worker.html: ERROR (Chrome: ERROR, Safari: ERROR)
/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.sharedworker.html: ERROR (Chrome: ERROR, Safari: ERROR)
/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.html: ERROR (Chrome: ERROR, Safari: ERROR)
/html/semantics/scripting-1/the-script-element/json-module/non-object.tentative.any.serviceworker.html: ERROR (Chrome: ERROR, Safari: ERROR)
/html/semantics/scripting-1/the-script-element/json-module/utf8.tentative.html: ERROR (Chrome: ERROR, Safari: OK)
utf-8: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
shift-jis: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
windows-1252: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
utf-7: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.tentative.html: ERROR (Chrome: ERROR, Safari: OK)
text/json: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
application/json: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
text/html+json: NOTRUN (Chrome: NOTRUN, Safari: FAIL)
image/svg+json: NOTRUN (Chrome: NOTRUN, Safari: FAIL)

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b2d48fe7a820 [wpt PR 27497] - Check MIME type against asserted module type in ModuleScriptFetcher, a=testonly https://hg.mozilla.org/integration/autoland/rev/1f06bd2a7523 [wpt PR 27497] - Update wpt metadata, a=testonly
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/14d42cc136dc [wpt PR 27497] - Check MIME type against asserted module type in ModuleScriptFetcher, a=testonly https://hg.mozilla.org/integration/autoland/rev/373ec05500b5 [wpt PR 27497] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.