Use spec compliant content-type extraction in more places and enable a <stylesheet> quirk (#28321)

This changes includes two semi-related things:

1. Fixes some specification compliance issues when parsing mime
   types and charsets for `XMLHttpRequest`.
2. Implements a `<stylesheet>` parsing quirk involving mime types.

Testing: There are tests for these changes.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Vincent Ricard 2025-05-19 13:38:01 +02:00 committed by GitHub
parent d8837e4a52
commit 6e97fc0bc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 231 additions and 1148 deletions

View file

@ -1,7 +1,5 @@
[single-byte-decoder.window.html?XMLHttpRequest]
[single-byte-decoder.window.html?TextDecoder]
[single-byte-decoder.window.html?document]
[ISO-8859-2: iso_8859-2:1987 (document.characterSet and document.inputEncoding)]
expected: FAIL

View file

@ -1,49 +1,10 @@
[response.window.html]
[fetch(): combined response Content-Type: text/plain ]
expected: FAIL
[fetch(): separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[fetch(): separate response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain */*;charset=gbk]
expected: FAIL
[fetch(): separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254]
expected: FAIL
[Request: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/html;x=" text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/plain;charset=gbk;x=foo text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/html;charset=gbk text/plain text/html]
expected: FAIL
[fetch(): combined response Content-Type: text/html text/plain]
expected: FAIL
[fetch(): combined response Content-Type: */* text/html]
expected: FAIL
[fetch(): combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[fetch(): combined response Content-Type: text/plain;charset=gbk text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254]
expected: FAIL
@ -53,110 +14,38 @@
[<iframe>: separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254]
expected: FAIL
[fetch(): combined response Content-Type: text/plain;charset=gbk text/html]
expected: FAIL
[fetch(): separate response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain;charset=gbk text/plain]
expected: FAIL
[Request: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain;charset=gbk text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252]
expected: FAIL
[fetch(): combined response Content-Type: text/html */*]
expected: FAIL
[Request: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[Response: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" " text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: FAIL
[Response: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain ]
expected: FAIL
[<iframe>: combined response Content-Type: text/html text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" " text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html text/plain]
expected: FAIL
[Response: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain;charset=gbk;x=foo text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/plain */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;charset=gbk text/html;x=",text/plain]
expected: FAIL
[fetch(): combined response Content-Type: text/plain */*;charset=gbk]
expected: FAIL
[fetch(): combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252]
expected: FAIL
[<iframe>: combined response Content-Type: text/plain */*]
expected: FAIL
[Request: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: FAIL
[fetch(): combined response Content-Type: text/html;" " text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252]
expected: FAIL
[fetch(): combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain]
expected: FAIL
[Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain;charset=gbk text/html]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;charset=gbk text/plain text/html]
expected: FAIL
[<iframe>: separate response Content-Type: */* text/html]
expected: FAIL

View file

@ -1,57 +0,0 @@
[script.window.html]
[separate text/javascript;charset=windows-1252 x/x text/javascript]
expected: FAIL
[combined text/javascript;" x/x]
expected: FAIL
[combined x/x;charset=windows-1252 text/javascript]
expected: FAIL
[combined text/javascript;charset=windows-1252;" \\" x/x]
expected: FAIL
[separate x/x text/javascript]
expected: FAIL
[combined x/x;" x/y;\\" text/javascript;charset=windows-1252;" text/javascript]
expected: FAIL
[combined x/x text/javascript]
expected: FAIL
[separate text/javascript;charset=windows-1252;" \\" x/x]
expected: FAIL
[combined text/javascript error]
expected: FAIL
[combined text/javascript;charset=windows-1252 error text/javascript]
expected: FAIL
[combined text/javascript;charset=windows-1252 text/javascript]
expected: FAIL
[separate x/x;charset=windows-1252 text/javascript]
expected: FAIL
[combined text/javascript;charset=windows-1252 x/x text/javascript]
expected: FAIL
[separate x/x;" x/y;\\" text/javascript;charset=windows-1252;" text/javascript]
expected: FAIL
[separate text/javascript;";charset=windows-1252]
expected: FAIL
[combined text/javascript; charset=windows-1252 text/javascript]
expected: FAIL
[separate text/javascript;" x/x]
expected: FAIL
[combined text/javascript ]
expected: FAIL
[separate text/javascript x/x]
expected: FAIL

View file

@ -1,3 +0,0 @@
[script.html]
[URL query: text/ecmascript;blah]
expected: FAIL

View file

@ -10,9 +10,3 @@
[Revalidated URL query: text/json]
expected: FAIL
[URL query: text/css;blah]
expected: FAIL
[Revalidated URL query: text/css;blah]
expected: FAIL

View file

@ -1,3 +0,0 @@
[worker.html]
[URL query: ?type=text/ecmascript;yay]
expected: FAIL

View file

@ -2,41 +2,23 @@
[text/html;x=(;charset=gbk]
expected: FAIL
[text/html ;charset=gbk]
expected: FAIL
[text/html;charset= gbk]
expected: FAIL
[text/html;test;charset=gbk]
expected: FAIL
[text/html;test=;charset=gbk]
expected: FAIL
[text/html;';charset=gbk]
expected: FAIL
[text/html;";charset=gbk]
expected: FAIL
[text/html ; ; charset=gbk]
expected: FAIL
[text/html;;;;charset=gbk]
expected: FAIL
[text/html;charset= ";charset=GBK]
expected: FAIL
[text/html;charset=";charset=foo";charset=GBK]
expected: FAIL
[text/html;charset="gbk]
expected: FAIL
[text/html;charset="gbk"x]
expected: FAIL
[text/html;test=ÿ;charset=gbk]
expected: FAIL
[text/html;charset=" gbk"]
expected: FAIL
[text/html;charset="gbk "]
expected: FAIL
[text/html;charset="\\ gbk"]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -23,9 +23,6 @@
[importScripts() requires scripty MIME types: zzz/zzz is blocked.]
expected: FAIL
[importScripts() requires scripty MIME types: text/csv;bla;bla is blocked.]
expected: FAIL
[importScripts() requires scripty MIME types: Text/html is blocked.]
expected: FAIL