[html5] r2601 - [] (0) Add a section explicitly talking about killing scripts that run for too long.

whatwg at whatwg.org whatwg at whatwg.org
Sun Dec 28 04:05:17 PST 2008


Author: ianh
Date: 2008-12-28 04:05:16 -0800 (Sun, 28 Dec 2008)
New Revision: 2601

Modified:
   index
   source
Log:
[] (0) Add a section explicitly talking about killing scripts that run for too long.

Modified: index
===================================================================
--- index	2008-12-28 11:21:19 UTC (rev 2600)
+++ index	2008-12-28 12:05:16 UTC (rev 2601)
@@ -659,7 +659,8 @@
       <ol>
        <li><a href=#definitions-0><span class=secno>5.4.3.1 </span>Definitions</a></li>
        <li><a href=#calling-scripts><span class=secno>5.4.3.2 </span>Calling scripts</a></li>
-       <li><a href=#creating-scripts><span class=secno>5.4.3.3 </span>Creating scripts</a></ol></li>
+       <li><a href=#creating-scripts><span class=secno>5.4.3.3 </span>Creating scripts</a></li>
+       <li><a href=#killing-scripts><span class=secno>5.4.3.4 </span>Killing scripts</a></ol></li>
      <li><a href=#event-loops><span class=secno>5.4.4 </span>Event loops</a>
       <ol>
        <li><a href=#generic-task-sources><span class=secno>5.4.4.1 </span>Generic task sources</a></ol></li>
@@ -34167,8 +34168,38 @@
    <li><p>The script group is the <a href=#current-script-group>current script group</a> of
    <var title="">document</var>.</li>
 
-  </ol><h4 id=event-loops><span class=secno>5.4.4 </span>Event loops</h4>
+  </ol><h5 id=killing-scripts><span class=secno>5.4.3.4 </span>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><a href=#quota_exceeded_err>QUOTA_EXCEEDED_ERR</a></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><script>
+ while (true) { /* loop */ }
+</script></pre>
+
+  </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><a href=#dom-alert>window.alert()</a></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 id=event-loops><span class=secno>5.4.4 </span>Event loops</h4>
+
   <p>To coordinate events, user interaction, scripts, rendering,
   networking, and so forth, user agents must use <dfn id=event-loop title="event
   loop">event loops</dfn> as described in this section.</p>

Modified: source
===================================================================
--- source	2008-12-28 11:21:19 UTC (rev 2600)
+++ source	2008-12-28 12:05:16 UTC (rev 2601)
@@ -38823,7 +38823,36 @@
   </ol>
 
 
+  <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><script>
+ while (true) { /* loop */ }
+</script></pre>
+
+  </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,




More information about the Commit-Watchers mailing list