Skip to content

Commit 207dd1e

Browse files
mfreed7emilio
authored andcommitted
Update to disallow @import rules
1 parent 0aca629 commit 207dd1e

File tree

1 file changed

+12
-34
lines changed

1 file changed

+12
-34
lines changed

cssom-1/Overview.bs

+12-34
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ represents a style sheet as defined by the CSS specification. In the CSSOM a
775775
</dd>
776776
</dl>
777777

778-
<a>CSS style sheet</a> has a number of associated state items:
778+
A <a>CSS style sheet</a> has a number of associated state items:
779779

780780
<dl dfn-for="CSSStyleSheet">
781781
<dt><dfn id=concept-css-style-sheet-type>type</dfn>
@@ -994,8 +994,8 @@ The <dfn method for=CSSStyleSheet>insertRule(<var>rule</var>, <var>index</var>)<
994994
<li>If the <a>disallow modification flag</a> is set, throw a {{NotAllowedError}} {{DOMException}}.
995995
<li>Let <var>parsed rule</var> be the return value of invoking <a>parse a rule</a> with <var>rule</var>.
996996
<li>If <var>parsed rule</var> is a syntax error, return <var>parsed rule</var>.
997-
<li>If <var>parsed rule</var> is an <a>@import</a> rule, and the <a>constructed flag</a> or any ancestor
998-
style sheet's <a>constructed flag</a> is set, throw a {{NotAllowedError}} {{DOMException}}.
997+
<li>If <var>parsed rule</var> is an <a>@import</a> rule, and the <a>constructed flag</a> is set, throw
998+
a {{SyntaxError}} {{DOMException}}.
999999
<li>Return the result of invoking <a>insert a CSS rule</a> <var>rule</var> in the <a for=CSSStyleSheet>CSS rules</a>
10001000
at <var>index</var>.
10011001
</ol>
@@ -1017,36 +1017,14 @@ The <dfn method for=CSSStyleSheet>replace(<a for=CSSRule>text</a>)</dfn> method
10171017
<li>Set the <a>disallow modification flag</a>.
10181018
<li><a>In parallel</a>, do these steps:
10191019
<ol>
1020-
<li>Let <var>rules</var> be the result of running <a>parse a list of rules</a> from <var>text</var>. If <var>rules</var> is not a list of rules
1021-
(i.e. an error occurred during parsing), set <var>rules</var> to an empty list.
1022-
<li>Wait for loading of <a>@import</a> rules in <var>rules|</var>and any nested <a>@import</a>s from those rules (and so on).
1023-
<ul>
1024-
<li>If any of them failed to load, <a>terminate</a> fetching of the remaining <a>@import</a> rules, and <a>queue a task</a> on the
1025-
<a>networking task source</a> to perform the following steps:
1026-
<ol>
1027-
<li>Unset <var>sheet</var>'s <a>disallow modification flag</a>.
1028-
<li>Reject <var>promise</var> with a {{NetworkError}} {{DOMException}}.
1029-
</ol>
1030-
<li>Otherwise, once all of them have finished loading, <a>queue a task</a> on the [<a>etworking task source</a> to perform the
1031-
following steps:
1032-
<ol>
1033-
<li>Set <var>sheet</var>'s <a>CSS rules</a> to <var>rules</var>.
1034-
<li>Unset <var>sheet</var>'s <a>disallow modification flag</a>.
1035-
<li>Resolve <var>promise</var> with <var>sheet</var>.
1036-
</ol>
1037-
</ul>
1038-
<p class="note">
1039-
Note: Loading of <a>@import</a> rules should follow the rules used for fetching style sheets for <a>@import</a> rules of
1040-
stylesheets from &lt;link> elements, in regard to what counts as success, CSP, and Content-Type header checking.
1041-
</p>
1042-
<p class="note">
1043-
Note: We will use the <a>fetch group</a> of <var>sheet</var>'s <a>constructor document</a>'s <a>relevant settings object</a> for
1044-
<a>@import</a> rules and other (fonts, etc) loads.
1045-
</p>
1046-
<p class="note">
1047-
Note: The rules regarding loading mentioned above are currently not specified rigorously anywhere.
1048-
</p>
1049-
<li>Return <var>promise</var>.
1020+
<li>Let <var>rules</var> be the result of running <a>parse a list of rules</a> from <var>text</var>. If <var>rules</var> is
1021+
not a list of rules (i.e. an error occurred during parsing), set <var>rules</var> to an empty list.
1022+
<li>If <var>rules</var> contains one or more <a>@import</a> rules, <a lt="remove a CSS rule">remove those rules</a> from <var>rules</var>.
1023+
<li>Set <var>sheet</var>'s <a>CSS rules</a> to <var>rules</var>.
1024+
<li>Unset <var>sheet</var>'s <a>disallow modification flag</a>.
1025+
<li>Resolve <var>promise</var> with <var>sheet</var>.
1026+
</ol>
1027+
<li>Return <var>promise</var>.
10501028
</ol>
10511029

10521030
The <dfn method for=CSSStyleSheet>replaceSync(<a for=CSSRule>text</a>)</dfn> method must run the following steps:
@@ -1055,7 +1033,7 @@ The <dfn method for=CSSStyleSheet>replaceSync(<a for=CSSRule>text</a>)</dfn> met
10551033
{{DOMException}}.
10561034
<li>Let <var>rules</var> be the result of running <a>parse a list of rules</a> from <var>text</var>. If <var>rules</var> is
10571035
not a list of rules (i.e. an error occurred during parsing), set <var>rules</var> to an empty list.
1058-
<li>If <var>rules</var> contains one or more <a>@import</a> rules, throw a {{NotAllowedError}} {{DOMException}}.
1036+
<li>If <var>rules</var> contains one or more <a>@import</a> rules, <a lt="remove a CSS rule">remove those rules</a> from <var>rules</var>.
10591037
<li>Set <a>CSS rules</a> to <var>rules</var>.
10601038
</ol>
10611039

0 commit comments

Comments
 (0)