Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream Trusted Types protection of timer functions #10348

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -4610,6 +4610,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="tt-scripturlstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#typedefdef-scripturlstring"><code>ScriptURLString</code></dfn></li>
<li><dfn data-x="tt-trustedhtml" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedhtml"><code>TrustedHTML</code></dfn></li>
<li><dfn data-x="tt-trustedhtml-data" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trustedhtml-data">data</dfn></li>
<li><dfn data-x="tt-trustedscript" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#trusted-script"><code>TrustedScript</code></dfn></li>
<li><dfn data-x="tt-getcompliantstring" data-x-href="https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-string-algorithm">Get Trusted Type compliant string</dfn></li>
</ul>
</dd>
Expand Down Expand Up @@ -111834,7 +111835,7 @@ interface mixin <dfn interface>WindowEventHandlers</dfn> {
interface mixin <span>WindowOrWorkerGlobalScope</span> { &hellip; };</code> along with an
appropriate reference.</p>

<pre><code class="idl">typedef (DOMString or <span data-x="idl-Function">Function</span>) <dfn typedef>TimerHandler</dfn>;
<pre><code class="idl">typedef (DOMString or <span data-x="idl-Function">Function</span> or <span data-x="tt-trustedscript">TrustedScript</span>) <dfn typedef>TimerHandler</dfn>;

interface mixin <dfn interface>WindowOrWorkerGlobalScope</dfn> {
[Replaceable] readonly attribute USVString <span data-x="dom-origin">origin</span>;
Expand Down Expand Up @@ -113224,9 +113225,10 @@ enum <dfn enum>DOMParserSupportedType</dfn> {

<p>The <!--en-GB--><dfn id="timer-initialisation-steps">timer initialization steps</dfn>, given a
<code>WindowOrWorkerGlobalScope</code> <var>global</var>, a string or <code
data-x="idl-Function">Function</code> <var>handler</var>, a number <var>timeout</var>, a list
<var>arguments</var>, a boolean <var>repeat</var>, and optionally (and only if <var>repeat</var>
is true) a number <var>previousId</var>, are:</p>
data-x="idl-Function">Function</code> or <code data-x="tt-trustedscript">TrustedScript</code>
<var>handler</var>, a number <var>timeout</var>, a list <var>arguments</var>, a boolean
<var>repeat</var>, and optionally (and only if <var>repeat</var> is true) a number
<var>previousId</var>, are:</p>

<ol>
<li><p>Let <var>thisArg</var> be <var>global</var> if that is a <code>WorkerGlobalScope</code>
Expand Down Expand Up @@ -113282,6 +113284,28 @@ enum <dfn enum>DOMParserSupportedType</dfn> {
<p>Otherwise:</p>

<ol>
<li>
<p>If <var>previousId</var> was not given:</p>

<ol>
<li><p>Let <var>globalName</var> be "<code data-x="">Window</code>" if <span>this</span>'s
<span>relevant global object</span> is a <code>Window</code> object; "<code
data-x="">Worker</code>" otherwise.</p></li>

<li><p>Let <var>methodName</var> be "<code data-x="">setInterval</code>" if
<var>repeat</var> is true; "<code data-x="">setTimeout</code>" otherwise.</p></li>

<li><p>Let <var>sink</var> be a concatenation of <var>globalName</var>,
"<code data-x=""> </code>", and <var>methodName</var>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<code data-x=""> </code>", and <var>methodName</var>.</p></li>
U+0020 SPACE, and <var>methodName</var>.</p></li>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chucked it through https://domenic.github.io/rewrapper/ so hopefully it's correct


<li><p>Set <var>handler</var> to the result of invoking the <span
data-x="tt-getcompliantstring">Get Trusted Type compliant string</span> algorithm with
<code data-x="tt-trustedscript">TrustedScript</code>, <span>this</span>'s <span>relevant
global object</span>, <var>handler</var>, <var>sink</var>, and "<code
data-x="">script</code>".</p></li>
</ol>
</li>

<li><p><span>Assert</span>: <var>handler</var> is a string.</p></li>

<li><p>Perform <span
Expand Down
Loading