/[suikacvs]/markup/html/html5/spec-ja/workers-non-normative.ja.html.u8
Suika

Contents of /markup/html/html5/spec-ja/workers-non-normative.ja.html.u8

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.229 - (hide annotations) (download)
Mon Apr 5 06:22:33 2010 UTC (16 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.228: +2 -2 lines
make

1 wakaba 1.219 <!DOCTYPE html><html lang=en-US-x-hixie><meta charset=ascii><title>Web Workers</title><link href=http://www.whatwg.org/style/specification rel=stylesheet>
2     <link href=ja-style rel=stylesheet>
3     <link href=only-ja-style rel="stylesheet" title="Show only Japanese text" id=style-only-ja>
4     <link href=both-en-ja-style rel="alternate stylesheet" title="Show both English and Japanese texts" id=style-both-en-ja>
5     <script src=ja-script defer async></script><link href=http://www.whatwg.org/images/icon rel=icon><body class=cfc>
6    
7     <header class=head><p class="has-ja-translation" data-ja-hash="7c0cfd95ed2e5f66067c25a5e7fec67c"><span class=en-original lang=en><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></span><span class=ja-translation lang=ja><a class=logo href=http://www.whatwg.org/ rel=home><img lang=en alt=WHATWG
8     src=http://www.whatwg.org/images/logo></a></span></p>
9     <hgroup><h1 class="no-ja-translation" data-ja-hash="6cb7eb9696d986359fa3a78c4b8e60dc"><span class=en-original lang=en>Web Workers</span></h1>
10 wakaba 1.229 <h2 class="no-num no-toc has-ja-translation" data-ja-hash="8a7847394b9b718bd84c2d29d478640c" data-ja-real-hash="695bfcb38eaef41135c52e02e3bce8b1"><span class=en-original lang=en>Draft Recommendation &mdash; 4 April 2010</span><span class=ja-translation lang=ja>勧告案<ins class=ja-note>の非公式和訳</ins> &mdash;
11     <ins class=ja-note>(原文出版日)</ins> 4 April 2010</span></h2>
12 wakaba 1.219 </hgroup><p class="has-ja-translation" data-ja-hash="5211c3fce4ddd8160d21446a73a092c1"><span class=en-original lang=en>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></span><span class=ja-translation lang=ja>みなさんにも作業にご参加いただけます。 <a
13     href=http://www.whatwg.org/mailing-list>作業部会の議論用メイリング・リストに参加してください。</a></span></p>
14     <p class="has-ja-translation" data-ja-hash="f8e7b0fcec0268c81579638290279e82"><span class=en-original lang=en><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</span><span class=ja-translation lang=ja><strong>Web デザイナーのみなさん!</strong> みなさんのための <a
15     href=http://blog.whatwg.org/faq/ lang=en>FAQ</a>、<a
16     href=http://forums.whatwg.org/>掲示板</a>、<a
17     href=http://www.whatwg.org/mailing-list#help>ヘルプ用メイリング・リスト</a>があります!
18    
19     </span><p>
20    
21     <!-- Japanese-translation-only notes -->
22     <ins class="ja-note cover-ja-note" lang=ja>
23     <p>この文書は、 WHATWG 仕様書の日本語訳です。 正式な仕様書は英語版だけであり、この日本語訳はあくまで参考としてご利用ください。
24    
25     <p lang=en>This document is a non-normative Japanese translation of the WHATWG specification. Only the original English version is normative and this Japanese translation is non‐normative.
26    
27     <p>日本語訳は段落をダブルクリックすると編集できます。<a href="http://suika.fam.cx/~wakaba/pbin/accounts/add">アカウントを作成</a>して <code>spec-ja</code> グループに参加してください。編集結果はおよそ3時間おきに反映されます。また、原文の変更には毎日自動的に追随しています。 (<a href=notes>詳細</a>)
28    
29     <p lang=en>You can edit Japanese text by double-clicking the paragraph you'd like to edit. <a href="http://suika.fam.cx/~wakaba/pbin/accounts/add">Create an account</a> and join the <code>spec-ja</code> group. Any additions of and modifications to Japanese text will be applied to the document within about three hours. Any changes to the original English specification will automatically be incorporated to the document every day. (<a href=notes>Details</a>)
30    
31     <p><a href="http://wiki.whatwg.org/wiki/Translations">他の翻訳のリスト</a>もご覧ください。
32    
33     <p lang=en>See also the list of <a href="http://wiki.whatwg.org/wiki/Translations">translations</a>.
34    
35     <p><button type=button onclick="
36     document.getElementById ('style-only-ja').disabled = false;
37     document.getElementById ('style-both-en-ja').disabled = true;
38     ">日本語訳だけ表示 <span lang=en>Show only Japanese translation</span></button>
39     <p><button type=button onclick="
40     document.getElementById ('style-only-ja').disabled = true;
41     document.getElementById ('style-both-en-ja').disabled = false;
42     ">英和対訳表示 <span lang=en>Show both English and Japanese texts</span></button>
43     </ins>
44    
45     <p><span><!-- dummy --></span></p>
46     <dl><dt class="has-ja-translation" data-ja-hash="87b044fafc6f01197a9a700e6fa28a69"><span class=en-original lang=en>This version:</span><span class=ja-translation lang=ja><ins class=ja-note>原文の</ins>この版</span></dt>
47     <dd class="no-ja-translation" data-ja-hash="b1b00adfdf359bf303bf8c64476f2e91"><span class=en-original lang=en><a href=http://www.whatwg.org/specs/web-workers/current-work/>http://whatwg.org/ww</a></span></dd>
48     <dt class="has-ja-translation" data-ja-hash="8866e8de2efa7275a5dc8e942c1613c2"><span class=en-original lang=en>Version history:</span><span class=ja-translation lang=ja><ins class=ja-note>原文の</ins>改版履歴:</span></dt>
49     <dd class="has-ja-translation" data-ja-hash="fc2cb84da44565f149b710ac5dfb38f2"><span class=en-original lang=en>Twitter messages (non-editorial changes only): <a href=http://twitter.com/WHATWG>http://twitter.com/WHATWG</a></span><span class=ja-translation lang=ja><span lang=en>Twitter</span> メッセージ (編集上の変更以外): <a
50     href=http://twitter.com/WHATWG>http://twitter.com/WHATWG</a></span></dd>
51     <dd class="has-ja-translation" data-ja-hash="3a0facbd53f73c0877af4c6485a783af"><span class=en-original lang=en>Commit-Watchers mailing list: <a href=http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org>http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a></span><span class=ja-translation lang=ja>Commit-Watchers メイリング・リスト: <a
52     href=http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org>http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a></span></dd>
53     <dd class="has-ja-translation" data-ja-hash="5e1dbca74cface6f0d0ea523340e6a89" data-ja-real-hash="a5d87a842e49eed08d894d0148296604"><span class=en-original lang=en>Interactive Web interface: <a href=http://html5.org/tools/web-workers-tracker>http://html5.org/tools/web-workers-tracker</a></span><span class=ja-translation lang=ja>対話的 <span lang=en>Web</span> 界面: <a href=http://html5.org/tools/web-workers-tracker>http://html5.org/tools/web-workers-tracker</a></span></dd>
54     <dd class="has-ja-translation" data-ja-hash="ea5cbdd06bfb529e4a1bcfeac9cfbd61" data-ja-real-hash="fabeffa34fbe319f499e2c5fd49a414f"><span class=en-original lang=en>Subversion interface: <a href=http://svn.whatwg.org/webworkers/>http://svn.whatwg.org/webworkers/</a></span><span class=ja-translation lang=ja><span lang=en>Subversion</span> 界面: <a href=http://svn.whatwg.org/webworkers/>http://svn.whatwg.org/webworkers/</a></span></dd>
55     <dt class="has-ja-translation" data-ja-hash="8468b55db22971120cb71091ece7839e"><span class=en-original lang=en>Issues:</span><span class=ja-translation lang=ja>問題:</span></dt>
56     <dd class="has-ja-translation" data-ja-hash="80e92f8cfebdeaa7dd35236fded506f7"><span class=en-original lang=en>To send feedback: <a href=http://www.whatwg.org/mailing-list>[email protected]</a></span><span class=ja-translation lang=ja>フィードバックの送信先: <a
57     href=http://www.whatwg.org/mailing-list>[email protected]</a></span></dd>
58     <dd class="has-ja-translation" data-ja-hash="31c70a584b8b4195d95daffc76736dea"><span class=en-original lang=en>To view and vote on feedback: <a href=http://www.whatwg.org/issues/>http://www.whatwg.org/issues/</a></span><span class=ja-translation lang=ja>フィードバックの閲覧・投票: <a
59     href=http://www.whatwg.org/issues/>http://www.whatwg.org/issues/</a></span></dd>
60     <dt class="has-ja-translation" data-ja-hash="aa8d072dc59504320cfa92381f541a5f"><span class=en-original lang=en>Editor:</span><span class=ja-translation lang=ja>編集者:</span></dt>
61     <dd class="no-ja-translation" data-ja-hash="220fb2ab7924ad62bc8567b8b9c5f0f8"><span class=en-original lang=en>Ian Hickson, Google, [email protected]</span></dd>
62 wakaba 1.224 </dl><p class="copyright no-ja-translation" data-ja-hash="d2ae8f409115bc6298556466d695b860"><span class=en-original lang=en>&copy; Copyright 2004-2010 Apple Computer, Inc.,
63 wakaba 1.219 Mozilla Foundation, and Opera Software ASA.</span></p>
64     <p class="copyright no-ja-translation" data-ja-hash="5419c8afab07265f61a6768f2680776d"><span class=en-original lang=en>You are granted a license to use, reproduce
65     and create derivative works of this document.</span></p>
66     </header><hr><h2 class="no-num no-toc has-ja-translation" data-ja-hash="e353dbe42c8654f33588d4da0b517469" id=abstract><span class=en-original lang=en>Abstract</span><span class=ja-translation lang=ja>概要</span></h2>
67    
68     <p class="has-ja-translation" data-ja-hash="a4f61aa99f0d87d5d87b6e07071a74da"><span class=en-original lang=en>This specification defines an API that allows Web application
69     authors to spawn background workers running scripts in parallel to
70     their main page. This allows for thread-like operation with
71     message-passing as the coordination mechanism.</span><span class=ja-translation lang=ja>この仕様書は、 Web アプリケーションで、主たる頁とは並列に、
72     背景労働者スクリプトを走らせるための API を定義します。
73     これにより、メッセージ・パッシングによるスレッド的操作を協調機構として利用できるようになります。</span></p>
74    
75    
76     <h2 class="no-num no-toc has-ja-translation" data-ja-hash="c9bfd146532700356f3ff5ea6b1bf72e" id=status><span class=en-original lang=en>Status of this document</span><span class=ja-translation lang=ja>この文書の状態</span></h2>
77    
78     <p class="has-ja-translation" data-ja-hash="910f4ff57cc374ba46a8fecb18849de5"><span class=en-original lang=en><strong>This is a work in progress!</strong> This document is
79     changing on a daily if not hourly basis in response to comments and
80     as a general part of its development process. Comments are very
81     welcome, please send them to <a href=mailto:[email protected]>[email protected]</a>. Thank
82     you.</span><span class=ja-translation lang=ja><strong>この文書は作業中です!</strong>
83     この文書は、コメントへの対応や通常の開発の過程として、
84     毎時毎分とは言い過ぎですが毎日のペースで変更されています。
85     コメントは非常に歓迎していますので、
86     <a href=mailto:[email protected]>[email protected]</a>
87     へお送りください。よろしくお願いします。</span></p>
88    
89     <p class="has-ja-translation" data-ja-hash="5bb9ea777b965ca8d962ba2b6f663d46"><span class=en-original lang=en>The current focus is in developing a first draft proposal.</span><span class=ja-translation lang=ja>現在の焦点は、第1案の開発です。</span></p>
90    
91     <p class="has-ja-translation" data-ja-hash="f0a0e89202a0b75b7cf2314905ae258d"><span class=en-original lang=en>Implementors should be aware that this specification is not
92     stable. <strong>Implementors who are not taking part in the
93     discussions are likely to find the specification changing out from
94     under them in incompatible ways.</strong> Vendors interested in
95     implementing this specification before it eventually reaches the
96     call for implementations should join the <a href=/mailing-list>WHATWG mailing list</a> and take part in the
97     discussions.</span><span class=ja-translation lang=ja>実装者は、この仕様書が安定していないことに注意するべきです。
98     <strong>実装者は議論に参加しておかないと、
99     仕様がその実装とは非互換に変更されてしまうかもしれません。</strong>
100     この仕様書がいずれ実装呼び掛けの段階に達するのよりも前にこの仕様を実装したい販売者は、
101     <a href=http://www.whatwg.org/mailing-list>WHATWG メイリング・リスト</a>に参加し、
102     議論に加わるべきです。</span></p>
103    
104     <p class="no-ja-translation" data-ja-hash="739dc8d532ab9ebbd8a5ba09015898cc"><span class=en-original lang=en>This specification is also being produced by the <a href=http://www.w3.org/2008/webapps/>W3C Web Apps WG</a>. The two
105     specifications are identical from the table of contents onwards.</span></p>
106    
107    
108    
109     <h2 class="no-num no-toc has-ja-translation" data-ja-hash="598b8ae10dfce818e73d3218daddbdae" id=contents><span class=en-original lang=en>Table of contents</span><span class=ja-translation lang=ja>目次
110     </span></h2>
111    
112     <!--begin-toc-->
113     <ol class=toc>
114     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="e8340d3e813afc18cffdf99dd3a546e3"><span class=en-original lang=en><a href=#introduction><span class=secno>1 </span>Introduction</a>
115     </span><ol>
116     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="1f928c91e5f5cc18f353953a9057c45e"><span class=en-original lang=en><a href=#scope><span class=secno>1.1 </span>Scope</a></span></li>
117     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="d9aa6a9a8b1af17de823ae3bc43e4cfa"><span class=en-original lang=en><a href=#tutorial><span class=secno>1.2 </span>Tutorial</a>
118     </span><ol>
119     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="4cc3646bed3970b883d0e3670dc846be"><span class=en-original lang=en><a href=#a-background-number-crunching-worker><span class=secno>1.2.1 </span>A background number-crunching worker</a></span></li>
120     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="d6b18f36ab82a61c165ccf567ef56b09"><span class=en-original lang=en><a href=#a-worker-for-updating-a-client-side-database><span class=secno>1.2.2 </span>A worker for updating a client-side database</a></span></li>
121     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="5d6e6c3a38a06321f9ff944393eb85c8"><span class=en-original lang=en><a href=#worker-used-for-background-i/o><span class=secno>1.2.3 </span>Worker used for background I/O</a></span></li>
122 wakaba 1.226 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="7b20b3ae366af02fed36219f64979f9f"><span class=en-original lang=en><a href=#shared-workers-introduction><span class=secno>1.2.4 </span>Shared workers introduction</a></span></li>
123     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="72d06b0efa82c67e9e58b806b78fa1a8"><span class=en-original lang=en><a href=#shared-state-using-a-shared-worker><span class=secno>1.2.5 </span>Shared state using a shared worker</a></span></li>
124     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="3ac03019bcefff93041476471ab961e4"><span class=en-original lang=en><a href=#delegation><span class=secno>1.2.6 </span>Delegation</a></span></li>
125     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="f82cd322fe36d4211f7042b5bb18f392"><span class=en-original lang=en><a href=#providing-libraries><span class=secno>1.2.7 </span>Providing libraries</a></span></ol></ol></li>
126 wakaba 1.219 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="adf81d9200d74ed3c0f2c032a0531bf6"><span class=en-original lang=en><a href=#conformance-requirements><span class=secno>2 </span>Conformance requirements</a>
127     </span><ol>
128     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="b161941cca2282efa472ccf0fc205795"><span class=en-original lang=en><a href=#dependencies><span class=secno>2.1 </span>Dependencies</a></span></ol></li>
129     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="50b097cb49254c35d708954ba4f90f62"><span class=en-original lang=en><a href=#terminology><span class=secno>3 </span>Terminology</a></span></li>
130     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="211638ee3831cd03e9865c803584d48d"><span class=en-original lang=en><a href=#infrastructure><span class=secno>4 </span>Infrastructure</a>
131     </span><ol>
132     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="f3f7863eb788bc470f20764d323ff03a"><span class=en-original lang=en><a href=#the-global-scope><span class=secno>4.1 </span>The global scope</a>
133     </span><ol>
134     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="07444422623a61768c995caee39d6f3f"><span class=en-original lang=en><a href=#the-workerglobalscope-abstract-interface><span class=secno>4.1.1 </span>The <code>WorkerGlobalScope</code> abstract interface</a></span></li>
135     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ffb909cb8c908fc02c8383085a89f4b3"><span class=en-original lang=en><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface><span class=secno>4.1.2 </span>Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a></span></li>
136     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="4ce24e9ab32d066fc7ea5182fd496649"><span class=en-original lang=en><a href=#shared-workers-and-the-sharedworkerglobalscope-inteface><span class=secno>4.1.3 </span>Shared workers and the <code>SharedWorkerGlobalScope</code> inteface</a></span></ol></li>
137     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="10cadfd4dee0f6d90bce2e454a454935"><span class=en-original lang=en><a href=#origins-of-workers><span class=secno>4.2 </span>Origins of workers</a></span></li>
138     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="9122d7d6489cc64d53311a28df9a7b7c"><span class=en-original lang=en><a href=#the-event-loop><span class=secno>4.3 </span>The event loop</a></span></li>
139     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="c3ccc4e8fa8c8966f53c5e3c7357b10f"><span class=en-original lang=en><a href="#the-worker's-lifetime"><span class=secno>4.4 </span>The worker's lifetime</a></span></li>
140     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="6fdd4bae9c070e5723b541a38273cfdf"><span class=en-original lang=en><a href=#processing-model><span class=secno>4.5 </span>Processing model</a></span></li>
141     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="0496c82cbd953a1ece902781a7de83da"><span class=en-original lang=en><a href=#runtime-script-errors><span class=secno>4.6 </span>Runtime script errors</a></span></li>
142     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="6af442854ffea1d03d2ed67285533872"><span class=en-original lang=en><a href=#creating-workers><span class=secno>4.7 </span>Creating workers</a>
143     </span><ol>
144     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="2d746de24c1fbed5a79a81b6d15f9a82"><span class=en-original lang=en><a href=#the-abstractworker-abstract-interface><span class=secno>4.7.1 </span>The <code>AbstractWorker</code> abstract interface</a></span></li>
145     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="72c6786908301c829a4a85d3a1e12250"><span class=en-original lang=en><a href=#dedicated-workers-and-the-worker-interface><span class=secno>4.7.2 </span>Dedicated workers and the <code>Worker</code> interface</a></span></li>
146     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="279461ee7819a3134fc3984fdd1fca09"><span class=en-original lang=en><a href=#shared-workers-and-the-sharedworker-interface><span class=secno>4.7.3 </span>Shared workers and the <code>SharedWorker</code> interface</a></span></ol></ol></li>
147     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="a47f7c0f403c3aa899ecde08deff9a43"><span class=en-original lang=en><a href=#apis-available-to-workers><span class=secno>5 </span>APIs available to workers</a>
148     </span><ol>
149     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="37e9da5ea67ea86a29b62f8e0d1111ef"><span class=en-original lang=en><a href=#importing-scripts-and-libraries><span class=secno>5.1 </span>Importing scripts and libraries</a></span></li>
150     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="560332ac6821295be00c738df52032d0"><span class=en-original lang=en><a href=#the-workernavigator-object><span class=secno>5.2 </span>The <code>WorkerNavigator</code> object</a></span></li>
151     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="7f0a8a7686a8cd5685cb93c1f3f82741"><span class=en-original lang=en><a href=#apis-defined-in-other-specifications><span class=secno>5.3 </span>APIs defined in other specifications</a></span></li>
152     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="8dda0154835b8739bd1ada5c0b5c089f"><span class=en-original lang=en><a href=#interface-objects-and-constructors><span class=secno>5.4 </span>Interface objects and constructors</a></span></li>
153     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="aae8cb440e8679d879f0df57ac164dc0"><span class=en-original lang=en><a href=#worker-locations><span class=secno>5.5 </span>Worker locations</a></span></ol></li>
154     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="721ff2a311123f40dbb5fe64d58f47d3"><span class=en-original lang=en><a class=no-num href=#references>References</a></span></li>
155     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="e3edbd0e5dae2337ce9018ac56f33463"><span class=en-original lang=en><a class=no-num href=#acknowledgements>Acknowledgements</a></span></ol>
156     <!--end-toc-->
157     <hr><h2 id=introduction class="has-ja-translation" data-ja-hash="0b79795d3efc95b9976c7c5b933afce2"><span class=en-original lang=en><span class=secno>1 </span>Introduction</span><span class=ja-translation lang=ja><span class=secno>1 </span>はじめに</span></h2>
158    
159     <h3 id=scope class="has-ja-translation" data-ja-hash="5d113f2038d289f391614c39043629e8"><span class=en-original lang=en><span class=secno>1.1 </span>Scope</span><span class=ja-translation lang=ja><span class=secno>1.1 </span>適用範囲</span></h3>
160    
161     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
162    
163     <p class="no-ja-translation" data-ja-hash="2f78689edd39ccffc1a21b979c376f45"><span class=en-original lang=en>This specification defines an API for running scripts in the
164     background independently of any user interface scripts.</span></p>
165    
166     <p class="no-ja-translation" data-ja-hash="f41b6868a33d2c4d265857efdf426694"><span class=en-original lang=en>This allows for long-running scripts that are not interrupted by
167     scripts that respond to clicks or other user interactions, and
168     allows long tasks to be executed without yielding to keep the page
169     responsive.</span></p>
170    
171     <p class="no-ja-translation" data-ja-hash="52e3c8127ee80a92ae3709986b8f2450"><span class=en-original lang=en>Workers (as these background scripts are called herein) are
172     relatively heavy-weight, and are not intended to be used in large
173     numbers. For example, it would be inappropriate to launch one worker
174     for each pixel of a four megapixel image. The examples below show
175     some appropriate uses of workers.</span></p>
176    
177     <p class="no-ja-translation" data-ja-hash="497e60abbf38e141b92f7017f71dc302"><span class=en-original lang=en>Generally, workers are expected to be long-lived, have a high
178     start-up performance cost, and a high per-instance memory cost.</span></p>
179    
180    
181     <h3 id=tutorial class="has-ja-translation" data-ja-hash="368fe771261fcb18f7988833c9294a20"><span class=en-original lang=en><span class=secno>1.2 </span>Tutorial</span><span class=ja-translation lang=ja><span class=secno>1.2 </span>解説</span></h3>
182    
183     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
184    
185     <p class="has-ja-translation" data-ja-hash="c98bec741e84294c9feae0d581f897b6"><span class=en-original lang=en>There are a variety of uses that workers can be put to. The
186     following subsections show various examples of this use.</span><span class=ja-translation lang=ja>労働者は色々なことに使えます。次の各節では、色々な使い方の例を示します。</span></p>
187    
188     <h4 id=a-background-number-crunching-worker class="has-ja-translation" data-ja-hash="03100d1ee403be709f47c37e6b55c758"><span class=en-original lang=en><span class=secno>1.2.1 </span>A background number-crunching worker</span><span class=ja-translation lang=ja><span class=secno>1.2.1 </span>数値処理背景労働者</span></h4>
189    
190     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
191    
192     <p class="has-ja-translation" data-ja-hash="6656ef1c2fd445878e165388d704a723"><span class=en-original lang=en>The simplest use of workers is for performing a computationally
193     expensive task without interrupting the user interface.</span><span class=ja-translation lang=ja>労働者の一番単純な用法は、計算的に高価な仕事を利用者界面を中断させずに実行するというものです。</span></p>
194    
195     <p class="has-ja-translation" data-ja-hash="14941a1ddb566828a9181bcecf3a815a"><span class=en-original lang=en>In this example, the main document spawns a worker to
196     (na&iuml;vely) compute prime numbers, and progressively displays the
197     most recently found prime number.</span><span class=ja-translation lang=ja>この例では、主たる文書が労働者を作って素数を (素朴な方法で) 計算させ、
198     新しく見つかった素数を順番に表示してゆきます。</span></p>
199    
200     <p class="has-ja-translation" data-ja-hash="97bcf42c4070cbcef605cfa277d832fb"><span class=en-original lang=en>The main page is as follows:</span><span class=ja-translation lang=ja>主たる頁は次の通りです。</span></p>
201    
202     <pre class="no-ja-translation" data-ja-hash="45b861d46157f155d38040db723bafd1"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
203     &lt;html&gt;
204     &lt;head&gt;
205     &lt;title&gt;Worker example: One-core computation&lt;/title&gt;
206     &lt;/head&gt;
207     &lt;body&gt;
208     &lt;p&gt;The highest prime number discovered so far is: &lt;output id="result"&gt;&lt;/output&gt;&lt;/p&gt;
209     &lt;script&gt;
210     var worker = new Worker('worker.js');
211     worker.onmessage = function (event) {
212     document.getElementById('result').textContent = event.data;
213     };
214     &lt;/script&gt;
215     &lt;/body&gt;
216     &lt;/html&gt;</span></pre>
217    
218     <p class="no-ja-translation" data-ja-hash="017be89223719af8ff417b78daf6e70a"><span class=en-original lang=en>The <code title=dom-Worker><a href=#dom-worker>Worker()</a></code> constructor call
219     creates a worker and returns a <code><a href=#worker>Worker</a></code> object
220     representing that worker, which is used to communicate with the
221     worker. That object's <code title=handler-Worker-onmessage><a href=#handler-worker-onmessage>onmessage</a></code> event handler allows the code to receive messages from the worker.</span></p>
222    
223     <p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:</span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span></p>
224    
225     <pre class="no-ja-translation" data-ja-hash="35390f08d92125ad461fd6bb5969cb0c"><span class=en-original lang=en>var n = 1;
226     search: while (true) {
227     n += 1;
228     for (var i = 2; i &lt;= Math.sqrt(n); i += 1)
229     if (n % i == 0)
230     continue search;
231     // found a prime!
232     postMessage(n);
233     }</span></pre>
234    
235     <p class="no-ja-translation" data-ja-hash="48faeab09946f0578b4b421f4cf0a5db"><span class=en-original lang=en>The bulk of this code is simply an unoptimized search for a prime
236     number. To send a message back to the page, the <code title=dom-DedicatedWorkerGlobalScope-postMessage><a href=#dom-dedicatedworkerglobalscope-postmessage>postMessage()</a></code>
237     method is used to post a message when a prime is found.</span></p>
238    
239     <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="19ee793c62fc7bda7447ccda3a91b44e"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/primes/page.html>View this example online</a>.</span><span class=ja-translation lang=ja><a href=http://www.whatwg.org/demos/workers/primes/page.html>この例をオンラインで表示する</a>。</span></p>
240    
241    
242    
243     <h4 id=a-worker-for-updating-a-client-side-database class="has-ja-translation" data-ja-hash="be08cb921deb5e88f7dcb3edbd9f0274"><span class=en-original lang=en><span class=secno>1.2.2 </span>A worker for updating a client-side database</span><span class=ja-translation lang=ja><span class=secno>1.2.2 </span>クライアント側データベースの更新のための労働者</span></h4>
244    
245     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
246    
247     <p class="no-ja-translation" data-ja-hash="e8e4acfb27dabd6fd72aa5a4af7b7d25"><span class=en-original lang=en>In this example, the main document spawns a worker whose only
248     task is to listen for notifications from the server, and, when
249     appropriate, either add or remove data from the client-side
250     database.</span></p>
251    
252     <p class="has-ja-translation" data-ja-hash="88e890f11b614dc40f4d2453a66ec94f"><span class=en-original lang=en>Since no communication occurs between the worker and the main
253     page, the main page can start the worker by just doing:</span><span class=ja-translation lang=ja>労働者と主たる頁の間に通信は発生しませんので、
254     主たる頁は単に次のようにするだけで労働者を開始できます。</span></p>
255    
256     <pre class="no-ja-translation" data-ja-hash="c87d2a32789642a7a7353364dffa7c04"><span class=en-original lang=en>&lt;script&gt;
257     new Worker('worker.js');
258     &lt;/script&gt;</span></pre>
259    
260     <p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:</span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span></p>
261    
262     <pre class="no-ja-translation" data-ja-hash="cfd35229b68e597b6a21322a3e3c1aea"><span class=en-original lang=en>var server = new WebSocket('ws://whatwg.org/database');
263     var database = openDatabase('demobase', '1.0', 'Demo Database', 10240);
264     server.onmessage = function (event) {
265     // data is in the format "command key value"
266     var data = event.data.split(' ');
267     switch (data[0]) {
268     case '+':
269     database.transaction(function(tx) {
270     tx.executeSql('INSERT INTO pairs (key, value) VALUES (?, ?)', data[1], data[2]);
271     });
272     case '-':
273     database.transaction(function(tx) {
274     tx.executeSql('DELETE FROM pairs WHERE key=? AND value=?', data[1], data[2]);
275     });
276     }
277     };</span></pre>
278    
279     <p class="no-ja-translation" data-ja-hash="df7990f8fb4ac6850b65c14c08446f5c"><span class=en-original lang=en>This connects to the server using the <code>WebSocket</code>
280     mechanism and opens the local database (which, we presume, has been
281     created earlier). The worker then just listens for messages from the
282     server and acts on them as appropriate, forever (or until the main
283     page is closed).</span></p>
284    
285     <p class="no-ja-translation" data-ja-hash="f0d091179997558acbbf256bd7379b3d"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/database-updater/page.html>View
286     this example online</a>. (This example will not actually function,
287     since the server does not actually exist and the database is not
288     created by this sample code.)</span></p>
289    
290    
291    
292     <h4 id=worker-used-for-background-i/o class="no-ja-translation" data-ja-hash="26a2e24494eb4f94591467b79f68f6f2"><span class=en-original lang=en><span class=secno>1.2.3 </span>Worker used for background I/O</span></h4>
293    
294     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
295    
296     <p class="has-ja-translation" data-ja-hash="eb288220a303d56acd4e151bca42fe6e"><span class=en-original lang=en>In this example, the main document uses two workers, one for
297     fetching stock updates for at regular intervals, and one for
298     fetching performing search queries that the user requests.</span><span class=ja-translation lang=ja>この例では、主たる文書は2つの労働者を使います。
299     1つは一定間隔で株価の更新を取得するためのもので、もう1つは利用者の要求した検索の照会を行う取得のためのものです。</span></p>
300    
301     <p class="has-ja-translation" data-ja-hash="97bcf42c4070cbcef605cfa277d832fb"><span class=en-original lang=en>The main page is as follows:</span><span class=ja-translation lang=ja>主たる頁は次の通りです。</span></p>
302    
303     <pre class="no-ja-translation" data-ja-hash="a4e743797f3cad5ba0d0016878e0e28c"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
304     &lt;html&gt;
305     &lt;head&gt;
306     &lt;title&gt;Worker example: Stock ticker&lt;/title&gt;
307     &lt;script&gt;
308     // TICKER
309     var symbol = 'GOOG'; // default symbol to watch
310     var ticker = new Worker('ticker.js');
311    
312     // SEARCHER
313     var searcher = new Worker('searcher.js');
314     function search(query) {
315     searcher.postMessage(query);
316     }
317    
318     // SYMBOL SELECTION UI
319     function select(newSymbol) {
320     symbol = newSymbol;
321     ticker.postMessage(symbol);
322     }
323     &lt;/script&gt;
324     &lt;/head&gt;
325     &lt;body onload="search('')"&gt;
326     &lt;p&gt;&lt;output id="symbol"&gt;&lt;/output&gt; &lt;output id="value"&gt;&lt;/output&gt;&lt;/p&gt;
327     &lt;script&gt;
328     ticker.onmessage = function (event) {
329     var data = event.data.split(' ');
330     document.getElementById('symbol').textContent = data[0];
331     document.getElementById('value').textContent = data[1];
332     };
333     ticker.postMessage(symbol);
334     &lt;/script&gt;
335     &lt;p&gt;&lt;label&gt;Search: &lt;input type="text" autofocus oninput="search(this.value)"&gt;&lt;/label&gt;&lt;/p&gt;
336     &lt;ul id="results"&gt;&lt;/ul&gt;
337     &lt;script&gt;
338     searcher.onmessage = function (event) {
339     var data = event.data.split(' ');
340     var results = document.getElementById('results');
341     while (results.hasChildNodes()) // clear previous results
342     results.removeChild(results.firstChild);
343     for (var i = 0; i &lt; data.length; i += 1) {
344     // add a list item with a button for each result
345     var li = document.createElement('li');
346     var button = document.createElement('button');
347     button.value = data[i];
348     button.type = 'button';
349     button.onclick = function () { select(this.value); };
350     button.textContent = data[i];
351     li.appendChild(button);
352     results.appendChild(li);
353     }
354     };
355     &lt;/script&gt;
356     &lt;p&gt;(The data in this example is not real. Try searching for "Google" or "Apple".)&lt;/p&gt;
357     &lt;/body&gt;
358     &lt;/html&gt;</span></pre>
359    
360     <p class="has-ja-translation" data-ja-hash="4cc7e781e44db82f8bd32020954bb94a"><span class=en-original lang=en>The two workers use a common library for performing the actual
361     network calls. This library is as follows:</span><span class=ja-translation lang=ja>両労働者は実際のネットワークの呼び出しを行う共通のライブラリーを使います。
362     このライブラリーは次の通りです。</span></p>
363    
364     <pre class="no-ja-translation" data-ja-hash="764d750a19834bf904d276466724339c"><span class=en-original lang=en>function get(url) {
365     try {
366     var xhr = new XMLHttpRequest();
367     xhr.open('GET', url, false);
368     xhr.send();
369     return xhr.responseText;
370     } catch (e) {
371     return ''; // turn all errors into empty results
372     }
373     }</span></pre>
374    
375     <p class="has-ja-translation" data-ja-hash="ee10423864c33d68e8676bf88cb75046"><span class=en-original lang=en>The stock updater worker is as follows:</span><span class=ja-translation lang=ja>株価更新者の労働者は次の通りです。</span></p>
376    
377     <pre class="no-ja-translation" data-ja-hash="66ef47eaf421ea8066871b71807859be"><span class=en-original lang=en>importScripts('io.js');
378     var timer;
379     var symbol;
380     function update() {
381     postMessage(symbol + ' ' + get('stock.cgi?' + symbol));
382     timer = setTimeout(update, 10000);
383     }
384     onmessage = function (event) {
385     if (timer)
386     clearTimeout(timer);
387     symbol = event.data;
388     update();
389     };</span></pre>
390    
391     <p class="has-ja-translation" data-ja-hash="aa6a78ceb7b91cdf90925cc36c6c6676"><span class=en-original lang=en>The search query worker is as follows:</span><span class=ja-translation lang=ja>検索の照会の労働者は次の通りです。</span></p>
392    
393     <pre class="no-ja-translation" data-ja-hash="ac0353e2a69ae5ffdc861cca404ef9f0"><span class=en-original lang=en>importScripts('io.js');
394     onmessage = function (event) {
395     postMessage(get('search.cgi?' + event.data));
396     };</span></pre>
397    
398     <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="5855651f68b535b77cb2b82bed593472"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</span><span class=ja-translation lang=ja><a href=http://www.whatwg.org/demos/workers/stocks/page.html>この例をオンラインで表示する</a>。</span></p>
399    
400    
401 wakaba 1.226 <h4 id=shared-workers-introduction class="no-ja-translation" data-ja-hash="700b028f2289b6b7d8c11189dae61afe"><span class=en-original lang=en><span class=secno>1.2.4 </span>Shared workers introduction</span></h4>
402    
403     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
404    
405     <p class="no-ja-translation" data-ja-hash="fe33191c4ce45f6e6ad2d98a6b08bd83"><span class=en-original lang=en>This section introduces shared workers using a Hello World
406     example. Shared workers use slightly different APIs, since each
407     worker can have multiple connections.</span></p>
408    
409     <p class="no-ja-translation" data-ja-hash="a012a7d5146a1567066f4fe863348990"><span class=en-original lang=en>This first example shows how you connect to a worker and how a
410     worker can send a message back to the page when it connects to
411     it. Received messages are displayed in a log.</span></p>
412    
413     <p class="no-ja-translation" data-ja-hash="c030b679deac77d7bf7008f06f9e8ca2"><span class=en-original lang=en>Here is the HTML page:</span></p>
414    
415 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="3bec6db40f3563ae5c40e1eecebf3241"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
416     &lt;title&gt;Shared workers: demo 1&lt;/title&gt;
417     &lt;pre id="log"&gt;Log:&lt;/pre&gt;
418     &lt;script&gt;
419     var worker = new SharedWorker('test.js');
420     var log = document.getElementById('log');
421     worker.port.onmessage = function(e) { // note: not worker.onmessage!
422     log.textContent += '\n' + e.data;
423     }
424     &lt;/script&gt;
425     </span></pre>
426 wakaba 1.226
427     <p class="no-ja-translation" data-ja-hash="8b0dff1d002da7a3abf7ab1debd6818a"><span class=en-original lang=en>Here is the JavaScript worker:</span></p>
428    
429 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="c37a5dbe5b978ce89dada90dacd1d74e"><span class=en-original lang=en>onconnect = function(e) {
430     var port = e.ports[0];
431     port.postMessage('Hello World!');
432     }
433     </span></pre>
434 wakaba 1.226
435 wakaba 1.227 <hr><p class="no-ja-translation" data-ja-hash="0c698bc83099c359dc8825a491060db0"><span class=en-original lang=en>This second example extends the first one by changing two things:
436 wakaba 1.226 first, messages are received using <code title="">addEventListener()</code> instead of an <span title="event
437     handler IDL attributes">event handler IDL attribute</span>, and
438     second, a message is sent <em>to</em> the worker, causing the worker
439     to send another message in return. Received messages are again
440 wakaba 1.227 displayed in a log.</span></p>
441 wakaba 1.226
442     <p class="no-ja-translation" data-ja-hash="c030b679deac77d7bf7008f06f9e8ca2"><span class=en-original lang=en>Here is the HTML page:</span></p>
443    
444 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="5e7134bc131914a2be4441715a631dbc"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
445     &lt;title&gt;Shared workers: demo 2&lt;/title&gt;
446     &lt;pre id="log"&gt;Log:&lt;/pre&gt;
447     &lt;script&gt;
448     var worker = new SharedWorker('test.js');
449     var log = document.getElementById('log');
450     worker.port.addEventListener('message', function(e) {
451     log.textContent += '\n' + e.data;
452     }, false);
453     worker.port.start(); // note: need this when using addEventListener
454     worker.port.postMessage('ping');
455     &lt;/script&gt;
456     </span></pre>
457 wakaba 1.226
458     <p class="no-ja-translation" data-ja-hash="8b0dff1d002da7a3abf7ab1debd6818a"><span class=en-original lang=en>Here is the JavaScript worker:</span></p>
459    
460 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="9c28019918d8ea8e86fb6e01f3bf9125"><span class=en-original lang=en>onconnect = function(e) {
461     var port = e.ports[0];
462     port.postMessage('Hello World!');
463     port.onmessage = function(e) {
464     port.postMessage('pong'); // not e.ports[0].postMessage!
465     // e.target.postMessage('pong'); would work also
466     }
467     }
468     </span></pre>
469 wakaba 1.226
470     <hr><p class="no-ja-translation" data-ja-hash="2684671fd0b835f0d9c0149789eed261"><span class=en-original lang=en>Finally, the example is extended to show how two pages can
471     connect to the same worker; in this case, the second page is merely
472     in an <code>iframe</code> on the first page, but the same principle
473     would apply to an entirely separate page in a separate
474     <span>top-level browsing context</span>.</span></p>
475    
476     <p class="no-ja-translation" data-ja-hash="2c8c8f6817571a72eb4d15c8cf34d49e"><span class=en-original lang=en>Here is the outer HTML page:</span></p>
477    
478 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="9160283c3f208b8e3c423a3f834050c7"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
479     &lt;title&gt;Shared workers: demo 3&lt;/title&gt;
480     &lt;pre id="log"&gt;Log:&lt;/pre&gt;
481     &lt;script&gt;
482     var worker = new SharedWorker('test.js');
483     var log = document.getElementById('log');
484     worker.port.addEventListener('message', function(e) {
485     log.textContent += '\n' + e.data;
486     }, false);
487     worker.port.start();
488     worker.port.postMessage('ping');
489     &lt;/script&gt;
490     &lt;iframe src="inner.html"&gt;&lt;/iframe&gt;
491     </span></pre>
492 wakaba 1.226
493     <p class="no-ja-translation" data-ja-hash="4302e9ad00558362ab66a3c40d12019f"><span class=en-original lang=en>Here is the inner HTML page:</span></p>
494    
495 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="f1f8ec4ece881c7a3a8f4d0833b13be1"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
496     &lt;title&gt;Shared workers: demo 3 inner frame&lt;/title&gt;
497     &lt;pre id=log&gt;Inner log:&lt;/pre&gt;
498     &lt;script&gt;
499     var worker = new SharedWorker('test.js');
500     var log = document.getElementById('log');
501     worker.port.onmessage = function(e) {
502     log.textContent += '\n' + e.data;
503     }
504     &lt;/script&gt;
505     </span></pre>
506 wakaba 1.226
507     <p class="no-ja-translation" data-ja-hash="8b0dff1d002da7a3abf7ab1debd6818a"><span class=en-original lang=en>Here is the JavaScript worker:</span></p>
508    
509 wakaba 1.227 <pre class="no-ja-translation" data-ja-hash="cb4f9cdfa6073324e271650b85b536b5"><span class=en-original lang=en>var count = 0;
510     onconnect = function(e) {
511     count += 1;
512     var port = e.ports[0];
513     port.postMessage('Hello World! You are connection #' + count);
514     port.onmessage = function(e) {
515     port.postMessage('pong');
516     }
517     }
518     </span></pre>
519 wakaba 1.226
520    
521     <h4 id=shared-state-using-a-shared-worker class="no-ja-translation" data-ja-hash="bf2125b36f038a1bca5c6b664679cbcb"><span class=en-original lang=en><span class=secno>1.2.5 </span>Shared state using a shared worker</span></h4>
522 wakaba 1.219
523     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
524    
525     <p class="no-ja-translation" data-ja-hash="2ec2b66f1e8130c8e0552d348a633841"><span class=en-original lang=en>In this example, multiple windows (viewers) can be opened that
526     are all viewing the same map. All the windows share the same map
527     information, with a single worker coordinating all the viewers. Each
528     viewer can move around independently, but if they set any data on
529     the map, all the viewers are updated.</span></p>
530    
531     <p class="has-ja-translation" data-ja-hash="2bf6969d7d27e56c707ae9970fdd476f"><span class=en-original lang=en>The main page isn't interesting, it merely provides a way to open
532     the viewers:</span><span class=ja-translation lang=ja>主たる頁は特に何もなく、単に表示器を開くためだけのものです。</span></p>
533    
534     <pre class="no-ja-translation" data-ja-hash="e27ef9096d7661be60af654b55813524"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
535     &lt;html&gt;
536     &lt;head&gt;
537     &lt;title&gt;Workers example: Multiviewer&lt;/title&gt;
538     &lt;script&gt;
539     function openViewer() {
540     window.open('viewer.html');
541     }
542     &lt;/script&gt;
543     &lt;/head&gt;
544     &lt;body&gt;
545     &lt;p&gt;&lt;button type=button onclick="openViewer()"&gt;Open a new
546     viewer&lt;/button&gt;&lt;/p&gt;
547     &lt;p&gt;Each viewer opens in a new window. You can have as many viewers
548     as you like, they all view the same data.&lt;/p&gt;
549     &lt;/body&gt;
550     &lt;/html&gt;</span></pre>
551    
552     <p class="has-ja-translation" data-ja-hash="cee02afe1e87e7182f5219ccf54757ca"><span class=en-original lang=en>The viewer is more involved:</span><span class=ja-translation lang=ja>表示器はもっと色々しています。</span></p>
553    
554     <pre class="no-ja-translation" data-ja-hash="96676bde8a2e10817b7d76a726dc26f9"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
555     &lt;html&gt;
556     &lt;head&gt;
557     &lt;title&gt;Workers example: Multiviewer viewer&lt;/title&gt;
558     &lt;script&gt;
559     var worker = new SharedWorker('worker.js', 'core');
560    
561     // CONFIGURATION
562     function configure(event) {
563     if (event.data.substr(0, 4) != 'cfg ') return;
564     var name = event.data.substr(4).split(' ', 1);
565     // update display to mention our name is name
566     document.getElementsByTagName('h1')[0].textContent += ' ' + name;
567     // no longer need this listener
568     worker.port.removeEventListener('message', configure, false);
569     }
570     worker.port.addEventListener('message', configure, false);
571    
572     // MAP
573     function paintMap(event) {
574     if (event.data.substr(0, 4) != 'map ') return;
575     var data = event.data.substr(4).split(',');
576     // display tiles data[0] .. data[8]
577     var canvas = document.getElementById('map');
578     var context = canvas.getContext('2d');
579     for (var y = 0; y &lt; 3; y += 1) {
580     for (var x = 0; x &lt; 3; x += 1) {
581     var tile = data[y * 3 + x];
582     if (tile == '0')
583     context.fillStyle = 'green';
584     else
585     context.fillStyle = 'maroon';
586     fillRect(x * 50, y * 50, 50, 50);
587     }
588     }
589     }
590     worker.port.addEventListener('message', paintMap, false);
591    
592     // PUBLIC CHAT
593     function updatePublicChat(event) {
594     if (event.data.substr(0, 4) != 'txt ') return;
595     var name = event.data.substr(4).split(' ', 1);
596     var message = event.data.substr(4 + length(name) + 1);
597     // display "&lt;name&gt; message" in public chat
598     var dialog = document.getElementById('public');
599     var dt = document.createElement('dt');
600     dt.textContent = name;
601     dialog.appendChild(dt);
602     var dd = document.createElement('dd');
603     dd.textContent = message;
604     dialog.appendChild(dd);
605     }
606     worker.port.addEventListener('message', updatePublicChat, false);
607    
608     // PRIVATE CHAT
609     function startPrivateChat(event) {
610     if (event.data.substr(0, 4) != 'msg ') return;
611     var name = event.data.substr(4).split(' ', 1);
612     var port = event.ports[0];
613     // display a private chat UI
614     var ul = document.getElementById('private');
615     var li = document.createElement('li');
616     var h3 = document.createElement('h3');
617     h3.textContent = 'Private chat with ' + name;
618     li.appendChild(h3);
619     var dialog = document.createElement('dialog');
620     var addMessage = function(name, message) {
621     var dt = document.createElement('dt');
622     dt.textContent = name;
623     dialog.appendChild(dt);
624     var dd = document.createElement('dd');
625     dd.textContent = message;
626     dialog.appendChild(dd);
627     };
628     port.onmessage = function (event) {
629     addMessage(name, event.data);
630     };
631     li.appendChild(dialog);
632     var form = document.createElement('form');
633     var p = document.createElement('p');
634     var input = document.createElement('input');
635     input.size = 50;
636     p.appendChild(input);
637     p.appendChild(document.createTextNode(' '));
638     var button = document.createElement('button');
639     button.textContent = 'Post';
640     p.appendChild(button);
641     form.onsubmit = function () {
642     port.postMessage(input.value);
643     addMessage('me', input.value);
644     input.value = '';
645     return false;
646     };
647     form.appendChild(p);
648     li.appendChild(form);
649     }
650     worker.port.addEventListener('message', startPrivateChat, false);
651    
652     worker.port.start();
653     &lt;/script&gt;
654     &lt;/head&gt;
655     &lt;body&gt;
656     &lt;h1&gt;Viewer&lt;/h1&gt;
657     &lt;h2&gt;Map&lt;/h2&gt;
658     &lt;p&gt;&lt;canvas id="map" height=150 width=150&gt;&lt;/canvas&gt;&lt;/p&gt;
659     &lt;p&gt;
660     &lt;button type=button onclick="worker.port.postMessage('mov left')"&gt;Left&lt;/button&gt;
661     &lt;button type=button onclick="worker.port.postMessage('mov up')"&gt;Up&lt;/button&gt;
662     &lt;button type=button onclick="worker.port.postMessage('mov down')"&gt;Down&lt;/button&gt;
663     &lt;button type=button onclick="worker.port.postMessage('mov right')"&gt;Right&lt;/button&gt;
664     &lt;button type=button onclick="worker.port.postMessage('set 0')"&gt;Set 0&lt;/button&gt;
665     &lt;button type=button onclick="worker.port.postMessage('set 1')"&gt;Set 1&lt;/button&gt;
666     &lt;/p&gt;
667     &lt;h2&gt;Public Chat&lt;/h2&gt;
668     &lt;dialog id="public"&gt;&lt;/dialog&gt;
669     &lt;form onsubmit="worker.port.postMessage('txt ' + message.value); message.value = ''; return false;"&gt;
670     &lt;p&gt;
671     &lt;input type="text" name="message" size="50"&gt;
672     &lt;button&gt;Post&lt;/button&gt;
673     &lt;/p&gt;
674     &lt;/form&gt;
675     &lt;h2&gt;Private Chat&lt;/h2&gt;
676     &lt;ul id="private"&gt;&lt;/ul&gt;
677     &lt;/body&gt;
678     &lt;/html&gt;
679     </span></pre>
680    
681     <p class="has-ja-translation" data-ja-hash="397850dab731150b72d5f0276dab0081"><span class=en-original lang=en>There are several key things worth noting about the way the
682     viewer is written.</span><span class=ja-translation lang=ja>表示器の書き方についていくつか注意したい重要な点があります。</span></p>
683    
684     <p class="has-ja-translation" data-ja-hash="8bc9c1f9e0e102128838ea8c31c51306"><span class=en-original lang=en><strong>Multiple listeners</strong>. Instead of a single message
685     processing function, the code here attaches multiple event
686     listeners, each one performing a quick check to see if it is
687     relevant for the message. In this example it doesn't make much
688     difference, but if multiple authors wanted to collaborate using a
689     single port to communicate with a worker, it would allow for
690     independent code instead of changes having to all be made to a
691     single event handling function.</span><span class=ja-translation lang=ja><strong>複数の聴取器</strong>。この符号では、メッセージ処理関数を1つ用意する代わりに、
692     複数の事象聴取器を付与し、それぞれが、それがメッセージに関連するかどうかを見るためにさらりと検査を行っています。
693     この例では大きな違いにはなりませんが、複数の著者が労働者と通信するために1つのポートを使って協調したい場合には、
694     独立した符号にできるので変更がある度に1つの事象取扱関数をいじらざるを得なくて済みます。</span></p>
695    
696     <p class="no-ja-translation" data-ja-hash="ce2f17c1c25589a0d4507c6fa9c1f532"><span class=en-original lang=en>Registering event listeners in this way also allows you to
697     unregister specific listeners when you are done with them, as is
698     done with the <code title="">configure()</code> method in this
699     example.</span></p>
700    
701     <p class="has-ja-translation" data-ja-hash="4eb1fa2095f65662225da4c52db274f1"><span class=en-original lang=en>Finally, the worker:</span><span class=ja-translation lang=ja>最後に、労働者は次のようになります。</span></p>
702    
703     <pre class="no-ja-translation" data-ja-hash="2a6833ffcfe9252a21a8582ad69a4adf"><span class=en-original lang=en>
704     var nextName = 0;
705     function getNextName() {
706     // this could use more friendly names
707     // but for now just return a number
708     return nextName++;
709     }
710    
711     var map = [
712     [0, 0, 0, 0, 0, 0, 0],
713     [1, 1, 0, 1, 0, 1, 1],
714     [0, 1, 0, 1, 0, 0, 0],
715     [0, 1, 0, 1, 0, 1, 1],
716     [0, 0, 0, 1, 0, 0, 0],
717     [1, 0, 0, 1, 1, 1, 1],
718     [1, 1, 0, 1, 1, 0, 1],
719     ];
720    
721     function wrapX(x) {
722     if (x &lt; 0) return wrapX(x + map[0].length);
723     if (x &gt;= map[0].length) return wrapX(x - map[0].length);
724     return x;
725     }
726    
727     function wrapY(y) {
728     if (y &lt; 0) return wrapY(y + map.length);
729     if (y &gt;= map[0].length) return wrapY(y - map.length);
730     return y;
731     }
732    
733     function sendMapData(callback) {
734     var data = '';
735     for (var y = viewer.y-1; y &lt;= viewer.y+1; y += 1) {
736     for (var x = viewer.x-1; x &lt;= viewer.x+1; x += 1) {
737     if (data != '')
738     data += ',';
739     data += map[y][x];
740     }
741     }
742     callback('map ' + data);
743     }
744    
745     var viewers = {};
746     onconnect = function (event) {
747     event.ports[0]._name = getNextName();
748     event.ports[0]._data = { port: event.port, x: 0, y: 0, };
749     viewers[event.ports[0]._name] = event.port._data;
750     event.ports[0].postMessage('cfg ' + name);
751     event.ports[0].onmessage = getMessage;
752     sendMapData(event.ports[0].postMessage);
753     };
754    
755     function getMessage(event) {
756     switch (event.data.substr(0, 4)) {
757     case 'mov ':
758     var direction = event.data.substr(4);
759     var dx = 0;
760     var dy = 0;
761     switch (direction) {
762     case 'up': dy = -1; break;
763     case 'down': dy = 1; break;
764     case 'left': dx = -1; break;
765     case 'right': dx = 1; break;
766     }
767     event.target._data.x = wrapX(event.target._data.x + dx);
768     event.target._data.y = wrapY(event.target._data.y + dy);
769     sendMapData(event.target.postMessage);
770     break;
771     case 'set ':
772     var value = event.data.substr(4);
773     map[event.target._data.y][event.target._data.x] = value;
774     for (var viewer in viewers)
775     sendMapData(viewers[viewer].port.postMessage);
776     break;
777     case 'txt ':
778     var name = event.target._name;
779     var message = event.data.substr(4);
780     for (var viewer in viewers)
781     viewers[viewer].port.postMessage('txt ' + name + ' ' + message);
782     break;
783     case 'msg ':
784     var party1 = event._data;
785     var party2 = viewers[event.data.substr(4).split(' ', 1)];
786     if (party2) {
787     var channel = new MessageChannel();
788     party1.port.postMessage('msg ' + party2.name, [channel.port1]);
789     party2.port.postMessage('msg ' + party1.name, [channel.port2]);
790     }
791     break;
792     }
793     }</span></pre>
794    
795     <p class="no-ja-translation" data-ja-hash="80f59a8dae1df6b25c537e5041683f5d"><span class=en-original lang=en><strong>Connecting to multiple pages</strong>. The script uses
796     the <code title=handler-SharedWorkerGlobalScope-onconnect><a href=#handler-sharedworkerglobalscope-onconnect>onconnect</a></code>
797     event listener to listen for multiple connections.</span></p>
798    
799     <p class="has-ja-translation" data-ja-hash="5ce666b6338718b46fb0dee22dbea88c"><span class=en-original lang=en><strong>Direct channels</strong>. When the worker receives a
800     "msg" message from one viewer naming another viewer, it sets up a
801     direct connection between the two, so that the two viewers can
802     communicate directly without the worker having to proxy all the
803     messages.</span><span class=ja-translation lang=ja><strong>直接通信路</strong>。労働者がある閲覧器から他の閲覧器を名指した「msg」メッセージを受信した時は、
804     両者間の直接の接続を設定し、労働者がすべてのメッセージを仲介せずとも両閲覧器が直接通信できるようにします。</span></p>
805    
806     <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="8d892cfe0423f9a15e275e47c6b45600"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</span><span class=ja-translation lang=ja><a href=http://www.whatwg.org/demos/workers/multiviewer/page.html>この例をオンラインで表示する</a>。</span></p>
807    
808    
809 wakaba 1.226 <h4 id=delegation class="has-ja-translation" data-ja-hash="57b11d3816e9f83adb4dd2ecb2a311b5"><span class=en-original lang=en><span class=secno>1.2.6 </span>Delegation</span><span class=ja-translation lang=ja><span class=secno>1.2.6 </span>委譲</span></h4>
810 wakaba 1.219
811     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
812    
813     <p class="no-ja-translation" data-ja-hash="318b797bf0c9a2cdaa476f36993911b4"><span class=en-original lang=en>With multicore CPUs becoming prevalent, one way to obtain better
814     performance is to split computationally expensive tasks amongst
815     multiple workers. In this example, a computationally expensive task
816     that is to be performed for every number from 1 to 10,000,000 is
817     farmed out to ten subworkers.</span></p>
818    
819     <p class="has-ja-translation" data-ja-hash="c5074121435848ef6ad420f030cb5060"><span class=en-original lang=en>The main page is as follows, it just reports the result:</span><span class=ja-translation lang=ja>主たる頁は次の通りで、単に結果を報告するだけです。</span></p>
820    
821     <pre class="no-ja-translation" data-ja-hash="b3d5b7301a62f1c4679a2bc6353b3369"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
822     &lt;html&gt;
823     &lt;head&gt;
824     &lt;title&gt;Worker example: Multicore computation&lt;/title&gt;
825     &lt;/head&gt;
826     &lt;body&gt;
827     &lt;p&gt;Result: &lt;output id="result"&gt;&lt;/output&gt;&lt;/p&gt;
828     &lt;script&gt;
829     var worker = new Worker('worker.js');
830     worker.onmessage = function (event) {
831     document.getElementById('result').textContent = event.data;
832     };
833     &lt;/script&gt;
834     &lt;/body&gt;
835     &lt;/html&gt;</span></pre>
836    
837     <p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:</span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span></p>
838    
839     <pre class="no-ja-translation" data-ja-hash="c2f14df3c3648ecb143c9e271b6721df"><span class=en-original lang=en>// settings
840     var num_workers = 10;
841     var items_per_worker = 1000000;
842    
843     // start the workers
844     var result = 0;
845     var pending_workers = num_workers;
846     for (var i = 0; i &lt; num_workers; i += 1) {
847     var worker = new Worker('core.js');
848     worker.postMessage(i * items_per_worker);
849     worker.postMessage((i+1) * items_per_worker);
850     worker.onmessage = storeResult;
851     }
852    
853     // handle the results
854     function storeResult(event) {
855     result += 1*event.data;
856     pending_workers -= 1;
857     if (pending_workers &lt;= 0)
858     postMessage(result); // finished!
859     }</span></pre>
860    
861     <p class="has-ja-translation" data-ja-hash="f9236b42d2a99d988b848353511797fc"><span class=en-original lang=en>It consists of a loop to start the subworkers, and then a handler
862     that waits for all the subworkers to respond.</span><span class=ja-translation lang=ja>これは部分労働者を開始するループと、
863     すべての部分労働者が応答するのを待つ取扱器から成っています。</span></p>
864    
865     <p class="has-ja-translation" data-ja-hash="53f3483f6fffa25f7c6963e58d683f43"><span class=en-original lang=en>The subworkers are implemented as follows:</span><span class=ja-translation lang=ja>部分労働者は次のように実装します。</span></p>
866    
867     <pre class="no-ja-translation" data-ja-hash="90fc569c1c634a87b725ebbe4cc1e2f4"><span class=en-original lang=en>var start;
868     onmessage = getStart;
869     function getStart(event) {
870     start = 1*event.data;
871     onmessage = getEnd;
872     }
873    
874     var end;
875     function getEnd(event) {
876     end = 1*event.data;
877     onmessage = null;
878     work();
879     }
880    
881     function work() {
882     var result = 0;
883     for (var i = start; i &lt; end; i += 1) {
884     // perform some complex calculation here
885     result += 1;
886     }
887     postMessage(result);
888     close();
889     }</span></pre>
890    
891     <p class="has-ja-translation" data-ja-hash="fbf1b083b03c85854a8e892ef8add172"><span class=en-original lang=en>They receive two numbers in two events, perform the computation
892     for the range of numbers thus specified, and then report the result
893     back to the parent.</span><span class=ja-translation lang=ja>部分労働者は2つの事象で2つの数を受信し、指定された数の範囲の計算を行った後、
894     結果を親に報告します。
895     </span></p>
896    
897     <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="4318fb9a581a7c14e58bfb2d61809f0c"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/multicore/page.html>View this example online</a>.</span><span class=ja-translation lang=ja><a href=http://www.whatwg.org/demos/workers/multicore/page.html>この例をオンラインで表示する</a>。</span></p>
898    
899    
900 wakaba 1.226 <h4 id=providing-libraries class="has-ja-translation" data-ja-hash="6c37218e175bff77f69bd84b1ab5da58"><span class=en-original lang=en><span class=secno>1.2.7 </span>Providing libraries</span><span class=ja-translation lang=ja><span class=secno>1.2.7 </span>ライブラリーの提供</span></h4>
901 wakaba 1.219
902     <p class="no-ja-translation" data-ja-hash="2b52ab89148ac538f9c9380fc5da5b2f"><span class=en-original lang=en><i>This section is non-normative.</i></span></p>
903    
904     <p class="no-ja-translation" data-ja-hash="12371907fb7e8389f76fabaf7a5f8303"><span class=en-original lang=en>Suppose that a cryptography library is made available that
905     provides three tasks:</span></p>
906    
907     <dl><dt class="has-ja-translation" data-ja-hash="6ea027035e660e254aba77f4bd9cb6e7"><span class=en-original lang=en>Generate a public/private key pair</span><span class=ja-translation lang=ja>公開鍵・秘密鍵の組の生成</span></dt>
908    
909     <dd class="no-ja-translation" data-ja-hash="cf9020803baa896d8a183fe324563704"><span class=en-original lang=en>Takes a port, on which it will send two messages, first the
910     public key and then the private key.</span></dd>
911    
912     <dt class="no-ja-translation" data-ja-hash="fb7dd035a8141087578088ce61f9db22"><span class=en-original lang=en>Given a plaintext and a public key, return the corresponding cyphertext</span></dt>
913    
914     <dd class="no-ja-translation" data-ja-hash="1d31efc883e22a218f807161c65291f0"><span class=en-original lang=en>Takes a port, to which any number of messages can be sent, the
915     first giving the public key, and the remainder giving the
916     plaintext, each of which is encrypted and then sent on that same
917     channel as the cyphertext. The user can close the port when it is
918     done encrypting content.</span></dd>
919    
920     <dt class="no-ja-translation" data-ja-hash="11ea02c6f203744166e5a89e81a81337"><span class=en-original lang=en>Given a cyphertext and a private key, return the corresponding plaintext</span></dt>
921    
922     <dd class="no-ja-translation" data-ja-hash="c157fe0e540c248dc1db29edbd80ff82"><span class=en-original lang=en>Takes a port, to which any number of messages can be sent, the
923     first giving the private key, and the remainder giving the
924     cyphertext, each of which is decrypted and then sent on that same
925     channel as the plaintext. The user can close the port when it is
926     done decrypting content.</span></dd>
927    
928     </dl><p class="has-ja-translation" data-ja-hash="0e39ac88e71e60206c341926e3785dcd"><span class=en-original lang=en>The library itself is as follows:</span><span class=ja-translation lang=ja>ライブラリー自体は次のようになります。</span></p>
929    
930     <pre class="no-ja-translation" data-ja-hash="9ead219adc5a1168e3a3bcba20c329b0"><span class=en-original lang=en>function handleMessage(e) {
931     if (e.data == "genkeys")
932     genkeys(e.ports[0]);
933     else if (e.data == "encrypt")
934     encrypt(e.ports[0]);
935     else if (e.data == "decrypt")
936     decrypt(e.ports[0]);
937     }
938    
939     function genkeys(p) {
940     var keys = _generateKeyPair();
941     p.postMessage(keys[0]);
942     p.postMessage(keys[1]);
943     }
944    
945     function encrypt(p) {
946     var key, state = 0;
947     p.onmessage = function (e) {
948     if (state == 0) {
949     key = e.data;
950     state = 1;
951     } else {
952     p.postMessage(_encrypt(key, e.data));
953     }
954     };
955     }
956    
957     function decrypt(p) {
958     var key, state = 0;
959     p.onmessage = function (e) {
960     if (state == 0) {
961     key = e.data;
962     state = 1;
963     } else {
964     p.postMessage(_decrypt(key, e.data));
965     }
966     };
967     }
968    
969     // support being used as a shared worker as well as a dedicated worker
970     if ('onmessage' in this) // dedicated worker
971     onmessage = handleMessage;
972     else // shared worker
973     onconnect = function (e) { e.port.onmessage = handleMessage; }
974    
975    
976     // the "crypto" functions:
977    
978     function _generateKeyPair() {
979     return [Math.random(), Math.random()];
980     }
981    
982     function _encrypt(k, s) {
983     return 'encrypted-' + k + ' ' + s;
984     }
985    
986     function _decrypt(k, s) {
987     return s.substr(s.indexOf(' ')+1);
988     }</span></pre>
989    
990     <p class="no-ja-translation" data-ja-hash="e6e3003b829ed060f5926d1763f29c2e"><span class=en-original lang=en>Note that the crypto functions here are just stubs and don't do
991     real cryptography.</span></p>
992    
993     <p class="has-ja-translation" data-ja-hash="76f1d5866d92bc1036d1198cf4eda428"><span class=en-original lang=en>This library could be used as follows:</span><span class=ja-translation lang=ja>このライブラリーは次のように使うことができます。</span></p>
994    
995     <pre class="no-ja-translation" data-ja-hash="e88a411ca9b20f088116732dc0db6171"><span class=en-original lang=en>&lt;!DOCTYPE HTML&gt;
996     &lt;html&gt;
997     &lt;head&gt;
998     &lt;title&gt;Worker example: Crypto library&lt;/title&gt;
999     &lt;script&gt;
1000     var crytoLib = new Worker('libcrypto-v1.js'); // or could use 'libcrypto-v2.js'
1001     function getKeys() {
1002     var state = 0;
1003     cryptoLib.startConversation("genkeys").onmessage = function (e) {
1004     if (state == 0)
1005     document.getElementById('public').value = e.data;
1006     else if (state == 1)
1007     document.getElementById('private').value = e.data;
1008     state += 1;
1009     };
1010     }
1011     function enc() {
1012     var port = cryptoLib.startConversation("encrypt");
1013     port.postMessage(document.getElementById('public').value);
1014     port.postMessage(document.getElementById('input').value);
1015     port.onmessage = function (e) {
1016     document.getElementById('input').value = e.data;
1017     port.close();
1018     };
1019     }
1020     function dec() {
1021     var port = cryptoLib.startConversation("decrypt");
1022     port.postMessage(document.getElementById('private').value);
1023     port.postMessage(document.getElementById('input').value);
1024     port.onmessage = function (e) {
1025     document.getElementById('input').value = e.data;
1026     port.close();
1027     };
1028     }
1029     &lt;/script&gt;
1030     &lt;style&gt;
1031     textarea { display: block; }
1032     &lt;/style&gt;
1033     &lt;/head&gt;
1034     &lt;body onload="getKeys()"&gt;
1035     &lt;fieldset&gt;
1036     &lt;legend&gt;Keys&lt;/legend&gt;
1037     &lt;p&gt;&lt;label&gt;Public Key: &lt;textarea id="public"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
1038     &lt;p&gt;&lt;label&gt;Private Key: &lt;textarea id="private"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
1039     &lt;/fieldset&gt;
1040     &lt;p&gt;&lt;label&gt;Input: &lt;textarea id="input"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/p&gt;
1041     &lt;p&gt;&lt;button onclick="enc()"&gt;Encrypt&lt;/button&gt; &lt;button onclick="dec()"&gt;Decrypt&lt;/button&gt;&lt;/p&gt;
1042     &lt;/body&gt;
1043     &lt;/html&gt;</span></pre>
1044    
1045     <p class="no-ja-translation" data-ja-hash="13181de825fa0e152c5a954e55715a15"><span class=en-original lang=en>A later version of the API, though, might want to offload all the
1046     crypto work onto subworkers. This could be done as follows:</span></p>
1047    
1048     <pre class="no-ja-translation" data-ja-hash="44541f0b3332c661f1465eaa011c42ad"><span class=en-original lang=en>function handleMessage(e) {
1049     if (e.data == "genkeys")
1050     genkeys(e.ports[0]);
1051     else if (e.data == "encrypt")
1052     encrypt(e.ports[0]);
1053     else if (e.data == "decrypt")
1054     decrypt(e.ports[0]);
1055     }
1056    
1057     function genkeys(p) {
1058     var generator = new Worker('libcrypto-v2-generator.js');
1059     generator.postMessage('', [p]);
1060     }
1061    
1062     function encrypt(p) {
1063     p.onmessage = function (e) {
1064     var key = e.data;
1065     var encryptor = new Worker('libcrypto-v2-encryptor.js');
1066     encryptor.postMessage(key, [p]);
1067     };
1068     }
1069    
1070     function encrypt(p) {
1071     p.onmessage = function (e) {
1072     var key = e.data;
1073     var decryptor = new Worker('libcrypto-v2-decryptor.js');
1074     decryptor.postMessage(key, [p]);
1075     };
1076     }
1077    
1078     // support being used as a shared worker as well as a dedicated worker
1079     if ('onmessage' in this) // dedicated worker
1080     onmessage = handleMessage;
1081     else // shared worker
1082     onconnect = function (e) { e.ports[0].onmessage = handleMessage };
1083     </span></pre>
1084    
1085     <p class="has-ja-translation" data-ja-hash="fc1d14c413a94a9015153067739845e7"><span class=en-original lang=en>The little subworkers would then be as follows.</span><span class=ja-translation lang=ja>小部分労働者は次の通りです。</span></p>
1086    
1087     <p class="has-ja-translation" data-ja-hash="66f9c4d246b0081919ced7e46c4a9db2"><span class=en-original lang=en>For generating key pairs:</span><span class=ja-translation lang=ja>鍵組の生成用:</span></p>
1088    
1089     <pre class="no-ja-translation" data-ja-hash="7fcbde64ee437c101414bcc98d9e1ee0"><span class=en-original lang=en>onmessage = function (e) {
1090     var k = _generateKeyPair();
1091     e.ports[0].postMessage(k[0]);
1092     e.ports[0].postMessage(k[1]);
1093     close();
1094     }
1095    
1096     function _generateKeyPair() {
1097     return [Math.random(), Math.random()];
1098     }</span></pre>
1099    
1100     <p class="has-ja-translation" data-ja-hash="1f07f24df05f20de47483db4dfde2017"><span class=en-original lang=en>For encrypting:</span><span class=ja-translation lang=ja>暗号化用:</span></p>
1101    
1102     <pre class="no-ja-translation" data-ja-hash="94aaf906f90e9b3539c4219ef2be60cf"><span class=en-original lang=en>onmessage = function (e) {
1103     var key = e.data;
1104     e.ports[0].onmessage = function (e) {
1105     var s = e.data;
1106     postMessage(_encrypt(key, s));
1107     }
1108     }
1109    
1110     function _encrypt(k, s) {
1111     return 'encrypted-' + k + ' ' + s;
1112     }</span></pre>
1113    
1114     <p class="has-ja-translation" data-ja-hash="abf884f40593747f458e7d7400b1eb21"><span class=en-original lang=en>For decrypting:</span><span class=ja-translation lang=ja>解読用:</span></p>
1115    
1116     <pre class="no-ja-translation" data-ja-hash="c91e2f3055da293b534ac3c10648b23e"><span class=en-original lang=en>onmessage = function (e) {
1117     var key = e.data;
1118     e.ports[0].onmessage = function (e) {
1119     var s = e.data;
1120     postMessage(_decrypt(key, s));
1121     }
1122     }
1123    
1124     function _decrypt(k, s) {
1125     return s.substr(s.indexOf(' ')+1);
1126     }</span></pre>
1127    
1128     <p class="no-ja-translation" data-ja-hash="c8da0ee0afd0a36dc51fa6bebbb8a3e9"><span class=en-original lang=en>Notice how the users of the API don't have to even know that this
1129     is happening &mdash; the API hasn't changed; the library can
1130     delegate to subworkers without changing its API, even though it is
1131     accepting data using message channels.</span></p>
1132    
1133     <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="22a665d401474bea0ab24f5873ba4d61"><span class=en-original lang=en><a href=http://www.whatwg.org/demos/workers/crypto/page.html>View this example online</a>.</span><span class=ja-translation lang=ja><a href=http://www.whatwg.org/demos/workers/crypto/page.html>この例をオンラインで表示する</a>。</span></p>
1134    
1135    
1136    
1137    
1138     <h2 id=conformance-requirements class="has-ja-translation" data-ja-hash="05644f41fb2fbf61aaab52464b2edf3b"><span class=en-original lang=en><span class=secno>2 </span>Conformance requirements</span><span class=ja-translation lang=ja><span class=secno>2 </span>適合性要件</span></h2>
1139    
1140     <p class="has-ja-translation" data-ja-hash="8b0f72fe04577949924ab1e2997e0d8b"><span class=en-original lang=en>All diagrams, examples, and notes in this specification are
1141     non-normative, as are all sections explicitly marked non-normative.
1142     Everything else in this specification is normative.</span><span class=ja-translation lang=ja>この仕様書のすべての図、例示、注意書き、ならびに規定の一部ではないと明記したすべての節は、
1143     規定の一部ではありません。
1144     この仕様書のそれ以外の部分はすべて規定の一部です。</span></p>
1145    
1146     <p class="has-ja-translation" data-ja-hash="8adc9958d29b879426b71b5b9eae46db"><span class=en-original lang=en>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
1147     NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
1148     "OPTIONAL" in the normative parts of this document are to be
1149     interpreted as described in RFC2119. For readability, these words do
1150     not appear in all uppercase letters in this specification. <a href=#refsRFC2119>[RFC2119]</a></span><span class=ja-translation lang=ja>この文書の規定の部分にあるキーワード「<em class=rfc2119 title="MUST">しなければなりません</em>」、
1151     「<em class=rfc2119 title="MUST NOT">してはなりません</em>」、
1152     「<em class=rfc2119 title="REQUIRED">必須です</em>」、<!--"SHALL", "SHALL
1153     NOT",-->「<em class=rfc2119 title="SHOULD">するべきです</em>」、
1154     「<em class=rfc2119 title="SHOULD NOT">するべきではありません</em>」、
1155     「<em class=rfc2119 title="RECOMMENDED">推奨します</em>」、「<em class=rfc2119 title="MAY">して構いません</em>」、
1156     「<em class=rfc2119 title="OPTIONAL">任意です</em>」は、 RFC 2119 で説明されているように解釈します。
1157     この仕様書<ins class=ja-note>の原文</ins>では、
1158     可読性の観点から、
1159     これらの語<ins class=ja-note>の原語</ins>のすべて大文字による表記は行っていません。
1160     <a href=#refsRFC2119>[RFC2119]</a></span></p>
1161    
1162     <p class="has-ja-translation" data-ja-hash="63dc4357c416e0e0f292a5f662ca71ab"><span class=en-original lang=en>Requirements phrased in the imperative as part of algorithms
1163     (such as "strip any leading space characters" or "return false and
1164     abort these steps") are to be interpreted with the meaning of the
1165     key word ("must", "should", "may", etc) used in introducing the
1166     algorithm.</span><span class=ja-translation lang=ja>算法の一部として<ins class=ja-note>動作の指示の形で (原文では</ins>命令形で<ins class=ja-note>) </ins>記述された要件
1167     (例えば「先頭の間隔文字をすべて除去します」や「偽を返し、これらの段階を停止します」)
1168     は、算法を紹介するに当たって使われたキーワード (<em class=rfc2119 title="MUST">しなければなりません</em>、
1169     <em class=rfc2119 title="SHOULD">するべきです</em>、<em class=rfc2119 title="MAY">して構いません</em>など) の意味により解釈します。</span></p>
1170    
1171     <p class="has-ja-translation" data-ja-hash="a5a0db584980ce3f2448983d6188b2d1"><span class=en-original lang=en>Some conformance requirements are phrased as requirements on
1172     attributes, methods or objects. Such requirements are to be
1173     interpreted as requirements on user agents.</span><span class=ja-translation lang=ja>いくつかの適合性要件は属性やメソッドやオブジェクトの要件として説明されています。
1174     そのような要件は、利用者エージェントに関する要件として解釈します。</span></p>
1175    
1176     <p class="has-ja-translation" data-ja-hash="27386c326b98d878b3c408c60b6095b0"><span class=en-original lang=en>Conformance requirements phrased as algorithms or specific steps
1177     may be implemented in any manner, so long as the end result is
1178     equivalent. (In particular, the algorithms defined in this
1179     specification are intended to be easy to follow, and not intended to
1180     be performant.)</span><span class=ja-translation lang=ja>算法や特定の段階として説明されている適合性要件は、
1181     最終的な結果が等価である限り、任意の方法で実装して<em class=rfc2119 title="MAY">構いません</em>。
1182     (特に、この仕様書で定義されている算法は追うのを簡単にしており、
1183     高性能であることを目指してはいません。)</span></p>
1184    
1185     <p class="has-ja-translation" data-ja-hash="e42931a32a5e7ad458e3ca1b87d741d9"><span class=en-original lang=en>The only conformance class defined by this specification is user
1186     agents.</span><span class=ja-translation lang=ja>この仕様書で定義する唯一の適合性の級は利用者エージェントです。</span></p>
1187    
1188     <p class="has-ja-translation" data-ja-hash="57959e6c42e8d5141b11e501bf60cc2f"><span class=en-original lang=en>User agents may impose implementation-specific limits on
1189     otherwise unconstrained inputs, e.g. to prevent denial of service
1190     attacks, to guard against running out of memory, or to work around
1191     platform-specific limitations.</span><span class=ja-translation lang=ja>利用者エージェントは、サービス拒否攻撃を防ぐため、
1192     記憶容量を使い尽くすことを防ぐため、
1193     あるいは環境特有の制限に対応するためなどの目的で、
1194     別段の制約のない入力に対して実装特有の制限を設けて<em class=rfc2119 title="MAY">構いません</em>。</span></p>
1195 wakaba 1.220
1196     <p class="no-ja-translation" data-ja-hash="25d9e5896e3bddae71f996eac39a3b17"><span class=en-original lang=en>When support for a feature is disabled (e.g. as an emergency
1197     measure to mitigate a security problem, or to aid in development, or
1198     for performance reasons), user agents must act as if they had no
1199     support for the feature whatsoever, and as if the feature was not
1200     mentioned in this specification. For example, if a particular
1201     feature is accessed via an attribute in a Web IDL interface, the
1202     attribute itself would be omitted from the objects that implement
1203     that interface &mdash; leaving the attribute on the object but
1204     making it return null or throw an exception is insufficient.</span></p>
1205 wakaba 1.219
1206    
1207     <h3 id=dependencies class="has-ja-translation" data-ja-hash="896f4eaa4f12972b56ed9cdd9a90b949"><span class=en-original lang=en><span class=secno>2.1 </span>Dependencies</span><span class=ja-translation lang=ja><span class=secno>2.1 </span>依存性</span></h3>
1208    
1209     <p class="has-ja-translation" data-ja-hash="8dc27a34324d9e41d25c6bbbc2d2551c"><span class=en-original lang=en>This specification relies on several other underlying
1210     specifications.</span><span class=ja-translation lang=ja>この仕様書は、他のいくつかの下位の仕様書に依存しています。</span></p>
1211    
1212     <dl><dt class="no-ja-translation" data-ja-hash="4c4ad5fca2e7a3f74dbb1ced00381aa4"><span class=en-original lang=en>HTML</span></dt>
1213    
1214     <dd>
1215    
1216     <p class="no-ja-translation" data-ja-hash="c4848c6b5f3274194219545ace4e32d8"><span class=en-original lang=en>Many fundamental concepts from HTML are used by this
1217     specification. <a href=#refsHTML>[HTML]</a></span></p>
1218    
1219     </dd>
1220    
1221     <dt class="no-ja-translation" data-ja-hash="21838f6e93b1a2157b16dcb6281ff225"><span class=en-original lang=en>WebIDL</span></dt>
1222    
1223     <dd>
1224    
1225     <p class="no-ja-translation" data-ja-hash="336ded24806a8bd7c04c235bef4cd598"><span class=en-original lang=en>The IDL blocks in this specification use the semantics of the
1226     WebIDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></span></p>
1227    
1228     </dd>
1229    
1230     </dl><h2 id=terminology class="has-ja-translation" data-ja-hash="e182a8a3f2adf774fb1c959df71b8600"><span class=en-original lang=en><span class=secno>3 </span>Terminology</span><span class=ja-translation lang=ja><span class=secno>3 </span>用語</span></h2>
1231    
1232     <p class="has-ja-translation" data-ja-hash="f99630e4a7f12f2c4ecb88e02bf4a644"><span class=en-original lang=en>The construction "a <code title="">Foo</code> object", where
1233     <code title="">Foo</code> is actually an interface, is sometimes
1234     used instead of the more accurate "an object implementing the
1235     interface <code title="">Foo</code>".</span><span class=ja-translation lang=ja>「<code title="">Foo</code> オブジェクト」という構文 (<code title="">Foo</code>
1236     は実際には界面) を時々使いますが、より正確な「界面 <code title="">Foo</code>
1237     を実装しているオブジェクト」の代わりに用いています。</span></p>
1238    
1239     <p class="no-ja-translation" data-ja-hash="53202e038bee25bf5bb2edbf37c7cdce"><span class=en-original lang=en>The term DOM is used to refer to the API set made available to
1240     scripts in Web applications, and does not necessarily imply the
1241     existence of an actual <code>Document</code> object or of any other
1242     <code>Node</code> objects as defined in the DOM Core
1243     specifications. <a href=#refsDOMCORE>[DOMCORE]</a></span></p>
1244    
1245     <p class="no-ja-translation" data-ja-hash="ac87df7cb7d80ebc0f2ec45d053c1178"><span class=en-original lang=en>An IDL attribute is said to be <em>getting</em> when its value is
1246     being retrieved (e.g. by author script), and is said to be
1247     <em>setting</em> when a new value is assigned to it.</span></p>
1248    
1249     <p class="no-ja-translation" data-ja-hash="63fe78b97a0b5051e1ffbf6ee2f1e483"><span class=en-original lang=en>The term "JavaScript" is used to refer to ECMA262, rather than
1250     the official term ECMAScript, since the term JavaScript is more
1251     widely known. <a href=#refsECMA262>[ECMA262]</a></span></p>
1252    
1253    
1254     <h2 id=infrastructure class="has-ja-translation" data-ja-hash="cba4f4cee5c6a3e6d8be8da68fa1234e"><span class=en-original lang=en><span class=secno>4 </span>Infrastructure</span><span class=ja-translation lang=ja><span class=secno>4 </span>基盤</span></h2>
1255    
1256     <p class="no-ja-translation" data-ja-hash="f38a96d03c61f343169a402b5c779db8"><span class=en-original lang=en>There are two kinds of workers; dedicated workers, and shared
1257     workers. Dedicated workers, once created, and are linked to their
1258     creator; but message ports can be used to communicate from a
1259     dedicated worker to multiple other browsing contexts or
1260     workers. Shared workers, on the other hand, are named, and once
1261     created any script running in the same <span>origin</span> can
1262     obtain a reference to that worker and communicate with it.</span></p>
1263    
1264    
1265     <h3 id=the-global-scope class="has-ja-translation" data-ja-hash="16d7670f16b3aaf6130252e8f11702eb"><span class=en-original lang=en><span class=secno>4.1 </span>The global scope</span><span class=ja-translation lang=ja><span class=secno>4.1 </span>大域作用域</span></h3>
1266    
1267     <p class="has-ja-translation" data-ja-hash="216dee088449fef485a489ea8a7432f4"><span class=en-original lang=en>The global scope is the "inside" of a worker.</span><span class=ja-translation lang=ja>大域作用域は労働者の「内側」です。</span></p>
1268    
1269     <h4 id=the-workerglobalscope-abstract-interface class="has-ja-translation" data-ja-hash="fe5227371e801f4ac588d0d07472a900" data-ja-real-hash="be491e4df478a7115eae60853f3c23aa"><span class=en-original lang=en><span class=secno>4.1.1 </span>The <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> abstract interface</span><span class=ja-translation lang=ja><span class=secno>4.1.1 </span><code><a href=#workerglobalscope>WorkerGlobalScope</a></code> 抽象界面</span></h4>
1270    
1271     <pre class="idl no-ja-translation" data-ja-hash="d9cd48b2a099afc1664485c2bce9e8b6"><span class=en-original lang=en>interface <dfn id=workerglobalscope>WorkerGlobalScope</dfn> {
1272     readonly attribute <a href=#workerglobalscope>WorkerGlobalScope</a> <a href=#dom-workerglobalscope-self title=dom-WorkerGlobalScope-self>self</a>;
1273     readonly attribute <a href=#workerlocation>WorkerLocation</a> <a href=#dom-workerglobalscope-location title=dom-WorkerGlobalScope-location>location</a>;
1274    
1275     void <a href=#dom-workerglobalscope-close title=dom-WorkerGlobalScope-close>close</a>();
1276     <!-- v2-onclose attribute <span>Function</span> <span title="handler-WorkerGlobalScope-onclose">onclose</span>;
1277     --> attribute <span>Function</span> <a href=#handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror>onerror</a>;
1278     };
1279     <a href=#workerglobalscope>WorkerGlobalScope</a> implements <a href=#workerutils>WorkerUtils</a>;
1280     <a href=#workerglobalscope>WorkerGlobalScope</a> implements <span>EventTarget</span>;</span></pre>
1281    
1282     <p class="no-ja-translation" data-ja-hash="0a5104552951765122b762e943a821b0"><span class=en-original lang=en>The <dfn id=dom-workerglobalscope-self title=dom-WorkerGlobalScope-self><code>self</code></dfn> attribute
1283     must return the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object itself.</span></p>
1284    
1285     <p class="no-ja-translation" data-ja-hash="e48d78d83311d57328ab69a17167fffc"><span class=en-original lang=en>The <dfn id=dom-workerglobalscope-location title=dom-WorkerGlobalScope-location><code>location</code></dfn>
1286     attribute must return the <code><a href=#workerlocation>WorkerLocation</a></code> object created
1287     for the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object when the worker was
1288     created. It represents the <span>absolute URL</span> of the script
1289     that was used to initialize the worker, after any redirects.</span></p>
1290    
1291     <hr><p class="no-ja-translation" data-ja-hash="c205c04fbfcc56617b82329c66dbda4a"><span class=en-original lang=en>When a script invokes the <dfn id=dom-workerglobalscope-close title=dom-WorkerGlobalScope-close><code>close()</code></dfn>
1292     method on a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user agent
1293     must run the following steps (atomically):</span></p>
1294    
1295     <ol><li><p class="no-ja-translation" data-ja-hash="af4d5ddb9edfb1a69b29ed3140620794"><span class=en-original lang=en>Discard any <span title=concept-task>tasks</span> that
1296     have been added to the <span>event loop</span>'s <span title="task
1297     queue">task queues</span>.</span></p>
1298    
1299     <!-- v2-onclose
1300     <li><p class="no-ja-translation" data-ja-hash="38810e04c906ff1907d4cd0641948aab"><span class=en-original lang=en><span>Queue a task</span> to <span>fire a simple
1301     event</span> named <code title="event-close">close</code> at the
1302     <code>WorkerGlobalScope</code> object.</span></p></li>
1303     -->
1304    
1305     <li><p class="no-ja-translation" data-ja-hash="1e713e7163b783674600c93aed418557"><span class=en-original lang=en>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's
1306     <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to
1307     true. (This prevents any further tasks from being queued.)</span></li>
1308    
1309     <li><p class="no-ja-translation" data-ja-hash="37da2c132b44ba85602699d1ef93c598"><span class=en-original lang=en>Disentangle all the ports in the list of <a href="#the-worker's-ports">the worker's
1310     ports</a>.</span></li>
1311    
1312     </ol><p class="no-ja-translation" data-ja-hash="11fd57fd42153141cd3d7fc2b6979e1b"><span class=en-original lang=en>The following are the <span>event handlers</span> (and their
1313     corresponding <span title="event handler event type">event handler
1314     event types</span>) that must be supported, as IDL attributes, by
1315     objects implementing the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>
1316     interface:</span></p>
1317    
1318     <table><thead><tr><th class="no-ja-translation" data-ja-hash="46dae5ae74433c86ed36cf8244812e71"><span class=en-original lang=en><span title="event handlers">Event handler</span> </span><th class="no-ja-translation" data-ja-hash="3fc98eebba71602c62d8b2fd74645dc9"><span class=en-original lang=en><span>Event handler event type</span>
1319     </span><tbody><!-- v2-onclose <tr><td class="no-ja-translation" data-ja-hash="8299f4100f9c690ddf7935714f58b453"><span class=en-original lang=en><dfn title="handler-WorkerGlobalScope-onclose"><code>onclose</code></dfn> </span><td class="no-ja-translation" data-ja-hash="e899358e829911a25c083ed9bc6519e6"><span class=en-original lang=en> <code title="event-close">close</code> --></span><tr><td class="no-ja-translation" data-ja-hash="08a21be8031dd240d32ac8ab2b17a9ac"><span class=en-original lang=en><dfn id=handler-workerglobalscope-onerror title=handler-WorkerGlobalScope-onerror><code>onerror</code></dfn> </span><td class="no-ja-translation" data-ja-hash="bf1b78c16e7c3a3de662d83f487bffff"><span class=en-original lang=en> <code title=event-error>error</code>
1320     </span></table><hr><p class="no-ja-translation" data-ja-hash="cccaf784af1f9110ccf7b4e77e30717a"><span class=en-original lang=en>The <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface must not exist if
1321     the interface's <span>relevant namespace object</span> is a
1322     <code>Window</code> object. <a href=#refsWEBIDL>[WEBIDL]</a></span></p>
1323    
1324    
1325    
1326     <h4 id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface class="no-ja-translation" data-ja-hash="a4b427f41de050a77385a1705efbb7c1"><span class=en-original lang=en><span class=secno>4.1.2 </span>Dedicated workers and the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> interface</span></h4>
1327    
1328     <pre class="idl no-ja-translation" data-ja-hash="77cfd043067c77163e5f8886b3e13e12"><span class=en-original lang=en>[Supplemental, NoInterfaceObject]
1329     interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href=#workerglobalscope>WorkerGlobalScope</a> {
1330     void <a href=#dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage>postMessage</a>(in any message, in optional <span>MessagePortArray</span> ports);<!--
1331     <span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(in any message);-->
1332     attribute <span>Function</span> <a href=#handler-dedicatedworkerglobalscope-onmessage title=handler-DedicatedWorkerGlobalScope-onmessage>onmessage</a>;
1333     };</span></pre>
1334    
1335     <p class="no-ja-translation" data-ja-hash="2b76e99642dd9984f9a5fb8a280c921c"><span class=en-original lang=en><code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects act as if they
1336     had an implicit <code>MessagePort</code> associated with them. This
1337     port is part of a channel that is set up when the worker is created,
1338     but it is not exposed. This object must never be garbage collected
1339     before the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</span></p>
1340    
1341     <p class="no-ja-translation" data-ja-hash="3737098ad5998864275d8ee619bd864e"><span class=en-original lang=en>All messages received by that port must immediately be retargeted
1342     at the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</span></p>
1343    
1344     <p class="no-ja-translation" data-ja-hash="8156ab5347965f42a9531625b8096a00"><span class=en-original lang=en>The <dfn id=dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage><code>postMessage()</code></dfn><!--
1345     and <dfn
1346     title="dom-DedicatedWorkerGlobalScope-startConversation"><code>startConversation()</code></dfn>-->
1347     method<!--s (startConversation)--> on
1348     <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects must act as if, when
1349     invoked, it<!--/they (startConversation)--> immediately invoked the
1350     method of the same name on the port, with the same arguments, and
1351     returned the same return value.</span></p>
1352    
1353     <p class="no-ja-translation" data-ja-hash="49e133d1378e19b0e32d9ef1c8b4a96f"><span class=en-original lang=en>The following are the <span>event handlers</span> (and their
1354     corresponding <span title="event handler event type">event handler
1355     event types</span>) that must be supported, as IDL attributes, by
1356     objects implementing the <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
1357     interface:</span></p>
1358    
1359     <table><thead><tr><th class="no-ja-translation" data-ja-hash="46dae5ae74433c86ed36cf8244812e71"><span class=en-original lang=en><span title="event handlers">Event handler</span> </span><th class="no-ja-translation" data-ja-hash="3fc98eebba71602c62d8b2fd74645dc9"><span class=en-original lang=en><span>Event handler event type</span>
1360     </span><tbody><tr><td class="no-ja-translation" data-ja-hash="0d8bd2da6a52d641c317fac6d1c953b2"><span class=en-original lang=en><dfn id=handler-dedicatedworkerglobalscope-onmessage title=handler-DedicatedWorkerGlobalScope-onmessage><code>onmessage</code></dfn> </span><td class="no-ja-translation" data-ja-hash="fe07e2527bf13c457386ab4807af84a0"><span class=en-original lang=en> <code title=event-message>message</code>
1361     </span></table><p class="no-ja-translation" data-ja-hash="0b21e2810d6cf7fe860324377bffd741"><span class=en-original lang=en>For the purposes of the <span>application cache</span> networking
1362     model, a dedicated worker is an extension of the <span>cache
1363     host</span> from which it was created.</span></p>
1364    
1365    
1366    
1367     <h4 id=shared-workers-and-the-sharedworkerglobalscope-inteface class="no-ja-translation" data-ja-hash="6ab8095d66816337c244beec43a0e6d4"><span class=en-original lang=en><span class=secno>4.1.3 </span>Shared workers and the <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> inteface</span></h4>
1368    
1369     <pre class="idl no-ja-translation" data-ja-hash="6b77d85a80a9793487a476146ebf79ed"><span class=en-original lang=en>[Supplemental, NoInterfaceObject]
1370     interface <dfn id=sharedworkerglobalscope>SharedWorkerGlobalScope</dfn> : <a href=#workerglobalscope>WorkerGlobalScope</a> {
1371     readonly attribute DOMString <a href=#dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name>name</a>;
1372     readonly attribute <span>ApplicationCache</span> <span title=dom-SharedWorkerGlobalScope-applicationCache>applicationCache</span>;
1373     attribute <span>Function</span> <a href=#handler-sharedworkerglobalscope-onconnect title=handler-SharedWorkerGlobalScope-onconnect>onconnect</a>;
1374     };</span></pre>
1375    
1376     <p class="has-ja-translation" data-ja-hash="9d344498c69a5ed60029b76fb274beb2"><span class=en-original lang=en>Shared workers receive message ports through <code title=event-WorkerGlobalScope-connect>connect</code> events on
1377     their global object for each connection.</span><span class=ja-translation lang=ja>共有労働者は、各接続について大域オブジェクトの <code
1378     title=event-WorkerGlobalScope-connect>connect</code> 事象を通じてメッセージ・ポートを受信します。</span></p>
1379    
1380     <p class="no-ja-translation" data-ja-hash="582a890c60947f33bddb73ed33bb32f9"><span class=en-original lang=en>The <dfn id=dom-sharedworkerglobalscope-name title=dom-SharedWorkerGlobalScope-name><code>name</code></dfn>
1381     attribute must return the value it was assigned when the
1382     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object was created by the
1383     "<a href=#run-a-worker>run a worker</a>" algorithm. Its value represents the name
1384     that can be used to obtain a reference to the worker using the
1385     <code><a href=#sharedworker>SharedWorker</a></code> constructor.</span></p>
1386    
1387     <p class="no-ja-translation" data-ja-hash="371bd704ee56d8fdd6568c9a76f95481"><span class=en-original lang=en>The following are the <span>event handlers</span> (and their
1388     corresponding <span title="event handler event type">event handler
1389     event types</span>) that must be supported, as IDL attributes, by
1390     objects implementing the <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
1391     interface:</span></p>
1392    
1393     <table><thead><tr><th class="no-ja-translation" data-ja-hash="46dae5ae74433c86ed36cf8244812e71"><span class=en-original lang=en><span title="event handlers">Event handler</span> </span><th class="no-ja-translation" data-ja-hash="3fc98eebba71602c62d8b2fd74645dc9"><span class=en-original lang=en><span>Event handler event type</span>
1394     </span><tbody><tr><td class="no-ja-translation" data-ja-hash="f198960aead81a70dcfd8fe22ce3e5c3"><span class=en-original lang=en><dfn id=handler-sharedworkerglobalscope-onconnect title=handler-SharedWorkerGlobalScope-onconnect><code>onconnect</code></dfn> </span><td class="no-ja-translation" data-ja-hash="01a017777bf3db29f5ec26ca1ad7aced"><span class=en-original lang=en> <code title=event-connect>connect</code>
1395     </span></table><p class="no-ja-translation" data-ja-hash="8af726c2983bb9fc0a17514c08ab4a6d"><span class=en-original lang=en>For the purposes of the <span>application cache</span> networking
1396     model, a shared worker is its own <span>cache host</span>. The
1397     <a href=#run-a-worker>run a worker</a> algorithm takes care of associating the
1398     worker with an <span>application cache</span>.</span></p>
1399    
1400     <p class="note no-ja-translation" data-ja-hash="a587dc6b1c6df31057cd237bbf76b264"><span class=en-original lang=en>The <code title=dom-SharedWorkerGlobalScope-applicationCache>applicationCache</code>
1401     attribute returns the <code>ApplicationCache</code> object for the
1402     worker.</span></p><!-- normative conf criteria is in the appcache section
1403     -->
1404    
1405    
1406     <h3 id=origins-of-workers class="no-ja-translation" data-ja-hash="f13b3937c992e49f9b4feea9b2724a18"><span class=en-original lang=en><span class=secno>4.2 </span>Origins of workers</span></h3>
1407    
1408     <p class="no-ja-translation" data-ja-hash="5d71247ae9c7e88e4244d78062ed4760"><span class=en-original lang=en>Both the <span>origin</span> and <span>effective script
1409     origin</span> of scripts running in workers are the
1410     <span>origin</span> of the <span>absolute URL</span> given in that
1411     the worker's <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute
1412     represents.</span></p>
1413    
1414    
1415    
1416     <h3 id=the-event-loop class="no-ja-translation" data-ja-hash="96715962ce61ea28085d7e170ec30e73"><span class=en-original lang=en><span class=secno>4.3 </span>The event loop</span></h3>
1417    
1418     <p class="no-ja-translation" data-ja-hash="9da3324200d63a62412fc5bc671f7d95"><span class=en-original lang=en>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has an <span>event
1419     loop</span> distinct from those defined for <span title="unit of
1420     related similar-origin browsing contexts">units of related
1421     similar-origin browsing contexts</span>. This <span>event
1422     loop</span> has no associated <span>browsing context</span>, and its
1423     <span title="task queue">task queues</span> only have events,
1424     callbacks, and networking activity as <span title=concept-task>tasks</span>. The processing model of these
1425     <span title="event loop">event loops</span> is defined below in the
1426     <a href=#run-a-worker>run a worker</a> algorithm.</span></p>
1427    
1428     <p class="no-ja-translation" data-ja-hash="084ed34f256b8b7e4ff2b85cd92ca33b"><span class=en-original lang=en>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object also has a <dfn id=dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</dfn> flag, which must
1429     initially be false, but which can get set to true by the algorithms
1430     in the processing model section below.</span></p>
1431    
1432     <p class="no-ja-translation" data-ja-hash="a4898d27d9a1aab83b927c6ee06cf487"><span class=en-original lang=en>Once the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to
1433     true, the <span>event loop</span>'s <span title="task queue">task
1434     queues</span> must discard any further <span title=concept-task>tasks</span> that would be added to them (tasks
1435     already on the queue are unaffected except where otherwise
1436     specified). Effectively, once the <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true,
1437     timers stop firing, notifications for all pending asynchronous
1438     operations are dropped, etc.</span></p>
1439    
1440    
1441    
1442     <h3 id="the-worker's-lifetime" class="no-ja-translation" data-ja-hash="74a0efe3050847567026cd8638e4d2d6"><span class=en-original lang=en><span class=secno>4.4 </span>The worker's lifetime</span></h3>
1443    
1444     <p class="has-ja-translation" data-ja-hash="15eb0638e0de7d0e159c1214c48ba569"><span class=en-original lang=en>Workers communicate with other workers and with <span title="browsing context">browsing contexts</span> through <span title="channel messaging">message channels</span> and their
1445     <code>MessagePort</code> objects.</span><span class=ja-translation lang=ja>労働者は、メッセージ通信路とその <code>MessagePort</code>
1446     オブジェクトを通じて、他の労働者や閲覧文脈と通信します。</span></p>
1447    
1448     <p class="no-ja-translation" data-ja-hash="2c7d1a4ce717326e596bad596f0fc0bb"><span class=en-original lang=en>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> <var title="">worker global
1449     scope</var> has a list of <dfn id="the-worker's-ports">the worker's ports</dfn>, which
1450     consists of all the <code>MessagePort</code> objects that are
1451     entangled with another port and that have one (but only one) port
1452     owned by <var title="">worker global scope</var>. This list includes
1453     <!--all the <code>MessagePort</code> objects that are in events
1454     pending in the <span>event loop</span>, as well as (commented out
1455     because in practice it makes no difference either way as far as I
1456     can tell, and it would be hard to strictly implement since these
1457     ports might not yet be across the thread boundary)--> the implicit
1458     <code>MessagePort</code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated workers</a>.</span></p>
1459    
1460     <p class="no-ja-translation" data-ja-hash="1aeb90a4b706e7a9ff09953cd49aed7c"><span class=en-original lang=en>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-workers">the
1461     worker's workers</dfn>. Initially this list is empty; it is
1462     populated when the worker creates or obtains further workers.</span></p>
1463    
1464     <p class="no-ja-translation" data-ja-hash="065bd87a93010cf4e435c95f2e540af5"><span class=en-original lang=en>Finally, each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of
1465     <dfn id="the-worker's-documents">the worker's <code>Document</code>s</dfn>. Initially this list
1466     is empty; it is populated when the worker is created.</span></p>
1467    
1468     <p class="no-ja-translation" data-ja-hash="6a8fe8066ddde02f0b3e6e22079bbd7e"><span class=en-original lang=en>Whenever a <code>Document</code> <var title="">d</var> is <dfn id="add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">added to the
1469     worker's <code>Document</code>s</dfn>, the user agent must, for each
1470     worker in the list of <a href="#the-worker's-workers">the worker's workers</a> whose list
1471     of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> does not contain
1472     <var title="">d</var>, <a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's
1473     documents">add <var title="">d</var> to <var title="">q</var>'s
1474     <code>WorkerGlobalScope</code> owner's list of <span>the worker's
1475     <code>Document</code>s</span></a>.</span></p> <!-- suggestions welcome
1476     on making this sentence into understandable English -->
1477    
1478     <p class="no-ja-translation" data-ja-hash="c556389e6b192b4ac768940df1b3cffc"><span class=en-original lang=en>Whenever a <code>Document</code> object is <span title="discard a
1479     Document">discarded</span>, it must be removed from the list of
1480     <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> of each worker
1481     whose list contains that <code>Document</code>.</span></p>
1482    
1483     <p class="no-ja-translation" data-ja-hash="6dd988d790ec2b4c2000cb8c571a5a33"><span class=en-original lang=en>Given a <span>script's global object</span> <var title="">o</var>
1484     when creating or obtaining a worker, the <dfn id=list-of-relevant-document-objects-to-add>list of relevant
1485     <code>Document</code> objects to add</dfn> depends on the type of
1486     <var title="">o</var>. If <var title="">o</var> is a
1487     <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. if we are creating a
1488     nested worker), then the relevant <code>Document</code>s are the
1489     <code>Document</code>s that are in <var title="">o</var>'s own list
1490     of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a>. Otherwise, <var title="">o</var> is a <code>Window</code> object, and the relevant
1491     <code>Document</code> is just the <code>Document</code> that is the
1492     <span>active document</span> of the <code>Window</code> object <var title="">o</var>.</span></p>
1493    
1494     <hr><p class="no-ja-translation" data-ja-hash="ea771ae7f86ae7c85f1418763117fa28"><span class=en-original lang=en>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its
1495     list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> is not
1496     empty.</span></p>
1497    
1498     <p class="no-ja-translation" data-ja-hash="e7407e6349a298d2bf4d87d06d147420"><span class=en-original lang=en>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is a
1499     <a href=#permissible-worker>permissible worker</a> and either it has outstanding
1500     timers, database transactions, or network connections, or its list
1501     of <a href="#the-worker's-ports">the worker's ports</a> is not empty, or its
1502     <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> is actually a
1503     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a
1504     shared worker).</span></p>
1505    
1506     <p class="no-ja-translation" data-ja-hash="1a7b06a4fed1c22378b6b6f6ca13ffc2"><span class=en-original lang=en>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any
1507     of the <code>Document</code> objects in <a href="#the-worker's-documents">the worker's
1508     <code>Document</code>s</a> are <span>fully active</span>.</span></p>
1509    
1510     <p class="no-ja-translation" data-ja-hash="4182e47a8cba3978170630845be09eed"><span class=en-original lang=en>A worker is said to be a <dfn id=suspendable-worker>suspendable worker</dfn> if it is
1511     not an <a href=#active-needed-worker>active needed worker</a> but it is a
1512     <a href=#permissible-worker>permissible worker</a>.</span></p>
1513    
1514    
1515     <h3 id=processing-model class="has-ja-translation" data-ja-hash="4eeffb677544f6c8799408c6b9021b4c"><span class=en-original lang=en><span class=secno>4.5 </span>Processing model</span><span class=ja-translation lang=ja><span class=secno>4.5 </span>処理モデル</span></h3>
1516    
1517 wakaba 1.222 <p class="no-ja-translation" data-ja-hash="6af2c1b362a44d3edfe5f69fa6f328e1"><span class=en-original lang=en>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with
1518     <span>URL</span> <var title="">url</var>, a <span>browsing
1519     context</span> <var title="">owner browsing context</var>, a
1520     <code>Document</code> <var title="">owner document</var>, an
1521     <span>origin</span> <var title="">owner origin</var>, and with
1522     global scope <var title="">worker global scope</var>, it must run
1523     the following steps:</span></p>
1524 wakaba 1.219
1525     <ol><li>
1526    
1527     <p class="no-ja-translation" data-ja-hash="699e58187adc9ee37990500a66c83a8f"><span class=en-original lang=en>Create a completely separate and parallel execution environment
1528     (i.e. a separate thread or process or equivalent construct), and
1529     run the rest of these steps asynchronously in that context.</span></p>
1530    
1531     </li>
1532    
1533     <li><p class="no-ja-translation" data-ja-hash="d41742425aaafe5999e11ca90b26f088"><span class=en-original lang=en>If <var title="">worker global scope</var> is actually a
1534     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a
1535     shared worker), and there are any <span title="relevant application
1536     cache">relevant application caches</span> that are identified by a
1537     manifest URL with the <span>same origin</span> as <var title="">url</var> and that have <var title="">url</var> as one of
1538     their entries, <em>not</em> excluding entries marked as <span title=concept-appcache-foreign>foreign</span>, then associate the
1539     <var title="">worker global scope</var> with the <span title=concept-appcache-selection>most appropriate application
1540     cache</span> of those that match.</span></li>
1541    
1542     <li>
1543    
1544     <p class="no-ja-translation" data-ja-hash="f89ca5941c6e329a40b0292e51c78eee"><span class=en-original lang=en>Attempt to <span>fetch</span> the resource identified by <var title="">url</var>, from the <var title="">owner origin</var>.</span></p>
1545     <!-- not http-origin privacy sensitive -->
1546    
1547     <p class="no-ja-translation" data-ja-hash="c7ec78cc350a0982946c4705a844ec64"><span class=en-original lang=en>If the attempt fails, or if the attempt involves any redirects
1548     to URIs that do not have the <span>same origin</span> as <var title="">url</var> (even if the final URI is at the <span>same
1549     origin</span> as the original <var title="">url</var>), then for
1550     each <code><a href=#worker>Worker</a></code> or <code><a href=#sharedworker>SharedWorker</a></code> object
1551     associated with <var title="">worker global scope</var>,
1552     <span>queue a task</span> to <span>fire a simple event</span>
1553     named <code title=event-error>error</code> at that
1554     object. Abort these steps.</span></p>
1555    
1556     <p class="no-ja-translation" data-ja-hash="f1667590dddc3f064bc292826b67f086"><span class=en-original lang=en>If the attempt succeeds, then convert the script resource to
1557     Unicode by assuming it was encoded as UTF-8, to obtain its <var title="">source</var>.</span></p>
1558    
1559     <p class="no-ja-translation" data-ja-hash="c880bce97c5a1aadccd8989fc4ec8551"><span class=en-original lang=en>Let <var title="">language</var> be JavaScript.</span></p>
1560    
1561     <p class="note has-ja-translation" data-ja-hash="5ba762159d9de3f8bd326fe0bcfac206"><span class=en-original lang=en>As with <code>script</code> elements, the MIME
1562     type of the script is ignored. Unlike with <code>script</code>
1563     elements, there is no way to override the type. It's always
1564     assumed to be JavaScript.</span><span class=ja-translation lang=ja><code>script</code> 要素と同様に、スクリプトの MIME 型は無視します。
1565     <code>script</code> 要素とは異なり、
1566     型を上書きする方法はありません。スクリプトは常に JavaScript
1567     と仮定します。</span></p>
1568    
1569     </li>
1570    
1571     <li>
1572    
1573     <p class="no-ja-translation" data-ja-hash="604d3f52a6756f627f0e747b0d06e6ae"><span class=en-original lang=en>A new <span title=concept-script>script</span> is now
1574     created, as follows.</span></p>
1575    
1576     <p class="no-ja-translation" data-ja-hash="2dfcd0f76cde607de6cc88d70f390825"><span class=en-original lang=en>Create a new <span>script execution environment</span>
1577     set up as appropriate for the scripting language <var title="">language</var>.</span></p>
1578    
1579     <p class="no-ja-translation" data-ja-hash="fdf8b5f9ba18a31a8f48670142f51442"><span class=en-original lang=en>Parse/compile/initialize <var title="">source</var> using that
1580     <span>script execution environment</span>, as appropriate for <var title="">language</var>, and thus obtain a <span>list of code
1581     entry-points</span>; set the <i>initial code entry-point</i> to
1582     the entry-point for any executable code to be immediately run.</span></p>
1583    
1584     <p class="no-ja-translation" data-ja-hash="129927904de4572e52f5bc380711aa10"><span class=en-original lang=en>Set the <span>script's global object</span> to <var title="">worker global scope</var>.</span></p>
1585    
1586     <p class="no-ja-translation" data-ja-hash="02eeb9a0f925368a93666886c94bf9bf"><span class=en-original lang=en>Set the <span>script's browsing context</span> to <var title="">owner browsing context</var>.</span></p>
1587    
1588 wakaba 1.222 <p class="no-ja-translation" data-ja-hash="aa9d79a7bcabbe72bb199704f0b69795"><span class=en-original lang=en>Set the <span>script's document</span> to <var title="">owner
1589     document</var>.</span></p>
1590    
1591 wakaba 1.219 <p class="no-ja-translation" data-ja-hash="104fe9ff67aec2141cd0733499cfef92"><span class=en-original lang=en>Set the <span>script's URL character encoding</span> to
1592     UTF-8. (This is just used for encoding non-ASCII characters in the
1593     query component of URLs.)</span></p>
1594    
1595     <p class="no-ja-translation" data-ja-hash="7570c80d1bbf45f73eb74befed51740d"><span class=en-original lang=en>Set the <span>script's base URL</span> to <var title="">url</var>.</span></p>
1596    
1597     </li>
1598    
1599     <li>
1600    
1601     <p class="no-ja-translation" data-ja-hash="0c5c3b38b3df11781c2391306b478710"><span class=en-original lang=en><strong>Closing orphan workers</strong>: Start monitoring the
1602     worker such that no sooner than it stops being either a
1603     <a href=#protected-worker>protected worker</a> or a <a href=#suspendable-worker>suspendable
1604     worker</a>, and no later than it stops being a
1605     <a href=#permissible-worker>permissible worker</a>, <var title="">worker global
1606     scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set
1607     to true<!-- v2-onclose and <span title="queue a task">a task is
1608     queued</span> to <span>fire a simple event</span> named <code
1609     title="event-close">close</code> at <var title="">worker global
1610     scope</var>-->.</span></p>
1611    
1612     </li>
1613    
1614     <li>
1615    
1616     <p class="no-ja-translation" data-ja-hash="24a8fa04f32239e0dafc1e98e466d6b4"><span class=en-original lang=en><strong>Suspending workers</strong>: Start monitoring the
1617     worker, such that whenever <var title="">worker global
1618     scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is false
1619     and the worker is a <a href=#suspendable-worker>suspendable worker</a>, the user
1620     agent suspends execution of script in that worker until such time
1621     as either the <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag switches
1622     to true or the worker stops being a <a href=#suspendable-worker>suspendable
1623     worker</a>.</span></p>
1624    
1625     </li>
1626    
1627     <li>
1628    
1629     <p class="no-ja-translation" data-ja-hash="4321156bbce7d4613215c6cd962a1dc4"><span class=en-original lang=en><span title="jump to a code entry-point">Jump</span> to the
1630     <span title=concept-script>script</span>'s <i>initial code
1631     entry-point</i>, and let that run until it either returns, fails
1632     to catch an exception, or gets prematurely aborted by the
1633     "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>"
1634     algorithms defined below.</span></p>
1635    
1636     <!-- v2-onclose
1637     <p class="note no-ja-translation" data-ja-hash="e632e340409f851c9423aafe27afe24f"><span class=en-original lang=en>If the script gets aborted by the "<span>kill a
1638     worker</span>" algorithm, then that same algorithm will cause
1639     there to only be a single <span title="concept-task">task</span>
1640     in the <span>event loop</span> at the next step, namely the task
1641     for the <code title="message-close">close</code> event. The
1642     "<span>terminate a worker</span>" algorithm removes all the
1643     events.</span></p>
1644     -->
1645    
1646     </li>
1647    
1648     <li><p class="no-ja-translation" data-ja-hash="cfc4a3473c7cde1f5a4133c349682bab"><span class=en-original lang=en>If <var title="">worker global scope</var> is actually a
1649     <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the worker is
1650     a dedicated worker), then enable the <span>port message
1651     queue</span> of the worker's implicit port.</span></li>
1652    
1653     <li>
1654    
1655     <p class="no-ja-translation" data-ja-hash="ac8f871c5ad85c37527bc69c91141970"><span class=en-original lang=en><i title="">Event loop</i>: Wait until either there is a <span title=concept-task>task</span> in one of the <span>event
1656     loop</span>'s <span title="task queue">task queues</span> or <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set
1657     to true.</span></p>
1658    
1659     </li>
1660    
1661     <li>
1662    
1663     <p class="no-ja-translation" data-ja-hash="bcc803e78dd6f07ff20eaa1ca0d23303"><span class=en-original lang=en>Run the oldest task on one of the <span>event loop</span>'s
1664     <span title="task queue">task queues</span>, if any. The user
1665     agent may pick any <span>task queue</span>.</span></p>
1666    
1667     <p class="note no-ja-translation" data-ja-hash="2a401c207ed88f5206b2eb8a90fc91a6"><span class=en-original lang=en>The handling of events or the execution of
1668     callbacks might get prematurely aborted by the "<a href=#kill-a-worker>kill a
1669     worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
1670     defined below.</span></p>
1671    
1672     </li>
1673    
1674     <li>
1675    
1676     <p class="no-ja-translation" data-ja-hash="0a62cf7225c4d215f05940236b695d05"><span class=en-original lang=en>Remove the task run in the previous step, if any, from its
1677     <span>task queue</span>.</span></p>
1678    
1679     </li>
1680    
1681     <li>
1682    
1683     <p class="no-ja-translation" data-ja-hash="779764122a6b7c3177782cbb51d5c914"><span class=en-original lang=en>If there are any more events in the <span>event loop</span>'s
1684     <span title="task queue">task queues</span> or if <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set
1685     to false, then jump back to the step above labeled <i>event
1686     loop</i>.</span></p>
1687    
1688     </li>
1689    
1690     <li>
1691    
1692     <p class="no-ja-translation" data-ja-hash="fb906768fcbbd4867b29825a7893fe6e"><span class=en-original lang=en>If there are any outstanding transactions that have callbacks
1693     that involve <span title=concept-script>scripts</span> whose
1694     <span title="script's global object">global object</span> is the
1695     <var title="">worker global scope</var>, roll them back (without
1696     invoking any of the callbacks).</span></p>
1697    
1698     </li>
1699    
1700     <li>
1701    
1702     <p class="no-ja-translation" data-ja-hash="77a63b1af244b3bfda62ba8d7bf76ea9"><span class=en-original lang=en>Empty the <var title="">worker global scope</var>'s <span>list
1703     of active timeouts</span> and its <span>list of active
1704     intervals</span>.</span></p>
1705    
1706     </li>
1707    
1708     <!-- v2-onclose
1709     <li>
1710    
1711     <p class="no-ja-translation" data-ja-hash="8e08be58e0d4244c08ef54bae738acc8"><span class=en-original lang=en>For each <code>Worker</code> or <code>SharedWorker</code>
1712     object associated with <var title="">worker global scope</var>,
1713     <span>queue a task</span> to <span>fire a simple event</span>
1714     named <code title="event-close">close</code> at that object.</span></p>
1715    
1716     </li>
1717     -->
1718     </ol><hr><p class="no-ja-translation" data-ja-hash="cd7920afdad85f0228b3501a68536c9a"><span class=en-original lang=en>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must
1719     run the following steps in parallel with the worker's main loop (the
1720     "<a href=#run-a-worker>run a worker</a>" processing model defined above):</span></p>
1721    
1722     <ol><!-- v2-onclose
1723     <li><p class="no-ja-translation" data-ja-hash="3200831090c78502fc0cefc890a2c373"><span class=en-original lang=en>If the worker's <code>WorkerGlobalScope</code> object's
1724     <span title="dom-WorkerGlobalScope-closing">closing</span> flag is
1725     false, <span>queue a task</span> to <span>fire a simple
1726     event</span> named <code title="event-close">close</code> at the
1727     worker's <code>WorkerGlobalScope</code> object.</span></p></li>
1728     --><li><p class="no-ja-translation" data-ja-hash="4cc11724db0ff9175e61747ac0b27285"><span class=en-original lang=en>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to
1729     true.</span></li>
1730    
1731     <!-- v2-onclose
1732     <li><p class="no-ja-translation" data-ja-hash="4e3c7a6ff9a9f675020d75a10705eecc"><span class=en-original lang=en>Wait a user-agent-defined amount of time. If the "<span>run
1733     a worker</span>" processing model defined above immediately starts
1734     running event listeners registered for the <code
1735     title="event-close">close</code> event, this time should not be
1736     zero &mdash; the idea is that the <code
1737     title="event-close">close</code> event can be used to clean up
1738     when shutting down unexpectedly.</span></p></li>
1739     -->
1740    
1741     <li><p class="no-ja-translation" data-ja-hash="09b4e752d892d358db0eb9f001f5a26c"><span class=en-original lang=en>If there are any <span title=concept-task>tasks</span>
1742     queued in the <span>event loop</span>'s <span title="task
1743     queue">task queues</span><!-- v2-onclose other than the <code
1744     title="event-close">close</code> event that this algorithm just
1745     added-->, discard them without processing them.</span></li>
1746    
1747     <!-- v2-onclose
1748     <li><p class="no-ja-translation" data-ja-hash="f62a56e5aab0f0d08a9fa1e63f1983c5"><span class=en-original lang=en>If the <code title="event-close">close</code> event that
1749     this algorithm just queued hasn't yet been dispatched, then abort
1750     the script currently running in the worker.</span></p></li>
1751     -->
1752    
1753     <li><p class="has-ja-translation" data-ja-hash="a53f0acde0e4a21781c4b31d5a0f110a"><span class=en-original lang=en>Wait a user-agent-defined amount of time.</span><span class=ja-translation lang=ja>利用者エージェント定義の時間、待ちます。</span></li>
1754    
1755     <li><p class="no-ja-translation" data-ja-hash="fbb7fecc04423fb209634e5473bd7ec1"><span class=en-original lang=en>Abort the script currently running in the worker<!--
1756     v2-onclose (if any script is running, then it will be a handler for
1757     the <code title="event-close">close</code> event)-->.</span></li>
1758    
1759     </ol><p class="no-ja-translation" data-ja-hash="065b6253058d6c118693257b76ed3444"><span class=en-original lang=en>User agents may invoke the "<a href=#kill-a-worker>kill a worker</a>"
1760     processing model on a worker at any time, e.g. in response to user
1761     requests, in response to CPU quota management, or when a worker
1762     stops being an <a href=#active-needed-worker>active needed worker</a> if the worker
1763     continues executing even after its <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag was
1764     set to true.</span></p>
1765    
1766     <hr><p class="no-ja-translation" data-ja-hash="af2a7479f3a6fc4f418bd8e7255c63be"><span class=en-original lang=en>When a user agent is to <dfn id=terminate-a-worker>terminate a worker</dfn> it must run
1767     the following steps in parallel with the worker's main loop (the
1768     "<a href=#run-a-worker>run a worker</a>" processing model defined above):</span></p>
1769    
1770     <ol><li><p class="no-ja-translation" data-ja-hash="4cc11724db0ff9175e61747ac0b27285"><span class=en-original lang=en>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's
1771     <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to
1772     true.</span></li>
1773    
1774     <li><p class="no-ja-translation" data-ja-hash="a9cf50df3de2e3788a3125ace8cf61f5"><span class=en-original lang=en>If there are any <span title=concept-task>tasks</span>
1775     queued in the <span>event loop</span>'s <span title="task
1776     queue">task queues</span>, discard them without processing
1777     them.</span></li>
1778    
1779     <li><p class="has-ja-translation" data-ja-hash="fcb471f3c8cace3a86095dcb29d25515"><span class=en-original lang=en>Abort the script currently running in the worker.</span><span class=ja-translation lang=ja>労働者中で現在走っているスクリプトを停止します。</span></li>
1780    
1781     <li><p class="no-ja-translation" data-ja-hash="533246b74ff40190332c8ca473d635b5"><span class=en-original lang=en>If the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object is
1782     actually a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the
1783     worker is a dedicated worker), then empty the <span>port message
1784     queue</span> of the port that the worker's implicit port is
1785     entangled with.</span></li>
1786    
1787     </ol><hr><p class="no-ja-translation" data-ja-hash="232ca3945fb57a3baa9cc0675ff99caa"><span class=en-original lang=en>The <span>task source</span> for the tasks mentioned above is the
1788     <span>DOM manipulation task source</span>.</span></p>
1789    
1790    
1791     <h3 id=runtime-script-errors class="has-ja-translation" data-ja-hash="eb260f04266c3b94080b5c3f88c55a31"><span class=en-original lang=en><span class=secno>4.6 </span>Runtime script errors</span><span class=ja-translation lang=ja><span class=secno>4.6 </span>実行時スクリプト誤り</span></h3>
1792    
1793     <p class="no-ja-translation" data-ja-hash="401c7e532be72fbcdad4bf63a062995c"><span class=en-original lang=en>Whenever an uncaught runtime script error occurs in one of the
1794     worker's scripts, if the error did not occur while handling a
1795     previous script error, the user agent must <span>report the
1796     error</span> using the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <code title=handler-WorkerGlobalScope-onerror><a href=#handler-workerglobalscope-onerror>onerror</a></code>
1797     attribute.
1798    
1799     <a href=#refsHTML>[HTML]</a>
1800    
1801     </span></p>
1802    
1803     <p class="no-ja-translation" data-ja-hash="b6fcc24625fb7ba0be861f55de9b01bd"><span class=en-original lang=en>For shared workers, if the error is still <i title=concept-error-nothandled>not handled</i> afterwards, or if
1804     the error occurred while handling a previous script error, the error
1805     may be reported to the user.
1806    
1807     <a href=#refsHTML>[HTML]</a>
1808    
1809     </span></p>
1810    
1811     <p class="no-ja-translation" data-ja-hash="44fbeda15b001a0dc82fe40089bb81bb"><span class=en-original lang=en>For dedicated workers, if the error is still <i title=concept-error-nothandled>not handled</i> afterwards, or if
1812     the error occurred while handling a previous script error, the user
1813     agent must <span>queue a task</span> to <a href=#fire-a-worker-error-event>fire a worker error
1814     event</a> at the <code><a href=#worker>Worker</a></code> object associated with the
1815     worker.</span></p>
1816    
1817     <p class="no-ja-translation" data-ja-hash="35e5dc7e779c495262161a703b45ffbc"><span class=en-original lang=en>When the user agent is to <dfn id=fire-a-worker-error-event>fire a worker error event</dfn> at
1818     a <code><a href=#worker>Worker</a></code> object, it must dispatch an event that uses
1819     the <code><a href=#errorevent>ErrorEvent</a></code> interface, with the name <code title=event-error>error</code>, that doesn't bubble and is
1820     cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, and <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attributes set
1821     appropriately. The default action of this event depends on whether
1822     the <code><a href=#worker>Worker</a></code> object is itself in a worker. If it is, and
1823     that worker is also a dedicated worker, then the user agent must
1824     again <span>queue a task</span> to <a href=#fire-a-worker-error-event>fire a worker error
1825     event</a> at the <code><a href=#worker>Worker</a></code> object associated with
1826     <em>that</em> worker. Otherwise, then the error may be reported
1827     to the user.</span></p>
1828    
1829     <p class="no-ja-translation" data-ja-hash="232ca3945fb57a3baa9cc0675ff99caa"><span class=en-original lang=en>The <span>task source</span> for the tasks mentioned above is the
1830     <span>DOM manipulation task source</span>.</span></p>
1831    
1832 wakaba 1.223 <hr><pre class="idl no-ja-translation" data-ja-hash="8be2e26abf107da07a869a8171669f83"><span class=en-original lang=en>interface <dfn id=errorevent>ErrorEvent</dfn> : <span>Event</span> {
1833 wakaba 1.219 readonly attribute DOMString <a href=#dom-errorevent-message title=dom-ErrorEvent-message>message</a>;
1834     readonly attribute DOMString <a href=#dom-errorevent-filename title=dom-ErrorEvent-filename>filename</a>;
1835     readonly attribute unsigned long <a href=#dom-errorevent-lineno title=dom-ErrorEvent-lineno>lineno</a>;
1836     void <a href=#dom-errorevent-initerrorevent title=dom-ErrorEvent-initErrorEvent>initErrorEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString messageArg, in DOMString filenameArg, in unsigned long linenoArg);
1837     };</span></pre>
1838    
1839     <p class="no-ja-translation" data-ja-hash="e858dabb2d6c484114d8450e8180552d"><span class=en-original lang=en>The <dfn id=dom-errorevent-initerrorevent title=dom-ErrorEvent-initErrorEvent><code>initErrorEvent()</code></dfn>
1840     method must initialize the event in a manner analogous to the
1841     similarly-named method in the DOM Events interfaces. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></span></p>
1842    
1843     <p class="no-ja-translation" data-ja-hash="c3d08d500554faa699d875e3015209b9"><span class=en-original lang=en>The <dfn id=dom-errorevent-message title=dom-ErrorEvent-message><code>message</code></dfn>
1844     attribute represents the error message.</span></p>
1845    
1846     <p class="no-ja-translation" data-ja-hash="27affe597e932e64fc4db85fad27e91b"><span class=en-original lang=en>The <dfn id=dom-errorevent-filename title=dom-ErrorEvent-filename><code>filename</code></dfn>
1847     attribute represents the <span>absolute URL</span> of the script in
1848     which the error originally occurred.</span></p>
1849    
1850     <p class="no-ja-translation" data-ja-hash="4322851b5483408bad81570533bf6251"><span class=en-original lang=en>The <dfn id=dom-errorevent-lineno title=dom-ErrorEvent-lineno><code>lineno</code></dfn>
1851     attribute represents the line number where the error occurred in the
1852     script.</span></p>
1853    
1854    
1855    
1856     <h3 id=creating-workers class="has-ja-translation" data-ja-hash="f0a4732d38d01e3d103b68468f9fe234"><span class=en-original lang=en><span class=secno>4.7 </span>Creating workers</span><span class=ja-translation lang=ja><span class=secno>4.7 </span>労働者の作成</span></h3>
1857    
1858     <h4 id=the-abstractworker-abstract-interface class="has-ja-translation" data-ja-hash="fe5227371e801f4ac588d0d07472a900" data-ja-real-hash="fea226dea005bb8238586cd20b34aa2f"><span class=en-original lang=en><span class=secno>4.7.1 </span>The <code><a href=#abstractworker>AbstractWorker</a></code> abstract interface</span><span class=ja-translation lang=ja><span class=secno>4.7.1 </span><code><a href=#abstractworker>AbstractWorker</a></code> 抽象界面</span></h4>
1859    
1860     <pre class="idl no-ja-translation" data-ja-hash="fe1bdb635f9560b4e343933b1e06ce22"><span class=en-original lang=en>[Supplemental, NoInterfaceObject]
1861     interface <dfn id=abstractworker>AbstractWorker</dfn> {
1862     attribute <span>Function</span> <a href=#handler-abstractworker-onerror title=handler-AbstractWorker-onerror>onerror</a>;
1863     <!-- v2-onclose attribute <span>Function</span> <span title="handler-AbstractWorker-onclose">onclose</span>; -->
1864     };
1865     <a href=#abstractworker>AbstractWorker</a> implements <span>EventTarget</span>;</span></pre>
1866    
1867     <p class="no-ja-translation" data-ja-hash="914ac190a41d2e561056f2eabed6074f"><span class=en-original lang=en>The following are the <span>event handlers</span> (and their
1868     corresponding <span title="event handler event type">event handler
1869     event types</span>) that must be supported, as IDL attributes, by
1870     objects implementing the <code><a href=#abstractworker>AbstractWorker</a></code> interface:</span></p>
1871    
1872     <table><thead><tr><th class="no-ja-translation" data-ja-hash="46dae5ae74433c86ed36cf8244812e71"><span class=en-original lang=en><span title="event handlers">Event handler</span> </span><th class="no-ja-translation" data-ja-hash="3fc98eebba71602c62d8b2fd74645dc9"><span class=en-original lang=en><span>Event handler event type</span>
1873     </span><tbody><tr><td class="no-ja-translation" data-ja-hash="797655c7ba76af81be91c1f52bf92e5d"><span class=en-original lang=en><dfn id=handler-abstractworker-onerror title=handler-AbstractWorker-onerror><code>onerror</code></dfn> </span><td class="no-ja-translation" data-ja-hash="bf1b78c16e7c3a3de662d83f487bffff"><span class=en-original lang=en> <code title=event-error>error</code>
1874     <!-- v2-onclose --></span><!--<tr><td class="no-ja-translation" data-ja-hash="5bacdeaff60366f7971634c5de89cc1a"><span class=en-original lang=en><dfn title="handler-AbstractWorker-onclose"><code>onclose</code></dfn> </span><td class="no-ja-translation" data-ja-hash="e899358e829911a25c083ed9bc6519e6"><span class=en-original lang=en> <code title="event-close">close</code> -->
1875     </span></table><h4 id=dedicated-workers-and-the-worker-interface class="no-ja-translation" data-ja-hash="4d0010617afd55731512f81d11e29921"><span class=en-original lang=en><span class=secno>4.7.2 </span>Dedicated workers and the <code><a href=#worker>Worker</a></code> interface</span></h4>
1876    
1877     <pre class="idl no-ja-translation" data-ja-hash="b7c01ed542c5f747a4b64a1ac0008817"><span class=en-original lang=en>[<a href=#dom-worker title=dom-Worker>Constructor</a>(in DOMString scriptURL)]
1878     interface <dfn id=worker>Worker</dfn> : <a href=#abstractworker>AbstractWorker</a> {
1879     void <a href=#dom-worker-terminate title=dom-Worker-terminate>terminate</a>();
1880    
1881     void <a href=#dom-worker-postmessage title=dom-Worker-postMessage>postMessage</a>(in any message, in optional <span>MessagePortArray</span> ports);<!--
1882     <span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(in any message);-->
1883     attribute <span>Function</span> <a href=#handler-worker-onmessage title=handler-Worker-onmessage>onmessage</a>;
1884     };</span></pre>
1885    
1886     <p class="no-ja-translation" data-ja-hash="c01e50cb895f4eaa527128e73934b76c"><span class=en-original lang=en>The <dfn id=dom-worker-terminate title=dom-Worker-terminate><code>terminate()</code></dfn> method,
1887     when invoked, must cause the "<a href=#terminate-a-worker>terminate a worker</a>"
1888     algorithm to be run on the worker with with the object is
1889     associated.</span></p>
1890    
1891     <p class="no-ja-translation" data-ja-hash="f306158a0574a5376130b398642a9bc3"><span class=en-original lang=en><code><a href=#worker>Worker</a></code> objects act as if they had an implicit
1892     <code>MessagePort</code> associated with them. This port is part of
1893     a channel that is set up when the worker is created, but it is not
1894     exposed. This object must never be garbage collected before the
1895     <code><a href=#worker>Worker</a></code> object.</span></p>
1896    
1897     <p class="no-ja-translation" data-ja-hash="3347b0248a16085b3e8a073aed81f1d8"><span class=en-original lang=en>All messages received by that port must immediately be retargeted
1898     at the <code><a href=#worker>Worker</a></code> object.</span></p>
1899    
1900     <p class="no-ja-translation" data-ja-hash="58e82dfd8fd30e4340d6d1f7f7a08239"><span class=en-original lang=en>The <dfn id=dom-worker-postmessage title=dom-Worker-postMessage><code>postMessage()</code></dfn><!--
1901     and <dfn
1902     title="dom-Worker-startConversation"><code>startConversation()</code></dfn>-->
1903     method<!--s (startConversation)--> on <code><a href=#worker>Worker</a></code> objects
1904     must act as if, when invoked, it<!--/they (startConversation)-->
1905     immediately invoked the method of the same name on the port, with
1906     the same arguments, and returned the same return value.</span></p>
1907    
1908     <p class="no-ja-translation" data-ja-hash="b807e23fbf83a95fffd54ed260952030"><span class=en-original lang=en>The following are the <span>event handlers</span> (and their
1909     corresponding <span title="event handler event type">event handler
1910     event types</span>) that must be supported, as IDL attributes, by
1911     objects implementing the <code><a href=#worker>Worker</a></code> interface:</span></p>
1912    
1913     <table><thead><tr><th class="no-ja-translation" data-ja-hash="46dae5ae74433c86ed36cf8244812e71"><span class=en-original lang=en><span title="event handlers">Event handler</span> </span><th class="no-ja-translation" data-ja-hash="3fc98eebba71602c62d8b2fd74645dc9"><span class=en-original lang=en><span>Event handler event type</span>
1914     </span><tbody><tr><td class="no-ja-translation" data-ja-hash="936f67c1111af9460db35858624e3ce9"><span class=en-original lang=en><dfn id=handler-worker-onmessage title=handler-Worker-onmessage><code>onmessage</code></dfn> </span><td class="no-ja-translation" data-ja-hash="fe07e2527bf13c457386ab4807af84a0"><span class=en-original lang=en> <code title=event-message>message</code>
1915     </span></table><hr><p class="no-ja-translation" data-ja-hash="071022f5c10c547e44e7e3a998659333"><span class=en-original lang=en>When the <dfn id=dom-worker title=dom-Worker><code>Worker(<var title="">scriptURL</var>)</code></dfn> constructor is invoked, the
1916     user agent must run the following steps:</span></p>
1917    
1918     <ol><li><p class="no-ja-translation" data-ja-hash="c25e5a7c6b705956bf78fb7b5520d14b"><span class=en-original lang=en><span title="resolve a url">Resolve</span> the <var title="">scriptURL</var> argument relative to the <span>entry
1919     script</span>'s <span title="script's base URL">base URL</span>,
1920     when the method is invoked.</span></li>
1921    
1922     <li><p class="has-ja-translation" data-ja-hash="160444b5a61c1e71f39825a01936237f"><span class=en-original lang=en>If this fails, throw a <code>SYNTAX_ERR</code>
1923     exception.</span><span class=ja-translation lang=ja>これが失敗した場合、 <code>SYNTAX_ERR</code>
1924     例外を投げます。</span></li>
1925    
1926     <li>
1927    
1928     <p class="no-ja-translation" data-ja-hash="f1c13da982ef60bb9a5ea38a82a62f88"><span class=en-original lang=en>If the <span>origin</span> of the resulting <span>absolute
1929     URL</span> is not the <span title="same origin">same</span> as the
1930     origin of the <span>entry script</span>, then throw a
1931     <code>SECURITY_ERR</code> exception.</span></p>
1932    
1933     <p class="note no-ja-translation" data-ja-hash="70778ef58116d00717c7dad6522d3d5b"><span class=en-original lang=en>Thus, scripts must be external files with the same
1934     scheme as the original page: you can't load a script from a <code title="">data:</code> URL or <code title="">javascript:</code>
1935     URL, and a <code>https:</code> page couldn't start workers using
1936     scripts with <code>http:</code> URLs.</span></p>
1937    
1938     </li>
1939    
1940     <li><p class="no-ja-translation" data-ja-hash="b392f10dceda3976231944259f9a7b7c"><span class=en-original lang=en>Create a new <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
1941     object. Let <var title="">worker global scope</var> be this new
1942     object.</span></li>
1943    
1944     <li><p class="no-ja-translation" data-ja-hash="5f11902e2367f64698f9d31e03a9d235"><span class=en-original lang=en>Create a new <code><a href=#worker>Worker</a></code> object, associated with
1945     <var title="">worker global scope</var>. Let <var title="">worker</var> be this new object.</span></li>
1946    
1947     <li><p class="no-ja-translation" data-ja-hash="3d6f94d7c2eda8b4bc887b5ceebb149c"><span class=en-original lang=en><span>Create a new <code>MessagePort</code> object</span>
1948     owned by the <span title="script's global object">global
1949     object</span> of the <span title=concept-script>script</span> that
1950     invoked the constructor. Let this be the <var title="">outside
1951     port</var>.</span></li>
1952    
1953     <li><p class="has-ja-translation" data-ja-hash="91024eaaebdc23ea683ace1b3e316962"><span class=en-original lang=en>Associate the <var title="">outside port</var> with <var title="">worker</var>.</span><span class=ja-translation lang=ja><var title="">outside port</var> を <var
1954     title="">worker</var> に関連付けます。</span></li>
1955    
1956     <li><p class="no-ja-translation" data-ja-hash="ae14e6a50adfe4e71fcf797d1d85a932"><span class=en-original lang=en><span>Create a new <code>MessagePort</code> object</span>
1957     owned by <var title="">worker global scope</var>. Let <var title="">inside port</var> be this new object.</span></li>
1958    
1959     <li><p class="no-ja-translation" data-ja-hash="c7df111ebbfeab4bffdbe80d19fdb0ba"><span class=en-original lang=en>Associate <var title="">inside port</var> with <var title="">worker global scope</var>.</span></li>
1960    
1961     <li><p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var> and
1962     <var title="">inside port</var>.</span></li>
1963    
1964     <li><p class="has-ja-translation" data-ja-hash="2c5bd80faeda34c67a2533f32a477c51"><span class=en-original lang=en>Return <var title="">worker</var>, and run the following
1965     steps asynchronously.</span><span class=ja-translation lang=ja><var title="">worker</var> を返し、以降の段階を非同期に走らせます。</span></li>
1966    
1967     <!-- (this is done by the "run a worker" algorithm)
1968     <li><p class="no-ja-translation" data-ja-hash="486f13bccfc4521d81f95f8a83a34838"><span class=en-original lang=en>Enable <var title="">inside port</var>'s <span>port message
1969     queue</span>.</span></p></li>
1970     -->
1971    
1972     <li><p class="no-ja-translation" data-ja-hash="f226f14fb6f714ae0ebb2e1d19b80cb0"><span class=en-original lang=en>Enable <var title="">outside port</var>'s <span>port message
1973     queue</span>.</span></li>
1974    
1975     <li>
1976    
1977     <p class="no-ja-translation" data-ja-hash="dab9ec1fa195098f1e7d5e38d441a463"><span class=en-original lang=en>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant
1978     <code>Document</code> objects to add</a> given the <span title="script's global object">global object</span> of the <span title=concept-script>script</span> that invoked the
1979     constructor.</span></p>
1980    
1981     </li>
1982    
1983     <li>
1984    
1985     <p class="no-ja-translation" data-ja-hash="55e64a61fc96598db79195cddb4bb2f9"><span class=en-original lang=en><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to
1986     <var title="">worker global scope</var>'s list of <span>the
1987     worker's <code>Document</code>s</span></a> the
1988     <code>Document</code> objects in <var title="">docs</var>.</span></p>
1989    
1990     </li>
1991    
1992     <li>
1993    
1994     <p class="no-ja-translation" data-ja-hash="9a188536e5d8b8e9cc5c77a63925e694"><span class=en-original lang=en>If the <span title="script's global object">global object</span>
1995     of the <span title=concept-script>script</span> that invoked the
1996     constructor is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we
1997     are creating a nested worker), add <var title="">worker global
1998     scope</var> to the list of <a href="#the-worker's-workers">the worker's workers</a> of the
1999     <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <span title="script's global object">global object</span> of the <span title=concept-script>script</span> that invoked the
2000     constructor.</span></p>
2001    
2002     </li>
2003    
2004     <li>
2005    
2006 wakaba 1.222 <p class="no-ja-translation" data-ja-hash="ead0e0f34d02b59a6ef1912157ede7e7"><span class=en-original lang=en><a href=#run-a-worker>Run a worker</a> for the resulting <span>absolute
2007 wakaba 1.219 URL</span>, with the <span>script's browsing context</span> of the
2008     script that invoked the method as the <var title="">owner browsing
2009 wakaba 1.222 context</var>, with the <span>script's document</span> of the
2010     script that invoked the method as the <var title="">owner
2011     document</var>, with the <span>origin</span> of the <span>entry
2012 wakaba 1.219 script</span> as the <var title="">owner origin</var>, and with
2013     <var title="">worker global scope</var> as the global scope.</span></p>
2014    
2015     </li>
2016    
2017     </ol><p class="no-ja-translation" data-ja-hash="94265ba37e7269c66945feab30dadb0a"><span class=en-original lang=en>This constructor must be visible when the <span>script's global
2018     object</span> is either a <code>Window</code> object or an object
2019     implementing the <code><a href=#workerutils>WorkerUtils</a></code> interface.</span></p>
2020    
2021    
2022     <h4 id=shared-workers-and-the-sharedworker-interface class="no-ja-translation" data-ja-hash="3b77b75af8223662d0137a2dd84957ab"><span class=en-original lang=en><span class=secno>4.7.3 </span>Shared workers and the <code><a href=#sharedworker>SharedWorker</a></code> interface</span></h4>
2023    
2024     <pre class="idl no-ja-translation" data-ja-hash="57ade46d2bc0f3d25861d8bc666cfa38"><span class=en-original lang=en>[<a href=#dom-sharedworker title=dom-SharedWorker>Constructor</a>(in DOMString scriptURL, in optional DOMString name)]
2025     interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#abstractworker>AbstractWorker</a> {
2026     readonly attribute <span>MessagePort</span> <a href=#dom-sharedworker-port title=dom-SharedWorker-port>port</a>;
2027     };</span></pre>
2028    
2029     <p class="no-ja-translation" data-ja-hash="5cf4affd83f6594d8f8bc1a32f68ab35"><span class=en-original lang=en>The <dfn id=dom-sharedworker-port title=dom-SharedWorker-port><code>port</code></dfn>
2030     attribute must return the value it was assigned by the object's
2031     constructor. It represents the <code>MessagePort</code> for
2032     communicating with the shared worker.</span></p>
2033    
2034     <p class="no-ja-translation" data-ja-hash="a0ab2a2723152011df53c0fc544b493b"><span class=en-original lang=en>When the <dfn id=dom-sharedworker title=dom-SharedWorker><code>SharedWorker(<var title="">scriptURL</var>, <var title="">name</var>)</code></dfn>
2035     constructor is invoked, the user agent must run the following
2036     steps:</span></p>
2037    
2038     <ol><li><p class="has-ja-translation" data-ja-hash="3219e42f1040482201a693e248f580cb"><span class=en-original lang=en><span title="resolve a url">Resolve</span> the <var title="">scriptURL</var> argument.</span><span class=ja-translation lang=ja><var
2039     title="">scriptURL</var> 引数を<span title="resolve a url">解決</span>します。</span></li>
2040    
2041     <li><p class="has-ja-translation" data-ja-hash="160444b5a61c1e71f39825a01936237f"><span class=en-original lang=en>If this fails, throw a <code>SYNTAX_ERR</code>
2042     exception.</span><span class=ja-translation lang=ja>これが失敗した場合、 <code>SYNTAX_ERR</code>
2043     例外を投げます。</span></li>
2044    
2045     <li><p class="no-ja-translation" data-ja-hash="a0b3d695bae7e2ce874ab6966d7aa86b"><span class=en-original lang=en>Otherwise, let <var title="">scriptURL</var> be the
2046     resulting <span>absolute URL</span>.</span></li>
2047    
2048     <li><p class="no-ja-translation" data-ja-hash="8a0ad4f3e4cdc7bb4c8643040fc02e97"><span class=en-original lang=en>Let <var title="">name</var> be the value of the second
2049     argument, or the empty string if the second argument was
2050     omitted.</span></li>
2051    
2052     <li>
2053    
2054     <p class="no-ja-translation" data-ja-hash="9f29594d6617ebe74034d0cbcc854789"><span class=en-original lang=en>If the <span>origin</span> of <var title="">scriptURL</var> is
2055     not the <span title="same origin">same</span> as the origin of the
2056     <span>entry script</span>, then throw a <code>SECURITY_ERR</code>
2057     exception.</span></p>
2058    
2059     <p class="note no-ja-translation" data-ja-hash="70778ef58116d00717c7dad6522d3d5b"><span class=en-original lang=en>Thus, scripts must be external files with the same
2060     scheme as the original page: you can't load a script from a <code title="">data:</code> URL or <code title="">javascript:</code>
2061     URL, and a <code>https:</code> page couldn't start workers using
2062     scripts with <code>http:</code> URLs.</span></p>
2063    
2064     </li>
2065    
2066     <li>
2067    
2068     <p class="no-ja-translation" data-ja-hash="dab9ec1fa195098f1e7d5e38d441a463"><span class=en-original lang=en>Let <var title="">docs</var> be the <a href=#list-of-relevant-document-objects-to-add>list of relevant
2069     <code>Document</code> objects to add</a> given the <span title="script's global object">global object</span> of the <span title=concept-script>script</span> that invoked the
2070     constructor.</span></p>
2071    
2072     </li>
2073    
2074     <li>
2075    
2076     <p class="has-ja-translation" data-ja-hash="683a2c0080e014b9eae98b884ccaf7e4"><span class=en-original lang=en>Execute the following substeps atomically:</span><span class=ja-translation lang=ja>次の部分段階群を原子的に実行します。</span></p>
2077    
2078     <ol><li><p class="no-ja-translation" data-ja-hash="b38ef0f6a7b346d45c984332a0b8776d"><span class=en-original lang=en>Create a new <code><a href=#sharedworker>SharedWorker</a></code> object, which will
2079     shortly be associated with a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
2080     object. Let this <code><a href=#sharedworker>SharedWorker</a></code> object be <var title="">worker</var>.</span></li>
2081    
2082     <li><p class="no-ja-translation" data-ja-hash="a40ab4e22ea2b3e796d21eb952647b7c"><span class=en-original lang=en><span>Create a new <code>MessagePort</code> object</span>
2083     owned by the <span title="script's global object">global
2084     object</span> of the script that invoked the method. Let this be
2085     the <var title="">outside port</var>.</span></li>
2086    
2087     <li><p class="no-ja-translation" data-ja-hash="2945bc791092fa6a9100ef8df34f4c10"><span class=en-original lang=en>Assign <var title="">outside port</var> to the <code title=dom-SharedWorker-port><a href=#dom-sharedworker-port>port</a></code> attribute of <var title="">worker</var>.</span></li>
2088    
2089     <li><p class="no-ja-translation" data-ja-hash="bf1807a565bd680ac1131e8903499e6c"><span class=en-original lang=en>Let <var title="">worker global scope</var> be
2090     null.</span></li>
2091    
2092     <li><p class="no-ja-translation" data-ja-hash="48d19fa2bb17053a97267718abc71c9f"><span class=en-original lang=en>If <var title="">name</var> is not the empty string and
2093     there exists a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose
2094     <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag
2095     is false, whose <code title=dom-WorkerGlobalScope-name>name</code> attribute is
2096     exactly equal to <var title="">name</var>, and whose <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute
2097     represents an <span>absolute URL</span> with the <span>same
2098     origin</span> as <var title="">scriptURL</var>, then let <var title="">worker global scope</var> be that
2099     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</span></li>
2100    
2101 wakaba 1.226 <li><p class="no-ja-translation" data-ja-hash="1673be30eb28d9f30115a45bb560a045"><span class=en-original lang=en>Otherwise, if <var title="">name</var> is the empty string
2102 wakaba 1.219 and there exists a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object
2103     whose <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a>
2104     flag is false, and whose <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute
2105 wakaba 1.226 represents an <span>absolute URL</span> that is exactly equal to
2106     <var title="">scriptURL</var>, then let <var title="">worker
2107     global scope</var> be that <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
2108     object.</span></li>
2109 wakaba 1.219
2110     <li>
2111    
2112     <p class="no-ja-translation" data-ja-hash="f49b52bc5df237a2451163ce09a7d8b0"><span class=en-original lang=en>If <var title="">worker global scope</var> is not null, then
2113     run these steps:</span></p>
2114    
2115     <ol><li><p class="no-ja-translation" data-ja-hash="c93c344ad574dd1e037e0c9fd4bdbc24"><span class=en-original lang=en>If <var title="">worker global scope</var>'s <code title=dom-WorkerGlobalScope-location><a href=#dom-workerglobalscope-location>location</a></code>
2116     attribute represents an <span>absolute URL</span> that is not
2117     exactly equal to <var title="">scriptURL</var>, then throw a
2118     <code>URL_MISMATCH_ERR</code> exception and abort all these
2119     steps.</span></li>
2120    
2121     <li><p class="has-ja-translation" data-ja-hash="9c4f87efaa1e868cd6bf63dbffa749c0"><span class=en-original lang=en>Associate <var title="">worker</var> with <var title="">worker global scope</var>.</span><span class=ja-translation lang=ja><var title="">worker</var> を <var title="">worker
2122     global scope</var> に関連付けます。</span></li>
2123    
2124     <li><p class="no-ja-translation" data-ja-hash="5b7cbe1ac8349480ae8c41d8efaa050a"><span class=en-original lang=en><span>Create a new <code>MessagePort</code>
2125     object</span> owned by <var title="">worker global
2126     scope</var>. Let this be the <var title="">inside
2127     port</var>.</span></li>
2128    
2129     <li><p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var>
2130     and <var title="">inside port</var>.</span></li>
2131    
2132     <li><p class="has-ja-translation" data-ja-hash="ebb713e9e29aab450d79b533c42b67ae"><span class=en-original lang=en>Return <var title="">worker</var> and perform the next
2133     step asynchronously.</span><span class=ja-translation lang=ja><var title="">worker</var> を返し、
2134     次の段階を非同期に実行します。</span></li>
2135    
2136     <li><p class="no-ja-translation" data-ja-hash="54fc802e5e886ae34c575b12f00dfb03"><span class=en-original lang=en>Create an event that uses the <code>MessageEvent</code>
2137     interface, with the name <code title=event-connect>connect</code>, which does not bubble, is
2138     not cancelable, has no default action, has a <code title=dom-MessageEvent-data>data</code> attribute whose value
2139     is the empty string and has a <code title=dom-MessageEvent-ports>ports</code> attribute whose
2140     value is an array containing only the newly created port, and
2141     <span>queue a task</span> to dispatch the event at <var title="">worker global scope</var>.</span></li>
2142    
2143     <li>
2144    
2145     <p class="no-ja-translation" data-ja-hash="55e64a61fc96598db79195cddb4bb2f9"><span class=en-original lang=en><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to
2146     <var title="">worker global scope</var>'s list of <span>the
2147     worker's <code>Document</code>s</span></a> the
2148     <code>Document</code> objects in <var title="">docs</var>.</span></p>
2149    
2150     </li>
2151    
2152     <li>
2153    
2154     <p class="no-ja-translation" data-ja-hash="2d253ff4e0bff2c52fd5f6b3e8561ce9"><span class=en-original lang=en>If the <span title="script's global object">global
2155     object</span> of the <span title=concept-script>script</span>
2156     that invoked the constructor is a
2157     <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the
2158     worker's workers</a> of the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>
2159     object that is the <span title="script's global object">global
2160     object</span> of the <span title=concept-script>script</span>
2161     that invoked the constructor.</span></p>
2162    
2163     </li>
2164    
2165     <li><p class="has-ja-translation" data-ja-hash="dd866391287c967d4799df78a7249911"><span class=en-original lang=en>Abort all these steps.</span><span class=ja-translation lang=ja>これらの段階をすべて停止します。</span></li>
2166    
2167     </ol></li>
2168    
2169     <li><p class="no-ja-translation" data-ja-hash="653796a1cbceebf593bdf3b42c13fab4"><span class=en-original lang=en>Create a new <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
2170     object. Let <var title="">worker global scope</var> be this new
2171     object.</span></li>
2172    
2173     <li><p class="has-ja-translation" data-ja-hash="9c4f87efaa1e868cd6bf63dbffa749c0"><span class=en-original lang=en>Associate <var title="">worker</var> with <var title="">worker global scope</var>.</span><span class=ja-translation lang=ja><var title="">worker</var> を <var title="">worker
2174     global scope</var> に関連付けます。</span></li>
2175    
2176     <li><p class="no-ja-translation" data-ja-hash="5197138b23b238d1ca44cd6260532c5d"><span class=en-original lang=en>Set the <code title=dom-SharedWorkerGlobalScope-name><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute of
2177     <var title="">worker global scope</var> to <var title="">name</var>.</span></li>
2178    
2179     <li><p class="no-ja-translation" data-ja-hash="ae14e6a50adfe4e71fcf797d1d85a932"><span class=en-original lang=en><span>Create a new <code>MessagePort</code> object</span>
2180     owned by <var title="">worker global scope</var>. Let <var title="">inside port</var> be this new object.</span></li>
2181    
2182     <li><p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var> and
2183     <var title="">inside port</var>.</span></li>
2184    
2185     </ol></li>
2186    
2187     <li><p class="no-ja-translation" data-ja-hash="8383fd384ab33b4860228f2c27483044"><span class=en-original lang=en>Return <var title="">worker</var> and perform the remaining
2188     steps asynchronously.</span></li>
2189    
2190     <li><p class="no-ja-translation" data-ja-hash="54fc802e5e886ae34c575b12f00dfb03"><span class=en-original lang=en>Create an event that uses the <code>MessageEvent</code>
2191     interface, with the name <code title=event-connect>connect</code>, which does not bubble, is not
2192     cancelable, has no default action, has a <code title=dom-MessageEvent-data>data</code> attribute whose value is
2193     the empty string and has a <code title=dom-MessageEvent-ports>ports</code> attribute whose value
2194     is an array containing only the newly created port, and <span>queue
2195     a task</span> to dispatch the event at <var title="">worker global
2196     scope</var>.</span></li>
2197    
2198     <li>
2199    
2200     <p class="no-ja-translation" data-ja-hash="55e64a61fc96598db79195cddb4bb2f9"><span class=en-original lang=en><a href="#add-a-document-to-the-worker's-documents" title="add a document to the worker's documents">Add to
2201     <var title="">worker global scope</var>'s list of <span>the
2202     worker's <code>Document</code>s</span></a> the
2203     <code>Document</code> objects in <var title="">docs</var>.</span></p>
2204    
2205     </li>
2206    
2207     <li>
2208    
2209     <p class="no-ja-translation" data-ja-hash="2d253ff4e0bff2c52fd5f6b3e8561ce9"><span class=en-original lang=en>If the <span title="script's global object">global object</span>
2210     of the <span title=concept-script>script</span> that invoked the
2211     constructor is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var title="">worker global scope</var> to the list of <a href="#the-worker's-workers">the
2212     worker's workers</a> of the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>
2213     object that is the <span title="script's global object">global
2214     object</span> of the <span title=concept-script>script</span>
2215     that invoked the constructor.</span></p>
2216    
2217     </li>
2218    
2219     <li>
2220    
2221 wakaba 1.222 <p class="no-ja-translation" data-ja-hash="a40c90f04d00dd67af7ffaa840c82cc4"><span class=en-original lang=en><a href=#run-a-worker>Run a worker</a> for <var title="">scriptURL</var>,
2222 wakaba 1.219 with the <span>script's browsing context</span> of the script that
2223     invoked the method as the <var title="">owner browsing
2224 wakaba 1.222 context</var>, with the <span>script's document</span> of the
2225     script that invoked the method as the <var title="">owner
2226     document</var>, with the <span>origin</span> of the <span>entry
2227 wakaba 1.219 script</span> as the <var title="">owner origin</var>, and with
2228     <var title="">worker global scope</var> as the global scope.</span></p>
2229    
2230     </li>
2231    
2232     </ol><p class="no-ja-translation" data-ja-hash="94265ba37e7269c66945feab30dadb0a"><span class=en-original lang=en>This constructor must be visible when the <span>script's global
2233     object</span> is either a <code>Window</code> object or an object
2234     implementing the <code><a href=#workerutils>WorkerUtils</a></code> interface.</span></p>
2235    
2236     <p class="no-ja-translation" data-ja-hash="232ca3945fb57a3baa9cc0675ff99caa"><span class=en-original lang=en>The <span>task source</span> for the tasks mentioned above is the
2237     <span>DOM manipulation task source</span>.</span></p>
2238    
2239    
2240    
2241     <h2 id=apis-available-to-workers class="has-ja-translation" data-ja-hash="4fce100e6a2eccbb2df8631a438feeb6"><span class=en-original lang=en><span class=secno>5 </span>APIs available to workers</span><span class=ja-translation lang=ja><span class=secno>5 </span>労働者が利用可能な API</span></h2>
2242    
2243     <pre class="idl no-ja-translation" data-ja-hash="30d32a60b3b93cd3d0c6a32d9338b2ee"><span class=en-original lang=en>[Supplemental, NoInterfaceObject]
2244     interface <dfn id=workerutils>WorkerUtils</dfn> {
2245     void <a href=#dom-workerglobalscope-importscripts title=dom-WorkerGlobalScope-importScripts>importScripts</a>(in DOMString... urls);
2246     readonly attribute <a href=#workernavigator>WorkerNavigator</a> <a href=#dom-worker-navigator title=dom-worker-navigator>navigator</a>;
2247     };
2248     <a href=#workerutils>WorkerUtils</a> implements <span>WindowTimers</span>;</span></pre>
2249    
2250     <p class="has-ja-translation" data-ja-hash="59b28734296c1cd390d156b0e8e5fb94"><span class=en-original lang=en>The DOM APIs (<code>Node</code> objects, <code>Document</code>
2251     objects, etc) are not available to workers in this version of this
2252     specification.</span><span class=ja-translation lang=ja>DOM API (<code>Node</code> オブジェクト、 <code>Document</code>
2253     オブジェクト、その他) は、この版のこの仕様書では労働者に利用可能ではありません。</span></p>
2254    
2255    
2256     <h3 id=importing-scripts-and-libraries class="has-ja-translation" data-ja-hash="e7522d998689dc52be80feeff81470ca"><span class=en-original lang=en><span class=secno>5.1 </span>Importing scripts and libraries</span><span class=ja-translation lang=ja><span class=secno>5.1 </span>スクリプトとライブラリーの輸入</span></h3>
2257    
2258     <p class="no-ja-translation" data-ja-hash="66975403bb279c95f3527e7070d78341"><span class=en-original lang=en>When a script invokes the <dfn id=dom-workerglobalscope-importscripts title=dom-WorkerGlobalScope-importScripts><code>importScripts(<var title="">urls</var>)</code></dfn> method on a
2259     <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user agent must run the
2260     following steps:</span></p>
2261    
2262     <ol><li><p class="has-ja-translation" data-ja-hash="143a8bb07f4501807d2bbf2d2d2b345a"><span class=en-original lang=en>If there are no arguments, return without doing
2263     anything. Abort these steps.</span><span class=ja-translation lang=ja>引数がない場合、何も返さずに返ります。
2264     これらの段階を停止します。</span></li>
2265    
2266     <li><p class="has-ja-translation" data-ja-hash="b89818b453add85fbb5ec1e963e3072c"><span class=en-original lang=en><span title="resolve a url">Resolve</span> each
2267     argument.</span><span class=ja-translation lang=ja>各引数を<span title="resolve a url">解決</span>します。</span></li>
2268    
2269     <li><p class="has-ja-translation" data-ja-hash="54adea3a3a07dd8833ad87eb937142f1"><span class=en-original lang=en>If any fail, throw a <code>SYNTAX_ERR</code>
2270     exception.</span><span class=ja-translation lang=ja>いずれかが失敗した場合、 <code>SYNTAX_ERR</code> 例外を投げます。</span></li>
2271    
2272     <!--
2273     <li><p class="no-ja-translation" data-ja-hash="3f4c7fcccf773ea7c33a97ca9820c400"><span class=en-original lang=en>If any of the resulting <span title="absolute URL">absolute
2274     URLs</span> have an <span>origin</span> that is not the <span
2275     title="same origin">same</span> as the origin of the script that
2276     invoked the method, then throw a <code>SECURITY_ERR</code>
2277     exception.</span></p></li>
2278     -->
2279    
2280     <li>
2281    
2282     <p class="no-ja-translation" data-ja-hash="084a0643b126c576729e78d91bb57531"><span class=en-original lang=en>Attempt to <span>fetch</span> each resource identified by the
2283     resulting <span title="absolute URL">absolute URLs</span>, from
2284     the <span>entry script</span>'s <span>origin</span>.</span></p> <!-- not
2285     http-origin privacy sensitive -->
2286    
2287     </li>
2288    
2289     <li>
2290    
2291     <p class="has-ja-translation" data-ja-hash="4fc5f1898eb20e4c8da603b91c1ae884"><span class=en-original lang=en>For each argument in turn, in the order given, starting with
2292     the first one, run these substeps:</span><span class=ja-translation lang=ja>各引数について、与えられた順に最初のものから、次の部分段階群を走らせます。</span></p>
2293    
2294     <ol><li>
2295    
2296     <p class="has-ja-translation" data-ja-hash="a5cd8fb5d75985afdc62f7ac228329d4"><span class=en-original lang=en>Wait for the fetching attempt for the corresponding resource
2297     to complete.</span><span class=ja-translation lang=ja>対応する資源を取得しようとする試みが完了するのを待ちます。</span></p>
2298    
2299     <p class="no-ja-translation" data-ja-hash="c821b5a32a4316df06e95e2117d4d21a"><span class=en-original lang=en>If the fetching attempt failed, throw a
2300     <code>NETWORK_ERR</code> exception and abort all these
2301     steps.</span></p>
2302    
2303     <p class="no-ja-translation" data-ja-hash="f1667590dddc3f064bc292826b67f086"><span class=en-original lang=en>If the attempt succeeds, then convert the script resource to
2304     Unicode by assuming it was encoded as UTF-8, to obtain its <var title="">source</var>.</span></p>
2305    
2306     <p class="no-ja-translation" data-ja-hash="c880bce97c5a1aadccd8989fc4ec8551"><span class=en-original lang=en>Let <var title="">language</var> be JavaScript.</span></p>
2307    
2308     <p class="note has-ja-translation" data-ja-hash="9d495d7b0fa2439cfa3470c4af977171"><span class=en-original lang=en>As with the worker's script, the script here is
2309     always assumed to be JavaScript, regardless of the MIME
2310     type.</span><span class=ja-translation lang=ja>労働者のスクリプトと同じく、ここでのスクリプトも、 MIME 型に関わらず常に
2311     JavaScript であるとみなします。</span></p>
2312    
2313     </li>
2314    
2315     <li>
2316    
2317     <p class="no-ja-translation" data-ja-hash="179ad45b4312a1c3d9dc05a48b1d17a6"><span class=en-original lang=en><span>Create a script</span>, using <var title="">source</var> as the script source and <var title="">language</var> as the scripting language, using the
2318     same global object, browsing context, URL character encoding,
2319     base URL, and script group as the <span title=concept-script>script</span> that was created by the
2320     worker's <a href=#run-a-worker>run a worker</a> algorithm.</span></p>
2321    
2322     <p class="no-ja-translation" data-ja-hash="160451bccc2829032bdfb4597231e9c2"><span class=en-original lang=en>Let the newly created <span title=concept-script>script</span> run until it either
2323     returns, fails to parse, fails to catch an exception, or gets
2324     prematurely aborted by the "<a href=#kill-a-worker>kill a worker</a>" or
2325     "<a href=#terminate-a-worker>terminate a worker</a>" algorithms defined above.</span></p>
2326    
2327     <p class="no-ja-translation" data-ja-hash="af201997a3ef245c7e267b8f6206d3a2"><span class=en-original lang=en>If it failed to parse, then throw an ECMAScript
2328     <code>SyntaxError</code> exception and abort all these
2329     steps. <a href=#refsECMA262>[ECMA262]</a></span></p>
2330    
2331     <p class="no-ja-translation" data-ja-hash="32f753089621a99745d3a6dde7c5aa8b"><span class=en-original lang=en>If an exception was raised or if the script was prematurely
2332     aborted, then abort all these steps, letting the exception or
2333     aborting continue to be processed by the script that called the
2334     <code title=dom-WorkerGlobalScope-importScripts><a href=#dom-workerglobalscope-importscripts>importScripts()</a></code>
2335     method.</span></p>
2336    
2337     <p class="no-ja-translation" data-ja-hash="f41de43eedf5733455078779b5f50c14"><span class=en-original lang=en>If the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a
2338     worker</a>" algorithms abort the script then abort all these
2339     steps.</span></p>
2340    
2341     </li>
2342    
2343     </ol></li>
2344    
2345     </ol><h3 id=the-workernavigator-object class="no-ja-translation" data-ja-hash="598e5eccb0b57894677b8fa67d4368c6"><span class=en-original lang=en><span class=secno>5.2 </span>The <code><a href=#workernavigator>WorkerNavigator</a></code> object</span></h3>
2346    
2347     <p class="no-ja-translation" data-ja-hash="c7055d2e97a36583e792723acbe528ed"><span class=en-original lang=en>The <dfn id=dom-worker-navigator title=dom-worker-navigator><code>navigator</code></dfn> attribute
2348     of the <code><a href=#workerutils>WorkerUtils</a></code> interface must return an instance of
2349     the <code><a href=#workernavigator>WorkerNavigator</a></code> interface, which represents the
2350     identity and state of the user agent (the client):</span></p>
2351    
2352     <pre class="idl no-ja-translation" data-ja-hash="5bd0c913346992443814f8f9af6a487a"><span class=en-original lang=en>interface <dfn id=workernavigator>WorkerNavigator</dfn> {};
2353     <a href=#workernavigator>WorkerNavigator</a> implements <span>NavigatorID</span>;
2354     <a href=#workernavigator>WorkerNavigator</a> implements <span>NavigatorOnLine</span>;</span></pre>
2355    
2356     <p class="no-ja-translation" data-ja-hash="4fb6122bda03d401ae83f1b9ea420445"><span class=en-original lang=en>Objects implementing the <code><a href=#workernavigator>WorkerNavigator</a></code> interface
2357     also implement the <code>NavigatorID</code> and
2358     <code>NavigatorOnLine</code> interfaces.
2359    
2360     <a href=#refsHTML>[HTML]</a>
2361    
2362     </span></p>
2363    
2364     <p class="no-ja-translation" data-ja-hash="7329ca0ae9fe31ac47218d7ac49a48cf"><span class=en-original lang=en>This <code><a href=#workernavigator>WorkerNavigator</a></code> interface must not exist if the
2365     interface's <span>relevant namespace object</span> is a
2366     <code>Window</code> object. <a href=#refsWEBIDL>[WEBIDL]</a></span></p>
2367    
2368    
2369    
2370     <h3 id=apis-defined-in-other-specifications class="has-ja-translation" data-ja-hash="d6d6885373ce92bfa8857f5a375a9c8f"><span class=en-original lang=en><span class=secno>5.3 </span>APIs defined in other specifications</span><span class=ja-translation lang=ja><span class=secno>5.3 </span>他の仕様書で定義されている API</span></h3>
2371    
2372     <p class="no-ja-translation" data-ja-hash="7a38b8c533febc1df242595b4de0113d"><span class=en-original lang=en>The <code title=dom-opendatabase>openDatabase()</code> and
2373     <code title=dom-opendatabase-sync>openDatabaseSync()</code>
2374     methods are defined in the Web SQL Database specification. <a href=#refsWEBSQL>[WEBSQL]</a></span></p>
2375    
2376    
2377    
2378     <h3 id=interface-objects-and-constructors class="has-ja-translation" data-ja-hash="78e75b89c304218ef77a66cd9efdf398"><span class=en-original lang=en><span class=secno>5.4 </span>Interface objects and constructors</span><span class=ja-translation lang=ja><span class=secno>5.4 </span>界面オブジェクトと構築器</span></h3>
2379    
2380     <p class="no-ja-translation" data-ja-hash="be8e99febe2a5427ef9832c85c13da0e"><span class=en-original lang=en>There must be no interface objects and constructors available in
2381     the global scope of scripts whose <span>script's global
2382     object</span> is a <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object except for
2383     the following:</span></p>
2384    
2385     <ul><li><p class="no-ja-translation" data-ja-hash="a8f4727ef88dc7955f089bfa420d3c65"><span class=en-original lang=en><code>XMLHttpRequest</code> and all interface objects and
2386     constructors defined by the XMLHttpRequest specifications, except
2387     that the <span>document response entity body</span> must always be
2388     null. The <span><code>XMLHttpRequest</code> base URL</span> is the
2389     <span>script's base URL</span>; the
2390     <span><code>XMLHttpRequest</code> origin</span> is the script's
2391     <span>origin</span>. <a href=#refsXHR>[XHR]</a></span></li>
2392    
2393     <li><p class="no-ja-translation" data-ja-hash="84d1d0bbb1868e6785d0557b217c792a"><span class=en-original lang=en>The interface objects and constructors defined by this
2394     specification.</span></li>
2395    
2396     <li><p class="no-ja-translation" data-ja-hash="16842d6b927b98a5c14e320045f6a03c"><span class=en-original lang=en>Constructors defined by specifications that explicitly say
2397     that they should be visible when the <span>script's global
2398     object</span> is a <code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>, a
2399     <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>, or an object implementing the
2400     <code><a href=#workerutils>WorkerUtils</a></code> interface; the interfaces of any objects
2401     with such constructors; and the interfaces of any objects made
2402     accessible through APIs exposed by those constructors or made
2403     accessible through interfaces to be implemented by any objects that
2404     are themselves accessible to scripts whose <span>script's global
2405     object</span> implements the <code><a href=#workerutils>WorkerUtils</a></code>
2406     interface.</span></li>
2407    
2408     </ul><p class="note no-ja-translation" data-ja-hash="f1fa4c80358ffead3b2abc663c92d283"><span class=en-original lang=en>These requirements do not override the requirements
2409     defined by the Web IDL specification, in particular concerning the
2410     visibility of interfaces annotated with the <code title="">[NoInterfaceObject]</code> extended attribute.</span></p>
2411    
2412    
2413     <h3 id=worker-locations class="has-ja-translation" data-ja-hash="ae4aa0f882fcbd2ee8252e59113ec205"><span class=en-original lang=en><span class=secno>5.5 </span>Worker locations</span><span class=ja-translation lang=ja><span class=secno>5.5 </span>労働者の所在</span></h3>
2414    
2415     <pre class="idl no-ja-translation" data-ja-hash="8d12e26ffacf32cd9d10364c0255ab53"><span class=en-original lang=en>interface <dfn id=workerlocation>WorkerLocation</dfn> {
2416     readonly attribute DOMString <a href=#dom-workerlocation-href title=dom-WorkerLocation-href>href</a>;
2417     readonly attribute DOMString <a href=#dom-workerlocation-protocol title=dom-WorkerLocation-protocol>protocol</a>;
2418     readonly attribute DOMString <a href=#dom-workerlocation-host title=dom-WorkerLocation-host>host</a>;
2419     readonly attribute DOMString <a href=#dom-workerlocation-hostname title=dom-WorkerLocation-hostname>hostname</a>;
2420     readonly attribute DOMString <a href=#dom-workerlocation-port title=dom-WorkerLocation-port>port</a>;
2421     readonly attribute DOMString <a href=#dom-workerlocation-pathname title=dom-WorkerLocation-pathname>pathname</a>;
2422     readonly attribute DOMString <a href=#dom-workerlocation-search title=dom-WorkerLocation-search>search</a>;
2423     readonly attribute DOMString <a href=#dom-workerlocation-hash title=dom-WorkerLocation-hash>hash</a>;
2424     };</span></pre>
2425    
2426     <p class="no-ja-translation" data-ja-hash="0875217b900933e0434228878aa70bb1"><span class=en-original lang=en>A <code><a href=#workerlocation>WorkerLocation</a></code> object represents an <span>absolute
2427     URL</span> set at its creation.</span></p>
2428    
2429     <p class="no-ja-translation" data-ja-hash="12d68ceea5131e0a3f4acc5b2060ee25"><span class=en-original lang=en>The <dfn id=dom-workerlocation-href title=dom-WorkerLocation-href><code>href</code></dfn>
2430     attribute must return the <span>absolute URL</span> that the object
2431     represents.</span></p>
2432    
2433     <p class="no-ja-translation" data-ja-hash="041b422299d9ee81c2c7f6da53029647"><span class=en-original lang=en>The <code><a href=#workerlocation>WorkerLocation</a></code> interface also has the complement
2434     of <span>URL decomposition IDL attributes</span>, <dfn id=dom-workerlocation-protocol title=dom-WorkerLocation-protocol><code>protocol</code></dfn>,
2435     <dfn id=dom-workerlocation-host title=dom-WorkerLocation-host><code>host</code></dfn>, <dfn id=dom-workerlocation-port title=dom-WorkerLocation-port><code>port</code></dfn>, <dfn id=dom-workerlocation-hostname title=dom-WorkerLocation-hostname><code>hostname</code></dfn>,
2436     <dfn id=dom-workerlocation-pathname title=dom-WorkerLocation-pathname><code>pathname</code></dfn>,
2437     <dfn id=dom-workerlocation-search title=dom-WorkerLocation-search><code>search</code></dfn>,
2438     and <dfn id=dom-workerlocation-hash title=dom-WorkerLocation-hash><code>hash</code></dfn>. These must
2439     follow the rules given for URL decomposition IDL attributes, with the
2440     <span title=concept-uda-input>input</span> being the
2441     <span>absolute URL</span> that the object represents (same as the
2442     <code title=dom-WorkerLocation-href><a href=#dom-workerlocation-href>href</a></code> attribute), and
2443     the <span title=concept-uda-setter>common setter action</span>
2444     being a no-op, since the attributes are defined to be readonly.
2445    
2446     <a href=#refsHTML>[HTML]</a>
2447    
2448     </span></p>
2449    
2450     <p class="no-ja-translation" data-ja-hash="aec7b7de7c3e78e1e158f6819d00fe0e"><span class=en-original lang=en>The <code><a href=#workerlocation>WorkerLocation</a></code> interface must not exist if the
2451     interface's <span>relevant namespace object</span> is a
2452     <code>Window</code> object. <a href=#refsWEBIDL>[WEBIDL]</a></span></p>
2453    
2454    
2455    
2456     <h2 class="no-num has-ja-translation" data-ja-hash="d95867deadfe690e40f42068d6b59df8" id=references><span class=en-original lang=en>References</span><span class=ja-translation lang=ja>参照</span></h2><!--REFS-->
2457    
2458     <p class="no-ja-translation" data-ja-hash="753b3f31f2391081a7d0512d99c97790"><span class=en-original lang=en>All references are normative unless marked "Non-normative".</span></p>
2459    
2460     <!-- Dates are only included for standards older than the Web,
2461     because the newer ones keep changing. -->
2462    
2463     <dl><dt id=refsDOMCORE class="no-ja-translation" data-ja-hash="bc16cdf6ab9118cf4065dd05b4725405"><span class=en-original lang=en>[DOMCORE]</span></dt>
2464     <dd class="no-ja-translation" data-ja-hash="25cff48771cd089c1f0f7c94333ab8a0"><span class=en-original lang=en><cite><a href=http://www.w3.org/TR/DOM-Level-3-Core/>Document
2465     Object Model (DOM) Level 3 Core Specification</a></cite>, A. Le
2466     Hors, P. Le Hegaret, L. Wood, G. Nicol, J. Robie, M. Champion,
2467     S. Byrnes. W3C.</span></dd>
2468     <!--
2469     <dd class="no-ja-translation" data-ja-hash="a80a69818b30a57c69440ef29f9088b4"><span class=en-original lang=en><cite><a href="http://simon.html5.org/specs/web-dom-core">Web
2470     DOM Core</a></cite>, S. Pieters. W3C.</span></dd>
2471     -->
2472    
2473     <dt id=refsDOMEVENTS class="no-ja-translation" data-ja-hash="4acfe87f4af565e925ab2c05d359f9b1"><span class=en-original lang=en>[DOMEVENTS]</span></dt>
2474     <!--
2475     <dd class="no-ja-translation" data-ja-hash="9f49497a825dc129436a6af8198a6f6b"><span class=en-original lang=en><cite><a
2476     href="http://www.w3.org/TR/DOM-Level-3-Events/">Document Object
2477     Model (DOM) Level 3 Events Specification</a></cite>,
2478     B. H&ouml;hrmann, P. Le Hegaret, T. Pixley. W3C.</span></dd>
2479     -->
2480     <dd class="no-ja-translation" data-ja-hash="e5c45778543c64a42997a7fe01683445"><span class=en-original lang=en><cite><a href=http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html>Document
2481     Object Model (DOM) Level 3 Events Specification</a></cite>,
2482     D. Schepers. W3C.</span></dd>
2483    
2484     <dt id=refsECMA262 class="no-ja-translation" data-ja-hash="ef033ad77bafa67936e26b8da6095aed"><span class=en-original lang=en>[ECMA262]</span></dt>
2485     <dd class="no-ja-translation" data-ja-hash="9935ddc160cd0d8bf2785aebd734a37c"><span class=en-original lang=en><cite><a href=http://www.ecma-international.org/publications/standards/Ecma-262.htm>ECMAScript
2486     Language Specification</a></cite>. ECMA.</span></dd>
2487    
2488     <dt id=refsHTML class="no-ja-translation" data-ja-hash="344e1328c407d292b29daae9be1cdf99"><span class=en-original lang=en>[HTML]</span></dt>
2489     <dd class="no-ja-translation" data-ja-hash="6074a9d9f36a0a7e0ff83c72c2dc29b0"><span class=en-original lang=en><cite><a href=http://www.whatwg.org/specs/web-apps/current-work/>HTML</a></cite>,
2490     I. Hickson. WHATWG.</span></dd>
2491    
2492     <dt id=refsRFC2119 class="no-ja-translation" data-ja-hash="160a6b695c5227ccd5c7beb0e6d5ec22"><span class=en-original lang=en>[RFC2119]</span></dt>
2493     <dd class="no-ja-translation" data-ja-hash="0a151067ca769f7c089f270e64826ee5"><span class=en-original lang=en><cite><a href=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in
2494     RFCs to Indicate Requirement Levels</a></cite>, S. Bradner. IETF.</span></dd>
2495    
2496     <dt id=refsWEBIDL class="no-ja-translation" data-ja-hash="c36d8342bfa57c496487e73bea1fb4d2"><span class=en-original lang=en>[WEBIDL]</span></dt>
2497     <!--
2498     <dd class="no-ja-translation" data-ja-hash="3e535023e47f23040a4a79f6331c1aaa"><span class=en-original lang=en><cite><a href="http://www.w3.org/TR/WebIDL/">Web
2499     IDL</a></cite>, C. McCormack. W3C.</span></dd>
2500     -->
2501     <dd class="no-ja-translation" data-ja-hash="7eaa5b0317a22d89a56aa0ea8ae105a2"><span class=en-original lang=en><cite><a href=http://dev.w3.org/2006/webapi/WebIDL/>Web
2502     IDL</a></cite>, C. McCormack. W3C.</span></dd>
2503 wakaba 1.221
2504     <dt id=refsWEBSQL class="no-ja-translation" data-ja-hash="691e93badc6912ec8c4f60bfd9d7cef9"><span class=en-original lang=en>[WEBSQL]</span></dt>
2505     <dd class="no-ja-translation" data-ja-hash="8ec97cbd4476423b6025480d34d14a82"><span class=en-original lang=en><cite><a href=http://dev.w3.org/html5/webdatabase/>Web SQL
2506     Database</a></cite>, I. Hickson. W3C.</span></dd>
2507 wakaba 1.219
2508     <dt id=refsXHR class="no-ja-translation" data-ja-hash="3ba5cbb19a05fab102ccbee69603b1fc"><span class=en-original lang=en>[XHR]</span></dt>
2509     <!--
2510     <dd class="no-ja-translation" data-ja-hash="69b221564e99e0ccc201524bdb665a00"><span class=en-original lang=en><cite><a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest
2511     Object</a></cite>, A. van Kesteren. W3C.</span></dd>
2512     -->
2513     <dd class="no-ja-translation" data-ja-hash="2e02ca4401c11d1e690ad561abba031f"><span class=en-original lang=en><cite><a href=http://dev.w3.org/2006/webapi/XMLHttpRequest-2/><code>XMLHttpRequest</code></a></cite>,
2514     A. van Kesteren. W3C.</span></dd>
2515    
2516     </dl><h2 class="no-num has-ja-translation" data-ja-hash="0407c27180c9b019e644e8ad4c6a9324" id=acknowledgements><span class=en-original lang=en>Acknowledgements</span><span class=ja-translation lang=ja>謝辞</span></h2> <!-- ACKS -->
2517    
2518     <p class="has-ja-translation" data-ja-hash="a17a0feb6f58a31040d51121e80bc233" data-ja-real-hash="f59286e011a68a30c6514aae2845f151"><span class=en-original lang=en>Thanks to
2519    
2520     Aaron Boodman,
2521     &#1040;&#1083;&#1077;&#1082;&#1089;&#1077;&#1081; &#1055;&#1088;&#1086;&#1089;&#1082;&#1091;&#1088;&#1103;&#1082;&#1086;&#1074; (Alexey Proskuryakov),
2522     Anne van Kesteren,
2523     Ben Turner,
2524     Dmitry Titov,
2525     Drew Wilson,
2526     Jeremy Orlow,
2527     Jonas Sicking,
2528     Justin James,
2529     Kevin Hakanson,
2530     Maciej Stachowiak,
2531     Michael Nordman,
2532     Mike Smith,
2533    
2534     and
2535    
2536     Philip Taylor
2537    
2538     for their useful and substantial comments.</span><span class=ja-translation lang=ja>Aaron Boodman, &#1040;&#1083;&#1077;&#1082;&#1089;&#1077;&#1081; &#1055;&#1088;&#1086;&#1089;&#1082;&#1091;&#1088;&#1103;&#1082;&#1086;&#1074; (Alexey Proskuryakov), Anne van Kesteren, Ben Turner, Dmitry Titov, Drew Wilson, Jeremy Orlow, Jonas Sicking, Justin James, Kevin Hakanson, Maciej Stachowiak, Michael Nordman, Mike Smith, Philip Taylor の有用かつ重要なコメントに感謝します。</span></p>
2539    
2540     <p class="has-ja-translation" data-ja-hash="7c6875278ecf56df193c33c553856fac"><span class=en-original lang=en>Huge thanks to the whole Gears team, who pioneered this
2541     technology and whose experience has been a huge influence on this
2542     specification.</span><span class=ja-translation lang=ja>Gears チームの方々にも非常に感謝します。
2543     Gears チームの方々はこの技術を開拓し、その経験はこの仕様書にも多大な影響を与えています。
2544     </span></p>
2545    
2546    

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24