demo · v142
JSON Module Import Tester
Pick a MIME type variant, then attempt a dynamic import() with { with: { type: "json" } } backed by a data URL carrying that MIME. Chrome 142 tightens the token validation — trailing semicolons and invalid charset parameters now cause the import to fail.
Result
MIME used—
outcome—
strict verdict—
error—
data loaded—
Chrome 141 behaviour: —
Chrome 142 behaviour: —
Chrome 142 behaviour: —
MIME variant matrix
| MIME type | Chrome ≤141 | Chrome 142+ | Reason |
|---|
What changed
Chrome 142 applies stricter RFC 9110 / MIME token validation when loading JSON modules. A valid MIME type for a JSON module must have:
A valid type/subtype token — no uppercase (case-folded to lower), no special characters.
Parameters separated by
; — each parameter must be a valid token=value pair with no empty values and no dangling semicolons.Trailing semicolons (
application/json;) are now rejected — they imply an empty parameter that has no name or value.Comma-separated MIME lists (
a/b, c/d) are rejected — HTTP allows multiple types in an Accept header, but a Content-Type must have exactly one type.Unknown or non-JSON subtypes (e.g.
text/plain) were already rejected; this remains the same.The stricter validation prevents ambiguous server responses from being silently parsed as JSON, reducing supply-chain attack surface.
how the test works
// Build a data URL with the selected MIME type
const json = JSON.stringify({ test: true, ts: Date.now() });
const dataUrl = `data:${mimeType},${encodeURIComponent(json)}`;
// Dynamic import with JSON assertion
const mod = await import(dataUrl, { with: { type: "json" } });
// If MIME validation fails in Chrome 142, this throws a TypeError