Skip to content

Add tests for modulepreload links with JSON and CSS, remove json with non-module preload#56617

Merged
yoavweiss merged 15 commits intoweb-platform-tests:masterfrom
KurtCattiSchmidt:modulepreload-json-style
Jan 30, 2026
Merged

Add tests for modulepreload links with JSON and CSS, remove json with non-module preload#56617
yoavweiss merged 15 commits intoweb-platform-tests:masterfrom
KurtCattiSchmidt:modulepreload-json-style

Conversation

@KurtCattiSchmidt
Copy link
Contributor

@KurtCattiSchmidt KurtCattiSchmidt commented Dec 9, 2025

Per whatwg/html#10233, "json" and "style" should be supported for modulepreload. This PR adds tests for this.

In the PR to update the HTML5 spec for these changes, it was also recommended that support for non-module JSON preloads be removed, as it only makes sense in a module context. This change also updates tests for that scenario.

The existing tests had a flakiness problem that this change addressed in order to satisfy the "unstable results" bots. Specifically, modulepreload-as.html was modified fairly substantially. It no longer checks performance.getEntriesByName, as the preload scanner was fetching the files and firing events, but the performance entries were not always getting updated in time for the test. Now, the test only checks for events fired, as that is all we can determine consistently at test time. The event handlers were also moved to markup, which avoids a race between the preload scanner fetching the files and the event handlers being added.

@KurtCattiSchmidt
Copy link
Contributor Author

@annevk FYI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a utility function that accepts the different URLs and as values?

Copy link
Contributor Author

@KurtCattiSchmidt KurtCattiSchmidt Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest commit revamps this to take an array of module types for shared tests. That way we can have unique tests for each module type. This reduced a lot of duplication. It's not used everywhere because a lot of these tests are unique for script, but it'll make it much easier to expand for future module types like "text".

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but it seems like it needs rebasing to get CI to be green.

Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % helper

chromium-wpt-export-bot pushed a commit that referenced this pull request Jan 30, 2026
Adds support for preloading JSON and CSS modules via the "as" parameter
using the same fetching mechanism that script module preloads use.

Basic tests are added in this CL, and more detailed tests are coming
straight to WPT via
#56617.

Bug: 466888680
Change-Id: I3f08d7a1c48d4e46e500538b5fab32f2b4f41b02
chromium-wpt-export-bot pushed a commit that referenced this pull request Jan 30, 2026
Adds support for preloading JSON and CSS modules via the "as" parameter
using the same fetching mechanism that script module preloads use.

Basic tests are added in this CL, and more detailed tests are coming
straight to WPT via
#56617.

Bug: 466888680
Change-Id: I3f08d7a1c48d4e46e500538b5fab32f2b4f41b02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7216960
Reviewed-by: Dan Clark <daniec@microsoft.com>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577402}
jenkins-chromium-github-sync bot pushed a commit to armarok/chromium that referenced this pull request Jan 30, 2026
Adds support for preloading JSON and CSS modules via the "as" parameter
using the same fetching mechanism that script module preloads use.

Basic tests are added in this CL, and more detailed tests are coming
straight to WPT via
web-platform-tests/wpt#56617.

Bug: 466888680
Change-Id: I3f08d7a1c48d4e46e500538b5fab32f2b4f41b02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7216960
Reviewed-by: Dan Clark <daniec@microsoft.com>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577402}
chromium-wpt-export-bot pushed a commit that referenced this pull request Jan 30, 2026
Adds support for preloading JSON and CSS modules via the "as" parameter
using the same fetching mechanism that script module preloads use.

Basic tests are added in this CL, and more detailed tests are coming
straight to WPT via
#56617.

Bug: 466888680
Change-Id: I3f08d7a1c48d4e46e500538b5fab32f2b4f41b02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7216960
Reviewed-by: Dan Clark <daniec@microsoft.com>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577402}
@yoavweiss yoavweiss merged commit 4d4ef03 into web-platform-tests:master Jan 30, 2026
25 checks passed
lando-prod-mozilla bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Feb 5, 2026
…nk type=modulepreload, a=testonly

Automatic update from web-platform-tests
[CSS Modules] Support JSON and CSS in <link type=modulepreload>

Adds support for preloading JSON and CSS modules via the "as" parameter
using the same fetching mechanism that script module preloads use.

Basic tests are added in this CL, and more detailed tests are coming
straight to WPT via
web-platform-tests/wpt#56617.

Bug: 466888680
Change-Id: I3f08d7a1c48d4e46e500538b5fab32f2b4f41b02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7216960
Reviewed-by: Dan Clark <daniec@microsoft.com>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577402}

--

wpt-commits: f0705a47664fcbabfc0410431d5e40efdccd65e7
wpt-pr: 57436
ajperel pushed a commit to chromium/chromium that referenced this pull request Feb 12, 2026
This test has been disabled for some time due to flakiness. The
flakiness was addressed directly in WPT via
web-platform-tests/wpt#56617.

This change removes it from TestExpecations and adds a -expected.txt as
it is failing for other reasons (which will be addressed separately).

I ran locally 100 times and it never failed.

Bug: 466888680
Change-Id: Ib86d8a75067bd4ee4fd1dfa1c1b138fa2d3c612f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7568243
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1583602}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments