Skip to content

Add WPT mimesniff/mime-types test - #8131

Merged
npaun merged 1 commit into
mainfrom
npaun/wpt-mimesniff
Nov 2, 2026
Merged

npaun merged 1 commit into
mainfrom
npaun/wpt-mimesniff

Conversation

@npaun

@npaun npaun commented Nov 1, 2026

Copy link
Copy Markdown
Member

Adds a WPT target for mimesniff/mime-types: 1285/1898 subtests pass.

  • Request/Response: 933/942. Failures are two MIME parser bugs (\ accepted as a token code point; an invalid parameter name doesn't consume its quoted value), Fetch's comma splitting, and workerd accepting non-Latin-1 header values.
  • Blob/File: 604 expected failures. The test expects MIME parsing, but the File API only lowercases type, as workerd does. Browsers fail these too.

🤖 Generated with Claude Code

@npaun
npaun marked this pull request as ready for review November 1, 2026 22:52
@npaun
npaun requested review from a team as code owners November 1, 2026 22:52

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of dd3c6ab2.

This review, of 4b4e8791

💬 Approved with comments — The change only adds a test and its build target. One INFO note: a comment's summary of Blob type normalization is slightly inaccurate.

Findings: 1 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📝 Documentation: 💬 1 info

One test comment slightly misstates Blob type normalization

Recommendation: 💬 Optional Nits

  • [INFO] The comment says workerd lowercases printable-ASCII types and discards others, but normalizeType also keeps U+007F, which is not printable (line 24 mentions this). Consider noting the exception in the summary. (src/wpt/mimesniff/mime-types-test.ts:17)
View full review
  • src/wpt/mimesniff/mime-types-test.ts:16-17 says workerd only lowercases printable-ASCII types and discards others. normalizeType also keeps U+007F, which is not printable. The comment at line 24 already mentions this exception, so the summary could note it too.

✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns; the change only adds a test.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md concerns.


📋 Code Quality: ✅ LGTM

The new wpt_test target follows the same pattern as the targets next to it. expectedFailures mixes strings and regexes, which the harness type (string | RegExp)[] accepts. The source comments match normalizeType in src/workerd/api/blob.c++. Nothing here changes production behaviour.


⚡ Performance: ✅ LGTM

No performance concerns.


Reviewed commit: 4b4e8791

@npaun
npaun enabled auto-merge (rebase) November 1, 2026 23:14
@npaun
npaun force-pushed the npaun/wpt-mimesniff branch from 4b4e879 to dd3c6ab Compare November 1, 2026 23:28

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superseded by the review of 9d28f724.

This review, of dd3c6ab2

💬 Approved with comments — The change only adds a test and its build target, with no production impact. One INFO note remains on a comment's wording.

Findings: 1 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📝 Documentation: 💬 1 info

The Blob/File summary comment leaves out the U+007F exception.

Recommendation: 💬 Optional Nits

  • [INFO] The comment says workerd lowercases printable-ASCII types and discards the others, but normalizeType also keeps U+007F, which is not printable (line 24 mentions this). Consider noting the exception in the summary. (src/wpt/mimesniff/mime-types-test.ts:17)
View full review

src/wpt/mimesniff/mime-types-test.ts:16-17 says workerd only lowercases printable-ASCII types and discards the others. normalizeType also keeps U+007F, which is not printable. The comment at line 24 already mentions this exception, so the summary could mention it too.


✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns. The change only adds a test config and a build target.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md concerns.


📋 Code Quality: ✅ LGTM

The mimesniff/mime-types target in src/wpt/BUILD.bazel follows the same pattern as the wpt_test targets next to it. The new config file falls under the **/*.ts include in src/wpt/tsconfig.json.


⚡ Performance: ✅ LGTM

No performance concerns. The change only adds test configuration.


Reviewed commit: dd3c6ab2

parsing.any.js runs the WHATWG MIME Sniffing parser vectors
(mime-types.json and generated-mime-types.json) through two paths:
new Blob/File({type}).type, and the type of a Blob read from a
Request or Response with that Content-Type header.

1285 of 1898 subtests pass. Request/Response passes 933 of 942.
Its failures are workerd MIME parser bugs (backslash treated as a
token code point; an invalid parameter name does not consume its
quoted value), Fetch's comma splitting in "extract a MIME type",
and workerd accepting non-Latin-1 header values. The other 604
failures are Blob/File cases: the test expects MIME parsing, but
the File API spec only lowercases the type, as workerd does.
Browsers fail these heavily too.

charset-parameter.window.js is omitted because it needs iframes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@npaun
npaun force-pushed the npaun/wpt-mimesniff branch from dd3c6ab to 9d28f72 Compare November 2, 2026 01:02

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved — The pull request only adds a WPT test config and its build target. No new issues; one earlier wording note is still open and left to the author.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security concerns. The change only adds a test config and a build target.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md concerns.


📋 Code Quality: ✅ LGTM

The new mimesniff/mime-types wpt_test target in src/wpt/BUILD.bazel matches the targets next to it, such as dom/abort and dom/events. It uses a nested name, a config path under src/wpt/, and a @wpt//:<dir>@module directory label.


⚡ Performance: ✅ LGTM

No performance concerns. The change only adds test configuration.


📝 Documentation: ✅ LGTM

No new documentation issues. One earlier wording note on src/wpt/mimesniff/mime-types-test.ts is still open and left to the author.


Reviewed commit: 9d28f724

@npaun
npaun merged commit e48c3f9 into main Nov 2, 2026
25 of 26 checks passed
@npaun
npaun deleted the npaun/wpt-mimesniff branch November 2, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants