HTML Standard Tracker


File a bug

SVNBugCommentTime (UTC)
2601Add a section explicitly talking about killing scripts that run for too long.2008-12-28 12:05
@@ -38816,20 +38816,49 @@ interface <dfn>Window</dfn> {
    <li><p>The base URL is the <span title="document base URL">base
    URL</span> of <var title="">document</var>. (<a
    href="#sbu-not-copy">This is a reference, not a copy</a>.)</p></li>
    <li><p>The script group is the <span>current script group</span> of
    <var title="">document</var>.</p></li>
+  <h5>Killing scripts</h5>
+  <p>User agents may impose resource limitations on scripts, for
+  example CPU quotas, memory limits, total execution time limits, or
+  bandwidth limitations. When a script exceeds a limit, the user agent
+  may either throw a <code>QUOTA_EXCEEDED_ERR</code> exception, abort
+  the script without an exception, prompt the user, or throttle script
+  execution.</p>
+  <div class="example">
+   <p>For example, the following script never terminates. A user agent
+   could, after waiting for a few seconds, prompt the user to either
+   terminate the script or let it continue.</p>
+   <pre>&lt;script>
+ while (true) { /* loop */ }
+  </div>
+  <p>User agents are encouraged to allow users to disable scripting
+  whenever the user is prompted either by a script (e.g. using the
+  <code title="dom-alert">window.alert()</code> API) or because of a
+  script's actions (e.g. because it has exceeded a time limit).</p>
+  <p>If scripting is disabled while a script is executing, the script
+  should be terminated immediately.</p>
   <h4>Event loops</h4>
   <p>To coordinate events, user interaction, scripts, rendering,
   networking, and so forth, user agents must use <dfn title="event
   loop">event loops</dfn> as described in this section.</p>
   <p>There must be at least one <span>event loop</span> per user
   agent, and at most one <span>event loop</span> per <span>unit of
   related similar-origin browsing contexts</span>.</p>