Closed Bug 2078531 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63294 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=227967

Categories

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

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Kiet Ho <kiet.ho@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=227967

WebKit export from bug: Implement CSS module scripts

<pre>
Implement CSS module scripts

This patch implements importing CSS stylesheets as JavaScript modules, using the
import ... with { type: &apos;css&apos; } and import(..., { with: { type: &apos;css&apos; } })
syntax.

On the JSC side, we add support for the css module type, and requests WebCore
to fetch it. WebCore fetches the stylesheet, constructs a CSSStyleSheet object
out of it, wraps it in a JSCSSStyleSheet, and returns it back to JSC as a JSValue.
JSC uses this as the default export value of the CSS module.

To implement this requires some changes in how script modules loading works. Before,
JSC asks WebCore to fetch a script, WebCore fetches the source code and returns it
to JSC. This works for JavaScript/WASM/JSON/text, because those are JavaScript
constructs and can only be handled by JSC. However, CSS is a WebCore construct and
can only be handled by WebCore. This patch changes it so that depending on the module
type, WebCore can either return a source code for types it can't handle, like JS or
WASM. For types it can handle like CSS, WebCore constructs the JSValue itself, then
passes it to JSC. JSC just uses the JSValue as the default module export.

This is gated by the CSSModuleScriptsEnabled feature flag, which is disabled by default.

There is one failing test only on GTK, which is tracked at webkit.org/b/326330:

  • html/semantics/scripting-1/the-script-element/css-module/credentials.sub.html

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=227967">https://bugs.webkit.org/show_bug.cgi?id=227967</a>
</pre>

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

CI Results

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

Total 18 tests and 1 subtests

Status Summary

Firefox

OK : 2[GitHub] 18[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 9[GitHub] 60[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 2
PASS: 9

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.