Skip to content

Stylesheet loading quirk is missing #36324

@jdm

Description

@jdm

From https://html.spec.whatwg.org/multipage/#link-type-stylesheet:

Quirk: If the document has been set to [quirks mode](https://dom.spec.whatwg.org/#concept-document-quirks), has the [same origin](https://html.spec.whatwg.org/#same-origin) as the [URL](https://url.spec.whatwg.org/#concept-url) of the external resource, and the [Content-Type metadata](https://html.spec.whatwg.org/#content-type) of the external resource is not a supported style sheet type, the user agent must instead assume it to be [text/css](https://html.spec.whatwg.org/#text/css).

We are missing support for this quirk in

let is_css = metadata.content_type.is_some_and(|ct| {
let mime: Mime = ct.into_inner().into();
mime.type_() == mime::TEXT && mime.subtype() == mime::CSS
});
. There does not appear to be a test verifying that this feature works (ie. a same-origin stylesheet loaded with a non-text/css mime type), only one verifying that the feature fails correctly (https://github.com/servo/servo/blob/main/tests/wpt/tests/html/links/stylesheet/quirk-origin-check.html). We should add a new test based on that one that verifies the positive condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/cssInteracting with CSS from web content (parsing, serializing, introspection)A-content/scriptRelated to the script threadE-less-complexStraightforward. Recommended for a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions