Skip to content

Commit

Permalink
[] (0) Add a section explicitly talking about killing scripts that ru…
Browse files Browse the repository at this point in the history
…n for too long.

git-svn-id: http://svn.whatwg.org/webapps@2601 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 28, 2008
1 parent 2d0be15 commit 9189b01
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
35 changes: 33 additions & 2 deletions index
Expand Up @@ -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>
Expand Down Expand Up @@ -34167,7 +34168,37 @@ interface <dfn id=window>Window</dfn> {
<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>&lt;script&gt;
while (true) { /* loop */ }
&lt;/script&gt;</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
Expand Down
29 changes: 29 additions & 0 deletions source
Expand Up @@ -38823,6 +38823,35 @@ interface <dfn>Window</dfn> {
</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>&lt;script>
while (true) { /* loop */ }
&lt;/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>

Expand Down

0 comments on commit 9189b01

Please sign in to comment.