Skip to content

Commit 920c918

Browse files
mikewestannevk
authored andcommitted
Close #384: add CSP hooks to handle inline events and style
The "Should element's inline behavior be blocked by CSP?" algorithm now accepts a "type", and can handle event handlers and style attributes. This patch adds the relevant hooks to the handling of those two features, and updates the existing hooks for inline `<script>` and `<style>` elements themselves.
1 parent 75a4ef8 commit 920c918

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

source

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10873,6 +10873,12 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></pre> <!-- DO NOT REWRAP THIS L
1087310873
according to the rules given for <span data-x="CSS styling attribute">CSS styling
1087410874
attributes</span>. <ref spec=CSSATTR></p>
1087510875

10876+
<p>However, if the <span>Should element's inline behavior be blocked by Content Security
10877+
Policy?</span> algorithm returns "<code data-x="">Blocked</code>" when executed upon the
10878+
attribute's <span>element</span> and "<code data-x="">style attribute</code>", then the style
10879+
rules defined in the attribute's value must not be applied to the <span>element</span>. <ref
10880+
spec="CSP"></p>
10881+
1087610882
</div>
1087710883

1087810884
<p>Documents that use <code data-x="attr-style">style</code> attributes on any of their elements
@@ -13295,7 +13301,8 @@ own thing rather than part of the extended sentence -->
1329513301

1329613302
<li><p>If the <span>Should element's inline behavior be blocked by Content Security
1329713303
Policy?</span> algorithm returns "<code data-x="">Blocked</code>" when executed upon the
13298-
<code>style</code> element, then abort these steps. <ref spec="CSP"></p></li>
13304+
<code>style</code> element and "<code data-x="">style</code>", then abort these steps.
13305+
<ref spec="CSP"></p></li>
1329913306

1330013307
<!-- note that the browsing context isn't needed: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2739 -->
1330113308

@@ -59287,10 +59294,11 @@ dictionary <dfn>RelatedEventInit</dfn> : <span>EventInit</span> {
5928759294
</li>
5928859295

5928959296
<li id="script-processing-csp"><p>If the <code>script</code> element does not have a <code
59290-
data-x="attr-script-src">src</code> content attribute, and the <span>Should node's inline
59297+
data-x="attr-script-src">src</code> content attribute, and the <span>Should element's inline
5929159298
behavior be blocked by Content Security Policy?</span> algorithm returns "<code
59292-
data-x="">Blocked</code>" when executed upon the <code>script</code> element, then the user
59293-
agent must abort these steps. The script is not executed. <ref spec="CSP"></p></li>
59299+
data-x="">Blocked</code>" when executed upon the <code>script</code> element and "<code
59300+
data-x="">script</code>", then the user agent must abort these steps. The script is not executed.
59301+
<ref spec="CSP"></p></li>
5929459302

5929559303
<li id="script-processing-for">
5929659304

@@ -87138,9 +87146,18 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
8713887146
<div w-nodev>
8713987147

8714087148
<p>When an <span data-x="event handler content attributes">event handler content attribute</span>
87141-
is set, the user agent must set the corresponding <span data-x="event handlers">event
87142-
handler</span> to an <span>internal raw uncompiled handler</span> consisting of the attribute's
87143-
new value and the script location where the attribute was set to this value</p>
87149+
is set, execute the following steps:</p>
87150+
87151+
<ol>
87152+
<li><p>If the <span>Should element's inline behavior be blocked by Content Security
87153+
Policy?</span> algorithm returns "<code data-x="">Blocked</code>" when executed upon the
87154+
attribute's <span>element</span> and "<code data-x="">script attribute</code>", then abort these
87155+
steps. <ref spec="CSP"></p></li>
87156+
87157+
<li><p>Set the corresponding <span data-x="event handlers">event handler</span> to an
87158+
<span>internal raw uncompiled handler</span> consisting of the attribute's new value and the
87159+
script location where the attribute was set to this value</p></li>
87160+
</ol>
8714487161

8714587162
<p>When an event handler content attribute is removed, the user agent must set the corresponding
8714687163
<span data-x="event handlers">event handler</span> to null.</p>

0 commit comments

Comments
 (0)