[csswg-drafts] [cssom] "If loading of the style sheet fails its CSS rul..." (#3452)

mattto has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] "If loading of the style sheet fails its CSS rul..." ==
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.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3452 using your GitHub account

Received on Tuesday, 18 December 2018 05:27:52 UTC