You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1067,20 +1067,6 @@ Given a {{TrustedType}} type (|expectedType|), a [=realm/global object=] (|globa
1067
1067
1. Return a new instance of an interface with a type
1068
1068
name |trustedTypeName|, with its associated data value set to |dataString|.
1069
1069
1070
-
## <dfn abstract-op>Prepare the script text</dfn> ## {#prepare-script-text}
1071
-
1072
-
Given an {{HTMLScriptElement}} (|script|), this algorithm performs the following steps:
1073
-
1074
-
1. If |script|'s [=script text=] value is not equal to its [=child text content=],
1075
-
set |script|'s [=script text=] to the result of executing [$Get Trusted Type compliant string$], with the following arguments:
1076
-
* {{TrustedScriptURL}} as |expectedType|,
1077
-
* |script|'s {{Document}}'s [=relevant global object=] as |global|,
1078
-
* |script|'s [=child text content=] attribute value,
1079
-
* `HTMLScriptElement text` as |sink|,
1080
-
* `'script'` as |sinkGroup|.
1081
-
1082
-
If the algorithm threw an error, rethrow the error.
1083
-
1084
1070
## Get Trusted Types-compliant attribute value ## {#validate-attribute-mutation}
1085
1071
To <dfn abstract-op export>get Trusted Types-compliant attribute value</dfn> on {{Attr}} |attribute| with {{Element}} |element| and {{TrustedType}} or a string |newValue|, perform the following steps:
<dt id="scriptEndTag">An end tag whose tag name is "script"</dt>
1238
-
<dd>
1239
-
<p>...</p>
1227
+
1. <ins>If [=this=]'s [=HTMLScriptElement/changed by trusted sink=] is true, set [=this=]'s [=HTMLScriptElement/is trusted=] to true.</ins>
1240
1228
1241
-
<ins><p>Set <var>script</var>'s [=script text=] value to its [=child text content=].</p></ins>
1229
+
1. <ins>Set [=this=]'s [=HTMLScriptElement/changed by trusted sink=] to false.</ins>
1242
1230
1243
-
<p>If the <span>active speculative HTML parser</span> is null, then <span>prepare the script
1244
-
element</span><var>script</var>. This might cause some script to execute, which might cause
1245
-
<span data-x="dom-document-write">new characters to be inserted into the tokenizer</span>, and
1246
-
might cause the tokenizer to output more tokens, resulting in a [=reentrant invocation of the parser=].</p>
1231
+
1. Run the {{HTMLScriptElement|script}}[=HTML element post-connection steps=], given [=this=].
1247
1232
1248
-
<p>...</p>
1249
-
</dd>
1250
-
</dl>
1233
+
Issue: This relies on the children changed steps never being called by the parser.
1251
1234
1252
-
Issue: The above algorithm doesn't account for the case when the script element's content is changed mid-parse. Implementors should ensure they protect against this case. See [https://github.com/w3c/trusted-types/issues/507](https://github.com/w3c/trusted-types/issues/507).
1235
+
This document modifies the [=children changed steps=] for {{SVGScriptElement}} as follows:
1236
+
1237
+
1. Set [=this=]'s [=SVGScriptElement/is trusted=] to false.
1238
+
1239
+
1. Run the {{SVGScriptElement|script}}[=post-connection steps=], given [=this=].
1240
+
1241
+
Issue: This relies on the children changed steps never being called by the parser.
1253
1242
1254
1243
#### Slot value verification #### {#slot-value-verification}
1255
1244
@@ -1270,11 +1259,22 @@ The first few steps of the [=prepare the script element=] algorithm are modified
1270
1259
<p class=note>This is done so that if a parser-inserted <code id=script-processing-model:the-script-element-28><a href=https://html.spec.whatwg.org/#the-script-element>script</a></code> element fails to
1271
1260
run when the parser tries to run it, but it is later executed after a script dynamically
1272
1261
updates it, it will execute in an async fashion even if the <code id=script-processing-model:attr-script-async-5><a href=https://html.spec.whatwg.org/#attr-script-async>async</a></code> attribute isn't set.</p>
1273
-
<li><ins><p>Execute the [$Prepare the script text$] algorithm on <var>el</var>. If that algorithm threw an error, then return.</p></ins></li>
1274
-
<li><p>Let <var ignore="">source text</var> be <var>el</var>'s <del><a id=script-processing-model:child-text-content href=https://dom.spec.whatwg.org/#concept-child-text-content data-x-internal=child-text-content>child text content</a>.</del><ins>[=script text=] value.</ins>
1262
+
1263
+
<li><p>Let <var>source text</var> be <var>el</var>'s <a id=script-processing-model:child-text-content href=https://dom.spec.whatwg.org/#concept-child-text-content data-x-internal=child-text-content>child text content</a>.
1264
+
1265
+
<li><ins>
1266
+
<p>If <var>el</var>'s [=HTMLScriptElement/is trusted=] is false:
1267
+
<ol>
1268
+
<li><p>Set <var>source text</var> to the result of executing [$Get Trusted Type compliant string$], with
1269
+
{{TrustedScript}}, <var>el</var>'s [=relevant global object=], <var>source text</var>, `'HTMLScriptElement text'`,
1270
+
and `'script'`.
1271
+
<p>If that algorithm threw an error, then return.
1272
+
</ol></ins>
1275
1273
<li>...
1276
1274
</ol>
1277
1275
1276
+
Issue: There's no proper definition for the processing of SVG script elements. However, you should apply a similar change to the processing of {{SVGScriptElement}}s.
1277
+
1278
1278
## Integration with DOM ## {#integration-with-dom}
1279
1279
1280
1280
Note: See [https://github.com/whatwg/dom/pull/1268](https://github.com/whatwg/dom/pull/1268) which upstreams this integration.
0 commit comments