mirror of
https://github.com/servo/servo.git
synced 2025-08-13 09:25:32 +01:00
Fix: Add support for stylesheet MIME type quirk in quirks mode (#36338)
This PR implements the HTML spec quirk for stylesheets: https://html.spec.whatwg.org/multipage/#link-type-stylesheet The implementation adds a check in `stylesheet_loader.rs` to handle this quirk condition correctly, and adds a new WPT test to verify that same-origin non-CSS MIME type resources are properly treated as CSS in quirks mode. Testing: Added a new WPT test (`quirk-origin-check-positive.html`) that verifies the positive case for this quirk. Fixes: https://github.com/servo/servo/issues/36324 --------- Signed-off-by: saku-1101 <sakupi1101@outlook.jp>
This commit is contained in:
parent
6031a12fd1
commit
b4fd9ebb0e
4 changed files with 45 additions and 1 deletions
15
tests/wpt/meta/MANIFEST.json
vendored
15
tests/wpt/meta/MANIFEST.json
vendored
|
@ -474568,6 +474568,14 @@
|
|||
"80fbe8db6cbfc1f6e478b6c3cc8d2ae3c707c053",
|
||||
[]
|
||||
]
|
||||
},
|
||||
"stylesheet": {
|
||||
"resources": {
|
||||
"quirk-stylesheet.css.txt": [
|
||||
"d2ae382583192b0284aa44c038811e7254a9386b",
|
||||
[]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
|
@ -719907,6 +719915,13 @@
|
|||
}
|
||||
},
|
||||
"stylesheet": {
|
||||
"quirk-origin-check-positive.html": [
|
||||
"02ab832cbe207c9bbfb1d16cbdc9a685b474372c",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"quirk-origin-check-recursive-import.html": [
|
||||
"c0053f1f29ad8f23dbebdd41b38dbdd8537e9e27",
|
||||
[
|
||||
|
|
18
tests/wpt/tests/html/links/stylesheet/quirk-origin-check-positive.html
vendored
Normal file
18
tests/wpt/tests/html/links/stylesheet/quirk-origin-check-positive.html
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!-- quirks -->
|
||||
<title>Same-origin stylesheet with non-CSS MIME type quirk</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#link-type-stylesheet">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="stylesheet" href="resources/quirk-stylesheet.css.txt">
|
||||
<p class="test">This text should be green.</p>
|
||||
<script>
|
||||
setup({ single_test: true });
|
||||
onload = () => {
|
||||
assert_equals(
|
||||
getComputedStyle(document.querySelector('.test')).color,
|
||||
'rgb(0, 128, 0)',
|
||||
"Same-origin stylesheet with non-CSS MIME type should be applied in quirks mode"
|
||||
);
|
||||
done();
|
||||
};
|
||||
</script>
|
1
tests/wpt/tests/html/links/stylesheet/resources/quirk-stylesheet.css.txt
vendored
Normal file
1
tests/wpt/tests/html/links/stylesheet/resources/quirk-stylesheet.css.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.test { color: green; }
|
Loading…
Add table
Add a link
Reference in a new issue