Skip to content
Permalink
Browse files

[gow] (2) Drop support for anything but UTF-8 from Workers.

git-svn-id: http://svn.whatwg.org/webapps@4138 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Oct 14, 2009
1 parent 603a992 commit 308f91febb1156bb71b5eaf61ebdbfb84bb40fc8
Showing with 24 additions and 184 deletions.
  1. +20 −91 complete.html
  2. +4 −93 source
@@ -916,16 +916,15 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
<li><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>9.2.1.2 </span>Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a></li>
<li><a href=#shared-workers-and-the-sharedworkerglobalscope-inteface><span class=secno>9.2.1.3 </span>Shared workers and the <code>SharedWorkerGlobalScope</code> inteface</a></ol></li>
<li><a href=#origins-of-workers><span class=secno>9.2.2 </span>Origins of workers</a></li>
<li><a href=#decoding-scripts><span class=secno>9.2.3 </span>Decoding scripts</a></li>
<li><a href=#the-event-loop><span class=secno>9.2.4 </span>The event loop</a></li>
<li><a href="#the-worker's-lifetime"><span class=secno>9.2.5 </span>The worker's lifetime</a></li>
<li><a href=#processing-model-4><span class=secno>9.2.6 </span>Processing model</a></li>
<li><a href=#runtime-script-errors-0><span class=secno>9.2.7 </span>Runtime script errors</a></li>
<li><a href=#creating-workers><span class=secno>9.2.8 </span>Creating workers</a>
<li><a href=#the-event-loop><span class=secno>9.2.3 </span>The event loop</a></li>
<li><a href="#the-worker's-lifetime"><span class=secno>9.2.4 </span>The worker's lifetime</a></li>
<li><a href=#processing-model-4><span class=secno>9.2.5 </span>Processing model</a></li>
<li><a href=#runtime-script-errors-0><span class=secno>9.2.6 </span>Runtime script errors</a></li>
<li><a href=#creating-workers><span class=secno>9.2.7 </span>Creating workers</a>
<ol>
<li><a href=#the-abstractworker-abstract-interface><span class=secno>9.2.8.1 </span>The <code>AbstractWorker</code> abstract interface</a></li>
<li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>9.2.8.2 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
<li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>9.2.8.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
<li><a href=#the-abstractworker-abstract-interface><span class=secno>9.2.7.1 </span>The <code>AbstractWorker</code> abstract interface</a></li>
<li><a href=#dedicated-workers-and-the-worker-interface><span class=secno>9.2.7.2 </span>Dedicated workers and the <code>Worker</code> interface</a></li>
<li><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>9.2.7.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></ol></ol></li>
<li><a href=#apis-available-to-workers><span class=secno>9.3 </span>APIs available to workers</a>
<ol>
<li><a href=#importing-scripts-and-libraries><span class=secno>9.3.1 </span>Importing scripts and libraries</a></li>
represents.</p>


<h4 id=decoding-scripts><span class=secno>9.2.3 </span>Decoding scripts</h4>

<p>When a user agent is to <dfn id=decode-a-script-resource>decode a script resource</dfn> to
obtain its source in Unicode, it must run the following steps:</p>

<ol><li>

<p>Let <var title="">character encoding</var> be <i title="">unknown</i>.</p>

</li>

<li>

<p>For each of the rows in the following table, starting with the
first one and going down, if the resource has as many or more
bytes available than the number of bytes in the first column, and
the first bytes of the resource match the bytes given in the first
column, then let <var title="">character encoding</var> be the
encoding given in the cell in the second column of that row:</p>

<!-- this table is present in several forms in this file; keep them in sync -->
<table><thead><tr><th>Bytes in Hexadecimal
<th>Encoding
<tbody><!-- nobody uses this
<tr>
<td>00 00 FE FF
<td>UTF-32BE
<tr>
<td>FF FE 00 00
<td>UTF-32LE
--><tr><td>FE FF
<td>UTF-16BE
<tr><td>FF FE
<td>UTF-16LE
<tr><td>EF BB BF
<td>UTF-8
<!-- nobody uses this
<tr>
<td>DD 73 66 73
<td>UTF-EBCDIC
-->
</table><p class=note>This step looks for Unicode Byte Order Marks
(BOMs).</p>

</li>

<li>

<p>If <var title="">character encoding</var> is still <i title="">unknown</i>, apply the <a href=#algorithm-for-extracting-an-encoding-from-a-content-type>algorithm for extracting an
encoding from a Content-Type</a> to the resource's <a href=#content-type title=Content-Type>Content Type metadata</a>; if this returns
an encoding, and the user agent supports that encoding, then let
<var title="">character encoding</var> be that encoding.</p>

</li>

<li>

<p>If <var title="">character encoding</var> is still <i title="">unknown</i>, then let <var title="">character
encoding</var> be UTF-8.</p>

</li>

<li>

<p>Convert the resource to Unicode using the character encoding
given by <var title="">character encoding</var>.</p>

<p>Return the text that is so obtained.</p>

</li>

</ol><h4 id=the-event-loop><span class=secno>9.2.4 </span>The event loop</h4>
<h4 id=the-event-loop><span class=secno>9.2.3 </span>The event loop</h4>

<p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has an <a href=#event-loop>event
loop</a> distinct from those defined for <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of



<h4 id="the-worker's-lifetime"><span class=secno>9.2.5 </span>The worker's lifetime</h4>
<h4 id="the-worker's-lifetime"><span class=secno>9.2.4 </span>The worker's lifetime</h4>

<p>Workers communicate with other workers and with <a href=#browsing-context title="browsing context">browsing contexts</a> through <a href=#channel-messaging title="channel messaging">message channels</a> and their
<code><a href=#messageport>MessagePort</a></code> objects.</p>
<a href=#permissible-worker>permissible worker</a>.</p>


<h4 id=processing-model-4><span class=secno>9.2.6 </span>Processing model</h4>
<h4 id=processing-model-4><span class=secno>9.2.5 </span>Processing model</h4>

<p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with
<a href=#url>URL</a> <var title="">url</var>, a browsing context <var title="">owner browsing context</var>, an origin <var title="">owner
named <code title=event-error>error</code> at that
object. Abort these steps.</p>

<p>If the attempt succeeds, then <a href=#decode-a-script-resource title="decode a script
resource">decode the script resource</a> to obtain its <var title="">source</var>.</p>
<p>If the attempt succeeds, then convert the script resource to
Unicode by assuming it was encoded as UTF-8, to obtain its <var title="">source</var>.</p>

<p>Let <var title="">language</var> be JavaScript.</p>

<a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>


<h4 id=runtime-script-errors-0><span class=secno>9.2.7 </span>Runtime script errors</h4>
<h4 id=runtime-script-errors-0><span class=secno>9.2.6 </span>Runtime script errors</h4>

<p>Whenever an uncaught runtime script error occurs in one of the
worker's scripts, if the error did not occur while handling a



<h4 id=creating-workers><span class=secno>9.2.8 </span>Creating workers</h4>
<h4 id=creating-workers><span class=secno>9.2.7 </span>Creating workers</h4>

<h5 id=the-abstractworker-abstract-interface><span class=secno>9.2.8.1 </span>The <code><a href=#abstractworker>AbstractWorker</a></code> abstract interface</h5>
<h5 id=the-abstractworker-abstract-interface><span class=secno>9.2.7.1 </span>The <code><a href=#abstractworker>AbstractWorker</a></code> abstract interface</h5>

<pre class=idl>interface <dfn id=abstractworker>AbstractWorker</dfn> {
attribute <a href=#function>Function</a> <a href=#handler-abstractworker-onerror title=handler-AbstractWorker-onerror>onerror</a>;
<table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
<tbody><tr><td><dfn id=handler-abstractworker-onerror title=handler-AbstractWorker-onerror><code>onerror</code></dfn> <td> <code title=event-error>error</code>
<!-- v2-onclose <tr><td><dfn title="handler-AbstractWorker-onclose"><code>onclose</code></dfn> <td> <code title="event-close">close</code> -->
</table><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>9.2.8.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>
</table><h5 id=dedicated-workers-and-the-worker-interface><span class=secno>9.2.7.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</h5>

<pre class=idl>[<a href=#dom-worker title=dom-Worker>Constructor</a>(in DOMString scriptURL)]
interface <dfn id=worker>Worker</dfn> : <a href=#abstractworker>AbstractWorker</a> {
implementing the <code><a href=#workerutils>WorkerUtils</a></code> interface.</p>


<h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>9.2.8.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>
<h5 id=shared-workers-and-the-sharedworker-interface><span class=secno>9.2.7.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</h5>

<pre class=idl>[<a href=#dom-sharedworker title=dom-SharedWorker>Constructor</a>(in DOMString scriptURL, in optional DOMString name)]
interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#abstractworker>AbstractWorker</a> {
<code><a href=#network_err>NETWORK_ERR</a></code> exception and abort all these
steps.</p>

<p>If the attempt succeeds, then <a href=#decode-a-script-resource title="decode a script
resource">decode the script resource</a> to obtain its <var title="">source</var>.</p>
<p>If the attempt succeeds, then convert the script resource to
Unicode by assuming it was encoded as UTF-8, to obtain its <var title="">source</var>.</p>

<p>Let <var title="">language</var> be JavaScript.</p>

97 source
represents.</p>


<h4>Decoding scripts</h4>

<p>When a user agent is to <dfn>decode a script resource</dfn> to
obtain its source in Unicode, it must run the following steps:</p>

<ol>

<li>

<p>Let <var title="">character encoding</var> be <i
title="">unknown</i>.</p>

</li>

<li>

<p>For each of the rows in the following table, starting with the
first one and going down, if the resource has as many or more
bytes available than the number of bytes in the first column, and
the first bytes of the resource match the bytes given in the first
column, then let <var title="">character encoding</var> be the
encoding given in the cell in the second column of that row:</p>

<!-- this table is present in several forms in this file; keep them in sync -->
<table>
<thead>
<tr>
<th>Bytes in Hexadecimal
<th>Encoding
<tbody>
<!-- nobody uses this
<tr>
<td>00 00 FE FF
<td>UTF-32BE
<tr>
<td>FF FE 00 00
<td>UTF-32LE
-->
<tr>
<td>FE FF
<td>UTF-16BE
<tr>
<td>FF FE
<td>UTF-16LE
<tr>
<td>EF BB BF
<td>UTF-8
<!-- nobody uses this
<tr>
<td>DD 73 66 73
<td>UTF-EBCDIC
-->
</table>

<p class="note">This step looks for Unicode Byte Order Marks
(BOMs).</p>

</li>

<li>

<p>If <var title="">character encoding</var> is still <i
title="">unknown</i>, apply the <span>algorithm for extracting an
encoding from a Content-Type</span> to the resource's <span
title="Content-Type">Content Type metadata</span>; if this returns
an encoding, and the user agent supports that encoding, then let
<var title="">character encoding</var> be that encoding.</p>

</li>

<li>

<p>If <var title="">character encoding</var> is still <i
title="">unknown</i>, then let <var title="">character
encoding</var> be UTF-8.</p>

</li>

<li>

<p>Convert the resource to Unicode using the character encoding
given by <var title="">character encoding</var>.</p>

<p>Return the text that is so obtained.</p>

</li>

</ol>


<h4>The event loop</h4>

named <code title="event-error">error</code> at that
object. Abort these steps.</p>

<p>If the attempt succeeds, then <span title="decode a script
resource">decode the script resource</span> to obtain its <var
<p>If the attempt succeeds, then convert the script resource to
Unicode by assuming it was encoded as UTF-8, to obtain its <var
title="">source</var>.</p>

<p>Let <var title="">language</var> be JavaScript.</p>
<code>NETWORK_ERR</code> exception and abort all these
steps.</p>

<p>If the attempt succeeds, then <span title="decode a script
resource">decode the script resource</span> to obtain its <var
<p>If the attempt succeeds, then convert the script resource to
Unicode by assuming it was encoded as UTF-8, to obtain its <var
title="">source</var>.</p>

<p>Let <var title="">language</var> be JavaScript.</p>

0 comments on commit 308f91f

Please sign in to comment.
You can’t perform that action at this time.