Skip to content

[cssom] "If loading of the style sheet fails its CSS rul..." #3452

@mfalken

Description

@mfalken

https://drafts.csswg.org/cssom/#the-cssimportrule-interface

If loading of the style sheet fails its CSS rules list is simply empty,

The specification has this non-normative text but the algorithms seem to contradict it in the case of a network error. When loading fails cssRules, insertRule, and deleteRule would throw a SecurityError, as follows:

cssRules checks the origin-clean flag:
https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssrules
This is set to true iff CORS-same-origin:
https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet
CORS-same-origin is false for “error” responses:
https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-same-origin

I've just updated Chrome to match this algorithm and added WPT css/cssom/stylesheet-same-origin.sub.html accordingly.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions