/[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.52 - (hide annotations) (download)
Wed Jan 21 06:19:23 2009 UTC (17 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.51: +294 -260 lines
make

1 wakaba 1.1
2     <html lang=en-US-x-hixie>
3     <head>
4     <title>Web Workers</title>
5 wakaba 1.32 <link href=http://www.whatwg.org/style/specification rel=stylesheet>
6     <link href=ja-style rel=stylesheet>
7     <link href=only-ja-style rel="stylesheet" title="Show only Japanese text" id=style-only-ja>
8     <link href=both-en-ja-style rel="alternate stylesheet" title="Show both English and Japanese texts" id=style-both-en-ja>
9 wakaba 1.35 <script src=ja-script defer async></script>
10 wakaba 1.31 <link href="/images/icon" rel=icon>
11 wakaba 1.1
12 wakaba 1.16 <style>
13     p > span:not([title=""]):not([class="big-issue"]), li > span:not([title=""]):not([class="big-issue"]) { border-bottom: solid #99CC99; }
14     </style>
15    
16 wakaba 1.1 <body class=draft>
17     <div class=head>
18 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="b20329e0f615f58f17900e708fa8dbaf"><span class=en-original lang=en><a class=logo href="http://www.whatwg.org/" rel=home><img alt=WHATWG
19     src="/images/logo"></a></span></p>
20 wakaba 1.1
21 wakaba 1.42 <h1 class="no-ja-translation" data-ja-hash="6cb7eb9696d986359fa3a78c4b8e60dc"><span class=en-original lang=en>Web Workers</span></h1>
22 wakaba 1.1
23 wakaba 1.52 <h2 class="no-num no-toc has-ja-translation" data-ja-hash="9ea0914ebe364045b80e1ff1a8a2ec1e" data-ja-real-hash="78686286234b14178e47e66da4909506"
24     id=draft-recommendation-mdash-date-01-jan-1><span class=en-original lang=en>Draft Recommendation &mdash;
25     21 January 2009</span><span class=ja-translation lang=ja>勧告案<ins class=ja-note>の非公式和訳</ins> &mdash;
26     <ins class=ja-note>(原文出版日)</ins> 2009年1月21日</span></h2>
27 wakaba 1.1
28 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="54759c46800b2712dd15f6097ee6ed63"><span class=en-original lang=en>You can take part in this work. <a
29 wakaba 1.31 href="http://www.whatwg.org/mailing-list">Join the working group's
30 wakaba 1.36 discussion list.</a></span></p>
31 wakaba 1.31
32 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="6a0ea97471522df19cf042a8869d7c52"><span class=en-original lang=en><strong>Web designers!</strong> We have a <a
33 wakaba 1.31 href="http://blog.whatwg.org/faq/">FAQ</a>, a <a
34     href="http://forums.whatwg.org/">forum</a>, and a <a
35     href="http://www.whatwg.org/mailing-list#help">help mailing list</a> for
36 wakaba 1.33 you!</span><span class=ja-translation lang=ja><strong>Web デザイナーのみなさん!</strong> みなさんのための <a
37 wakaba 1.32 href=http://blog.whatwg.org/faq/ lang=en>FAQ</a>、<a
38     href=http://forums.whatwg.org/>掲示板</a>、<a
39     href=http://www.whatwg.org/mailing-list#help>ヘルプ用メイリング・リスト</a>があります!
40    
41     </span><p>
42    
43     <!-- Japanese-translation-only notes -->
44 wakaba 1.33 <ins class="ja-note cover-ja-note" lang=ja>
45 wakaba 1.38 <p>この文書は、 WHATWG 仕様書の日本語訳です。 正式な仕様書は英語版だけであり、この日本語訳はあくまで参考としてご利用ください。
46 wakaba 1.32
47 wakaba 1.38 <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.
48 wakaba 1.32
49 wakaba 1.38 <p>日本語訳は段落をダブルクリックすると編集できます。編集結果はおよそ3時間おきに反映されます。また、原文の変更には毎日自動的に追随しています。 (<a href=notes>詳細</a>)
50 wakaba 1.32
51 wakaba 1.38 <p lang=en>You can edit Japanese text by double-clicking the paragraph you'd like to edit. 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>)
52 wakaba 1.32
53     <p><button type=button onclick="
54     document.getElementById ('style-only-ja').disabled = false;
55     document.getElementById ('style-both-en-ja').disabled = true;
56 wakaba 1.33 ">日本語訳だけ表示 <span lang=en>Show only Japanese translation</span></button>
57 wakaba 1.32 <p><button type=button onclick="
58     document.getElementById ('style-only-ja').disabled = true;
59     document.getElementById ('style-both-en-ja').disabled = false;
60 wakaba 1.33 ">英和対訳表示 <span lang=en>Show both English and Japanese texts</span></button>
61 wakaba 1.38
62     <p class=XXX>原文が更新されて新しい仕様書生成スクリプトを使うようになるまで、
63     この仕様書の訳文の追加・改訂はお控えください。
64 wakaba 1.32 </ins>
65    
66     <p><span><!-- dummy --></span></p>
67 wakaba 1.1
68     <dl>
69 wakaba 1.36 <dt class="has-ja-translation" data-ja-hash="87b044fafc6f01197a9a700e6fa28a69"><span class=en-original lang=en>This version:
70 wakaba 1.32
71 wakaba 1.36 </span><span class=ja-translation lang=ja><ins class=ja-note>原文の</ins>この版</span><dd class="no-ja-translation" data-ja-hash="a713841c83aed89ce71b7ee6b51cb2cb"><span class=en-original lang=en><a
72 wakaba 1.13 href="http://www.whatwg.org/specs/web-workers/current-work/">http://whatwg.org/ww</a>
73 wakaba 1.1
74 wakaba 1.36 </span><dt class="has-ja-translation" data-ja-hash="8866e8de2efa7275a5dc8e942c1613c2"><span class=en-original lang=en>Version history:
75 wakaba 1.32
76 wakaba 1.36 </span><span class=ja-translation lang=ja><ins class=ja-note>原文の</ins>改版履歴:</span><dd class="no-ja-translation" data-ja-hash="609cec19ff8d697eb0a9f7a0104e0bfb"><span class=en-original lang=en>Twitter messages (non-editorial changes only): <a
77 wakaba 1.31 href="http://twitter.com/WHATWG">http://twitter.com/WHATWG</a>
78    
79 wakaba 1.36 </span><dd class="no-ja-translation" data-ja-hash="abaab2a9b4d1bd0f43a2293e5d1fff4d"><span class=en-original lang=en>Commit-Watchers mailing list: <a
80 wakaba 1.31 href="http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org">http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a>
81    
82 wakaba 1.36 </span><dd class="has-ja-translation" data-ja-hash="5e1dbca74cface6f0d0ea523340e6a89" data-ja-real-hash="f82128f124c19a67cc2104420cc99c45"><span class=en-original lang=en>Interactive Web interface: <a
83 wakaba 1.32 href="http://html5.org/tools/web-workers-tracker">http://html5.org/tools/web-workers-tracker</a>
84    
85 wakaba 1.36 </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 class="has-ja-translation" data-ja-hash="ea5cbdd06bfb529e4a1bcfeac9cfbd61" data-ja-real-hash="ae455a827d3d1e5b15fd14df54502cf5"><span class=en-original lang=en>Subversion interface: <a
86 wakaba 1.32 href="http://svn.whatwg.org/webworkers/">http://svn.whatwg.org/webworkers/</a>
87    
88 wakaba 1.36 </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><dt class="has-ja-translation" data-ja-hash="8468b55db22971120cb71091ece7839e"><span class=en-original lang=en>Issues:
89 wakaba 1.32
90 wakaba 1.36 </span><span class=ja-translation lang=ja>問題:</span><dd class="no-ja-translation" data-ja-hash="72b4306377796146b832d635c9b791f4"><span class=en-original lang=en>To send feedback: <a
91 wakaba 1.31 href="http://www.whatwg.org/mailing-list">[email protected]</a>
92    
93 wakaba 1.36 </span><dd class="no-ja-translation" data-ja-hash="7e3aaf1187bd798f9f71dd7e6e4fa9fe"><span class=en-original lang=en>To view and vote on feedback: <a
94 wakaba 1.31 href="http://www.whatwg.org/issues/">http://www.whatwg.org/issues/</a>
95    
96 wakaba 1.36 </span><dt class="has-ja-translation" data-ja-hash="aa8d072dc59504320cfa92381f541a5f"><span class=en-original lang=en>Editor:
97 wakaba 1.32
98 wakaba 1.36 </span><span class=ja-translation lang=ja>編集者:</span><dd class="no-ja-translation" data-ja-hash="220fb2ab7924ad62bc8567b8b9c5f0f8"><span class=en-original lang=en>Ian Hickson, Google, [email protected]
99     </span></dl>
100 wakaba 1.1
101 wakaba 1.36 <p class="copyright no-ja-translation" data-ja-hash="01887da059d5ef35df4e1cc221f80391"><span class=en-original lang=en>&copy; Copyright 2004-2008 Apple Computer, Inc.,
102     Mozilla Foundation, and Opera Software ASA.</span></p>
103 wakaba 1.1
104 wakaba 1.36 <p class="copyright no-ja-translation" data-ja-hash="5419c8afab07265f61a6768f2680776d"><span class=en-original lang=en>You are granted a license to use, reproduce and create
105     derivative works of this document.</span></p>
106 wakaba 1.1 </div>
107    
108     <hr>
109    
110 wakaba 1.36 <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>
111 wakaba 1.1
112 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="a4f61aa99f0d87d5d87b6e07071a74da"><span class=en-original lang=en>This specification defines an API that allows Web application authors to
113 wakaba 1.32 spawn background workers running scripts in parallel to their main page.
114     This allows for thread-like operation with message-passing as the
115     coordination mechanism.
116    
117     </span><span class=ja-translation lang=ja>この仕様書は、 Web アプリケーションで、主たる頁とは並列に、
118 wakaba 1.14 背景労働者スクリプトを走らせるための API を定義します。
119 wakaba 1.36 これにより、メッセージ・パッシングによるスレッド的操作を協調機構として利用できるようになります。</span><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>
120 wakaba 1.1
121 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="3f706d8337b443d9a959c36a9b3677a3"><span class=en-original lang=en><strong>This is a work in progress!</strong> This document is changing
122 wakaba 1.31 on a daily if not hourly basis in response to comments and as a general
123     part of its development process. Comments are very welcome, please send
124     them to <a href="mailto:[email protected]">[email protected]</a>. Thank
125     you.
126    
127 wakaba 1.36 </span><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.
128 wakaba 1.32
129 wakaba 1.36 </span><span class=ja-translation lang=ja>現在の焦点は、第1案の開発です。</span><p class="no-ja-translation" data-ja-hash="75e78507b984cae37464af998b8dc8a2"><span class=en-original lang=en>Implementors should be aware that this specification is not stable.
130 wakaba 1.31 <strong>Implementors who are not taking part in the discussions are likely
131     to find the specification changing out from under them in incompatible
132     ways.</strong> Vendors interested in implementing this specification
133     before it eventually reaches the call for implementations should join the
134     <a href="/mailing-list">WHATWG mailing list</a> and take part in the
135     discussions.
136    
137 wakaba 1.44 </span><p class="no-ja-translation" data-ja-hash="bb77e82ccfbb3bd01ee25d2bf7243a07"><span class=en-original lang=en>This specification is also being produced by the <a
138     href="http://www.w3.org/2008/webapps/">W3C Web Apps WG</a>. The two
139     specifications are identical from the table of contents onwards.
140 wakaba 1.31
141 wakaba 1.36 </span><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>目次
142 wakaba 1.1 </span></h2>
143     <!--begin-toc-->
144    
145     <ul class=toc>
146 wakaba 1.50 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ab1b3562495830cab4f7e657b0f8c3de"><span class=en-original lang=en><a href="#introduction"><span class=secno>1 </span>Introduction</a>
147 wakaba 1.36 </span><ul class=toc>
148 wakaba 1.42 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="f94143aeed3bb9197ca798364046d48d"><span class=en-original lang=en><a href="#scope"><span class=secno>1.1 </span>Scope</a>
149    
150     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="cc8223ec55502c55628f56c7b446f30d"><span class=en-original lang=en><a href="#tutorial"><span class=secno>1.2 </span>Tutorial</a>
151 wakaba 1.36 </span><ul class=toc>
152 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="d96f6660bcaba7e80ed82206f3428b0b"><span class=en-original lang=en><a href="#a-background-number-crunching-worker"><span
153     class=secno>1.2.1 </span>A background number-crunching worker</a>
154 wakaba 1.23
155 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="6b86b7363cb21fdb41a75d965dd59c1e"><span class=en-original lang=en><a href="#a-worker-for-updating-a-client-side-data"><span
156     class=secno>1.2.2 </span>A worker for updating a client-side
157     database</a>
158 wakaba 1.23
159 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="da8bd5671c3081ba09244abe3c65765b"><span class=en-original lang=en><a href="#worker-used-for-background-io"><span class=secno>1.2.3
160     </span>Worker used for background I/O</a>
161 wakaba 1.23
162 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="81a9bbae1c6e08c98425d4c544945253"><span class=en-original lang=en><a href="#shared-workers"><span class=secno>1.2.4 </span>Shared
163 wakaba 1.23 workers</a>
164    
165 wakaba 1.42 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ad63a3c0da0bfe49cb5391ca4539ddbc"><span class=en-original lang=en><a href="#delegation"><span class=secno>1.2.5
166 wakaba 1.23 </span>Delegation</a>
167    
168 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="a226a34c5b6a117bae802160a7d92868"><span class=en-original lang=en><a href="#providing-libraries"><span class=secno>1.2.6
169     </span>Providing libraries</a>
170 wakaba 1.36 </span></ul>
171 wakaba 1.1
172 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ac0fcd1a7f370213a83e04eb02a25dc1"><span class=en-original lang=en><a href="#conformance-requirements"><span class=secno>1.3
173     </span>Conformance requirements</a>
174 wakaba 1.36 </span><ul class=toc>
175 wakaba 1.42 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="9cf46931a24bdd95446cc0dc13d70962"><span class=en-original lang=en><a href="#dependencies"><span class=secno>1.3.1
176 wakaba 1.1 </span>Dependencies</a>
177 wakaba 1.36 </span></ul>
178 wakaba 1.1
179 wakaba 1.42 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="f14a8054db0709988c39b4986c4a8754"><span class=en-original lang=en><a href="#terminology"><span class=secno>1.4 </span>Terminology</a>
180 wakaba 1.36 </span></ul>
181 wakaba 1.9
182 wakaba 1.50 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="1e8592ba7cd5e7e8258733b6ac72589e"><span class=en-original lang=en><a href="#infrastructure"><span class=secno>2
183 wakaba 1.13 </span>Infrastructure</a>
184 wakaba 1.36 </span><ul class=toc>
185 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="6826367c97b615a802def6f5a262f96e"><span class=en-original lang=en><a href="#the-global-scope"><span class=secno>2.1 </span>The global
186 wakaba 1.29 scope</a>
187 wakaba 1.36 </span><ul class=toc>
188 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="510acf71f6b025995bd2f3883a4b4842"><span class=en-original lang=en><a href="#the-workerglobalscope-abstract-interface"><span
189     class=secno>2.1.1 </span>The <code>WorkerGlobalScope</code> abstract
190     interface</a>
191    
192     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="47de5e5a5b6ac63d3cf2b9560c1efeb0"><span class=en-original lang=en><a href="#dedicated-workers-and-the-dedicatedworke"><span
193     class=secno>2.1.2 </span>Dedicated workers and the
194     <code>DedicatedWorkerGlobalScope</code> interface</a>
195    
196     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="01a182fbfea97af5509eb9e0a7e001be"><span class=en-original lang=en><a href="#shared-workers-and-the-sharedworkergloba"><span
197     class=secno>2.1.3 </span>Shared workers and the
198     <code>SharedWorkerGlobalScope</code> inteface</a>
199 wakaba 1.36 </span></ul>
200 wakaba 1.9
201 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="2f4da1ada1ef4a3ee9df81c276e2144c"><span class=en-original lang=en><a href="#base-urls-and-origins-of-workers"><span class=secno>2.2
202     </span>Base URLs and origins of workers</a>
203 wakaba 1.16
204 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="269731cbf2f42fa0c0a9643e394c45a5"><span class=en-original lang=en><a href="#the-event-loop"><span class=secno>2.3 </span>The event
205     loop</a>
206 wakaba 1.9
207 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="b27d5532afa3181dcc47af7bb1c53f93"><span class=en-original lang=en><a href="#the-workers-ports"><span class=secno>2.4 </span>The
208     worker's ports</a>
209 wakaba 1.11
210 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="9d072bd0cecbce93de0511429e10d40d"><span class=en-original lang=en><a href="#processing-model"><span class=secno>2.5 </span>Processing
211 wakaba 1.9 model</a>
212 wakaba 1.48 </span><ul class=toc>
213 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="e604e216b5c80496105f9a46bf17ad91"><span class=en-original lang=en><a href="#runtime-script-errors"><span class=secno>2.5.1
214     </span>Runtime script errors</a>
215 wakaba 1.48 </span></ul>
216 wakaba 1.13
217 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="be1374e12303a9f704e6a5b419f55da6"><span class=en-original lang=en><a href="#creating-workers"><span class=secno>2.6 </span>Creating
218 wakaba 1.13 workers</a>
219 wakaba 1.36 </span><ul class=toc>
220 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="93f059d78436c027bde5f130c0ad85ae"><span class=en-original lang=en><a href="#the-abstractworker-abstract-interface"><span
221     class=secno>2.6.1 </span>The <code>AbstractWorker</code> abstract
222     interface</a>
223    
224     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="98bd830a7c57f156cb5210ec08e94558"><span class=en-original lang=en><a href="#dedicated-workers-and-the-worker-interfa"><span
225     class=secno>2.6.2 </span>Dedicated workers and the
226     <code>Worker</code> interface</a>
227    
228     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="3c2b51eddef505feca7931cfcca9827a"><span class=en-original lang=en><a href="#shared-workers-and-the-sharedworker-inte"><span
229     class=secno>2.6.3 </span>Shared workers and the
230     <code>SharedWorker</code> interface</a>
231 wakaba 1.36 </span></ul>
232 wakaba 1.9 </ul>
233    
234 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="620ff16075ff710526fa72a847f7fb3d"><span class=en-original lang=en><a href="#apis-available-to-workers"><span class=secno>3 </span>APIs
235     available to workers</a>
236 wakaba 1.36 </span><ul class=toc>
237 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="7290417aa9314a0a00eac77856957b15"><span class=en-original lang=en><a href="#importing-scripts-and-libraries"><span class=secno>3.1
238     </span>Importing scripts and libraries</a>
239 wakaba 1.22
240 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="747a07326fc0f9d2e9198bf2ea7f390c"><span class=en-original lang=en><a href="#the-navigator-object"><span class=secno>3.2 </span>The
241 wakaba 1.42 <code>Navigator</code> object</a>
242    
243 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="7817e06f3c52e0e203fe3308f8675ac3"><span class=en-original lang=en><a href="#apis-defined-in-other-specifications"><span
244     class=secno>3.3 </span>APIs defined in other specifications</a>
245 wakaba 1.22
246 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="9b10fbb3a9e367d74598b00d87b4f2c2"><span class=en-original lang=en><a href="#interface-objects-and-constructors"><span class=secno>3.4
247     </span>Interface objects and constructors</a>
248 wakaba 1.23
249 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="3cc077aab90ed74a41415efc776edbef"><span class=en-original lang=en><a href="#worker-locations"><span class=secno>3.5 </span>Worker
250     locations</a>
251 wakaba 1.36 </span></ul>
252 wakaba 1.1
253 wakaba 1.36 <li class=no-num><p class="no-ja-translation ja-translation-inserted" data-ja-hash="e747237bceaf9dabea52363254fc5f16"><span class=en-original lang=en><a href="#references">References</a>
254 wakaba 1.1
255 wakaba 1.36 </span><li class=no-num><p class="no-ja-translation ja-translation-inserted" data-ja-hash="f440038177834afbee04ac5e84ec86fe"><span class=en-original lang=en><a href="#acknowledgements">Acknowledgements</a>
256     </span></ul>
257 wakaba 1.1 <!--end-toc-->
258    
259     <hr>
260    
261 wakaba 1.50 <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>
262 wakaba 1.32
263 wakaba 1.42 <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>
264    
265     <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
266    
267     </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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 background
268     independently of any user interface scripts.
269    
270     </span><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 scripts
271     that respond to clicks or other user interactions, and allows long tasks
272     to be executed without yielding to keep the page responsive.
273    
274     </span><p class="no-ja-translation" data-ja-hash="52e3c8127ee80a92ae3709986b8f2450"><span class=en-original lang=en>Workers (as these background scripts are called herein) are relatively
275     heavy-weight, and are not intended to be used in large numbers. For
276     example, it would be inappropriate to launch one worker for each pixel of
277     a four megapixel image. The examples below show some appropriate uses of
278     workers.
279    
280     </span><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 start-up
281     performance cost, and a high per-instance memory cost.
282    
283     </span><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>
284 wakaba 1.32
285 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
286 wakaba 1.32
287 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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 following
288 wakaba 1.32 subsections show various examples of this use.
289    
290 wakaba 1.52 </span><span class=ja-translation lang=ja>労働者は色々なことに使えます。次の各節では、色々な使い方の例を示します。</span><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
291     </span>A background number-crunching worker</span><span class=ja-translation lang=ja><span class=secno>1.2.1
292     </span>数値処理背景労働者</span></h4>
293 wakaba 1.32
294 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
295 wakaba 1.1
296 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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
297 wakaba 1.32 expensive task without interrupting the user interface.
298 wakaba 1.1
299 wakaba 1.36 </span><span class=ja-translation lang=ja>労働者の一番単純な用法は、計算的に高価な仕事を利用者界面を中断させずに実行するというものです。</span><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 (na&iuml;vely)
300 wakaba 1.32 compute prime numbers, and progressively displays the most recently found
301     prime number.
302 wakaba 1.23
303 wakaba 1.32 </span><span class=ja-translation lang=ja>この例では、主たる文書が労働者を作って素数を (素朴な方法で) 計算させ、
304 wakaba 1.36 新しく見つかった素数を順番に表示してゆきます。</span><p class="has-ja-translation" data-ja-hash="97bcf42c4070cbcef605cfa277d832fb"><span class=en-original lang=en>The main page is as follows:
305 wakaba 1.32
306 wakaba 1.42 </span><span class=ja-translation lang=ja>主たる頁は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="537851d8b0d221cfefc798638131dbcd"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
307 wakaba 1.23 &lt;html>
308     &lt;head>
309     &lt;title>Worker example: One-core computation&lt;/title>
310     &lt;/head>
311     &lt;body>
312     &lt;p>The highest prime number discovered so far is: &lt;output id="result">&lt;/output>&lt;/p>
313     &lt;script>
314 wakaba 1.29 var worker = new Worker('worker.js');
315     worker.onmessage = function (event) {
316 wakaba 1.42 document.getElementById('result').textContent = event.data;
317 wakaba 1.23 };
318     &lt;/script>
319     &lt;/body>
320 wakaba 1.36 &lt;/html></span></pre>
321 wakaba 1.23
322 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="714bda6514d0a7c59a626e591f668702"><span class=en-original lang=en>The <code title=dom-Worker><a
323     href="#workerscripturl">Worker()</a></code> constructor call creates a
324     worker and returns a <code><a href="#worker">Worker</a></code> object
325     representing that worker, which is used to communicate with the worker.
326     That object's <code title=handler-Worker-onmessage><a
327     href="#onmessage0">onmessage</a></code> event handler attribute allows the
328     code to receive messages from the worker.
329 wakaba 1.23
330 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:
331 wakaba 1.32
332 wakaba 1.36 </span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="35390f08d92125ad461fd6bb5969cb0c"><span class=en-original lang=en>var n = 1;
333 wakaba 1.23 search: while (true) {
334     n += 1;
335     for (var i = 2; i &lt;= Math.sqrt(n); i += 1)
336     if (n % i == 0)
337     continue search;
338     // found a prime!
339 wakaba 1.29 postMessage(n);
340 wakaba 1.36 }</span></pre>
341 wakaba 1.23
342 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="6cbc84e07a533681566aa4fdf838f852"><span class=en-original lang=en>The bulk of this code is simply an unoptimised search for a prime
343 wakaba 1.23 number. To send a message back to the page, the <code
344 wakaba 1.30 title=dom-DedicatedWorkerGlobalScope-postMessage><a
345     href="#postmessage">postMessage()</a></code> method is used to post a
346     message when a prime is found.
347 wakaba 1.23
348 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="fb1b85e403d4ca967bb53b221e757de8"><span class=en-original lang=en><a href="http://www.whatwg.org/demos/workers/primes/page.html">View this
349 wakaba 1.32 example online</a>.
350    
351 wakaba 1.52 </span><span class=ja-translation lang=ja><a href="http://www.whatwg.org/demos/workers/primes/page.html">この例をオンラインで表示する</a>。</span><h4 id=a-worker-for-updating-a-client-side-data class="has-ja-translation" data-ja-hash="be08cb921deb5e88f7dcb3edbd9f0274"><span class=en-original lang=en><span class=secno>1.2.2
352     </span>A worker for updating a client-side database</span><span class=ja-translation lang=ja><span class=secno>1.2.2
353     </span>クライアント側データベースの更新のための労働者</span></h4>
354 wakaba 1.23
355 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
356 wakaba 1.32
357 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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 task is to
358 wakaba 1.23 listen for notifications from the server, and, when appropriate, either
359     add or remove data from the client-side database.
360    
361 wakaba 1.36 </span><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 page, the
362 wakaba 1.23 main page can start the worker by just doing:
363    
364 wakaba 1.36 </span><span class=ja-translation lang=ja>労働者と主たる頁の間に通信は発生しませんので、
365     主たる頁は単に次のようにするだけで労働者を開始できます。</span><pre class="no-ja-translation" data-ja-hash="1fa3b8ca6e1be5ba6915c7164f359cf2"><span class=en-original lang=en>&lt;script>
366 wakaba 1.30 new Worker('worker.js');
367 wakaba 1.36 &lt;/script></span></pre>
368 wakaba 1.23
369 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:
370 wakaba 1.32
371 wakaba 1.42 </span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="cfd35229b68e597b6a21322a3e3c1aea"><span class=en-original lang=en>var server = new WebSocket('ws://whatwg.org/database');
372 wakaba 1.25 var database = openDatabase('demobase', '1.0', 'Demo Database', 10240);
373 wakaba 1.23 server.onmessage = function (event) {
374     // data is in the format "command key value"
375 wakaba 1.42 var data = event.data.split(' ');
376 wakaba 1.23 switch (data[0]) {
377     case '+':
378     database.transaction(function(tx) {
379     tx.executeSql('INSERT INTO pairs (key, value) VALUES (?, ?)', data[1], data[2]);
380     });
381     case '-':
382     database.transaction(function(tx) {
383     tx.executeSql('DELETE FROM pairs WHERE key=? AND value=?', data[1], data[2]);
384     });
385     }
386 wakaba 1.36 };</span></pre>
387 wakaba 1.23
388 wakaba 1.42 <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> mechanism
389 wakaba 1.23 and opens the local database (which, we presume, has been created
390 wakaba 1.42 earlier). The worker then just listens for messages from the server and
391 wakaba 1.23 acts on them as appropriate, forever (or until the main page is closed).
392    
393 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="d47c2ada69bdfebeb58219610105a1d7"><span class=en-original lang=en><a
394 wakaba 1.23 href="http://www.whatwg.org/demos/workers/database-updater/page.html">View
395     this example online</a>. (This example will not actually function, since
396     the server does not actually exist and the database is not created by this
397     sample code.)
398    
399 wakaba 1.52 </span><h4 id=worker-used-for-background-io class="no-ja-translation" data-ja-hash="26a2e24494eb4f94591467b79f68f6f2"><span class=en-original lang=en><span class=secno>1.2.3 </span>Worker
400     used for background I/O</span></h4>
401 wakaba 1.32
402 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
403 wakaba 1.23
404 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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 fetching
405 wakaba 1.23 stock updates for at regular intervals, and one for fetching performing
406     search queries that the user requests.
407    
408 wakaba 1.36 </span><span class=ja-translation lang=ja>この例では、主たる文書は2つの労働者を使います。
409     1つは一定間隔で株価の更新を取得するためのもので、もう1つは利用者の要求した検索の照会を行う取得のためのものです。</span><p class="has-ja-translation" data-ja-hash="97bcf42c4070cbcef605cfa277d832fb"><span class=en-original lang=en>The main page is as follows:
410 wakaba 1.32
411 wakaba 1.42 </span><span class=ja-translation lang=ja>主たる頁は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="ba58233c15e0292446559987f277f4a6"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
412 wakaba 1.23 &lt;html>
413     &lt;head>
414     &lt;title>Worker example: Stock ticker&lt;/title>
415     &lt;script>
416     // TICKER
417     var symbol = 'GOOG'; // default symbol to watch
418 wakaba 1.29 var ticker = new Worker('ticker.js');
419 wakaba 1.23
420     // SEARCHER
421 wakaba 1.29 var searcher = new Worker('searcher.js');
422 wakaba 1.23 function search(query) {
423 wakaba 1.29 searcher.postMessage(query);
424 wakaba 1.23 }
425    
426     // SYMBOL SELECTION UI
427     function select(newSymbol) {
428     symbol = newSymbol;
429 wakaba 1.29 ticker.postMessage(symbol);
430 wakaba 1.23 }
431     &lt;/script>
432     &lt;/head>
433     &lt;body>
434     &lt;p>&lt;output id="symbol">&lt;/output> &lt;output id="value">&lt;/output>&lt;/p>
435     &lt;script>
436 wakaba 1.29 ticker.onmessage = function (event) {
437 wakaba 1.42 var data = event.data.split(' ');
438 wakaba 1.23 document.getElementById('symbol').textContent = data[0];
439     document.getElementById('value').textContent = data[1];
440     };
441 wakaba 1.29 ticker.postMessage(symbol);
442 wakaba 1.23 &lt;/script>
443     &lt;p>&lt;label>Search: &lt;input type="text" oninput="search(this.value)">&lt;/label>&lt;/p>
444     &lt;ul id="results">&lt;/ul>
445     &lt;script>
446 wakaba 1.29 searcher.onmessage = function (event) {
447 wakaba 1.42 var data = event.data.split(' ');
448 wakaba 1.23 var results = document.getElementById('results');
449     while (results.hasChildNodes()) // clear previous results
450     results.removeChild(results.firstChild);
451     for (var i = 0; i &lt; data.length; i += 1) {
452     // add a list item with a button for each result
453     var li = document.createElement('li');
454     var button = document.createElement('button');
455     button.value = data[i];
456     button.type = 'button';
457     button.onclick = function () { select(this.value); };
458     button.textContent = data[i];
459     li.appendChild(button);
460     results.appendChild(li);
461     }
462     };
463     &lt;/script>
464     &lt;p>(The data in this example is not real. Try searching for "Google" or "Apple".)&lt;/p>
465     &lt;/body>
466 wakaba 1.36 &lt;/html></span></pre>
467 wakaba 1.23
468 wakaba 1.36 <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 network
469 wakaba 1.23 calls. This library is as follows:
470    
471 wakaba 1.36 </span><span class=ja-translation lang=ja>両労働者は実際のネットワークの呼び出しを行う共通のライブラリーを使います。
472     このライブラリーは次の通りです。</span><pre class="no-ja-translation" data-ja-hash="764d750a19834bf904d276466724339c"><span class=en-original lang=en>function get(url) {
473 wakaba 1.29 try {
474     var xhr = new XMLHttpRequest();
475     xhr.open('GET', url, false);
476     xhr.send();
477     return xhr.responseText;
478     } catch (e) {
479     return ''; // turn all errors into empty results
480     }
481 wakaba 1.36 }</span></pre>
482 wakaba 1.23
483 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="ee10423864c33d68e8676bf88cb75046"><span class=en-original lang=en>The stock updater worker is as follows:
484 wakaba 1.23
485 wakaba 1.42 </span><span class=ja-translation lang=ja>株価更新者の労働者は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="66ef47eaf421ea8066871b71807859be"><span class=en-original lang=en>importScripts('io.js');
486 wakaba 1.23 var timer;
487     var symbol;
488     function update() {
489 wakaba 1.29 postMessage(symbol + ' ' + get('stock.cgi?' + symbol));
490 wakaba 1.23 timer = setTimeout(update, 10000);
491     }
492 wakaba 1.29 onmessage = function (event) {
493 wakaba 1.23 if (timer)
494     clearTimeout(timer);
495 wakaba 1.42 symbol = event.data;
496 wakaba 1.23 update();
497 wakaba 1.36 };</span></pre>
498 wakaba 1.23
499 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="aa6a78ceb7b91cdf90925cc36c6c6676"><span class=en-original lang=en>The search query worker is as follows:
500 wakaba 1.23
501 wakaba 1.42 </span><span class=ja-translation lang=ja>検索の照会の労働者は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="ac0353e2a69ae5ffdc861cca404ef9f0"><span class=en-original lang=en>importScripts('io.js');
502 wakaba 1.29 onmessage = function (event) {
503 wakaba 1.42 postMessage(get('search.cgi?' + event.data));
504 wakaba 1.36 };</span></pre>
505 wakaba 1.23
506 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="9b529b56f810a73a138b067e5dfe89cd"><span class=en-original lang=en><a href="http://www.whatwg.org/demos/workers/stocks/page.html">View this
507 wakaba 1.32 example online</a>.
508 wakaba 1.23
509 wakaba 1.52 </span><span class=ja-translation lang=ja><a href="http://www.whatwg.org/demos/workers/stocks/page.html">この例をオンラインで表示する</a>。</span><h4 id=shared-workers class="has-ja-translation" data-ja-hash="634755c2f50b08b49a82f30428b1a961"><span class=en-original lang=en><span class=secno>1.2.4 </span>Shared workers</span><span class=ja-translation lang=ja><span class=secno>1.2.4 </span>共有労働者</span></h4>
510 wakaba 1.32
511 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
512 wakaba 1.32
513 wakaba 1.42 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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 are all
514 wakaba 1.23 viewing the same map. All the windows share the same map information, with
515     a single worker coordinating all the viewers. Each viewer can move around
516 wakaba 1.42 independently, but if they set any data on the map, all the viewers are
517 wakaba 1.23 updated.
518    
519 wakaba 1.42 </span><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 the
520 wakaba 1.23 viewers:
521    
522 wakaba 1.36 </span><span class=ja-translation lang=ja>主たる頁は特に何もなく、単に表示器を開くためだけのものです。</span><pre class="no-ja-translation" data-ja-hash="55a104a8ba6c7596b2ca462c2ffb1f0a"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
523 wakaba 1.23 &lt;html>
524     &lt;head>
525     &lt;title>Workers example: Multiviewer&lt;/title>
526     &lt;script>
527     function openViewer() {
528     window.open('viewer.html');
529     }
530     &lt;/script>
531     &lt;/head>
532     &lt;body>
533     &lt;p>&lt;button type=button onclick="openViewer()">Open a new
534     viewer&lt;/button>&lt;/p>
535     &lt;p>Each viewer opens in a new window. You can have as many viewers
536     as you like, they all view the same data.&lt;/p>
537     &lt;/body>
538 wakaba 1.36 &lt;/html></span></pre>
539 wakaba 1.23
540 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="cee02afe1e87e7182f5219ccf54757ca"><span class=en-original lang=en>The viewer is more involved:
541 wakaba 1.23
542 wakaba 1.42 </span><span class=ja-translation lang=ja>表示器はもっと色々しています。</span><pre class="no-ja-translation" data-ja-hash="99dd203a533b07b5af460448666b5a5e"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
543 wakaba 1.23 &lt;html>
544     &lt;head>
545     &lt;title>Workers example: Multiviewer viewer&lt;/title>
546     &lt;script>
547 wakaba 1.29 var worker = new SharedWorker('worker.js', 'core');
548 wakaba 1.23
549     // CONFIGURATION
550     function configure(event) {
551 wakaba 1.42 if (event.data.substr(0, 4) != 'cfg ') return;
552     var name = event.data.substr(4).split(' ', 1);
553 wakaba 1.23 // update display to mention our name is name
554     document.getElementsByTagName('h1')[0].textContent += ' ' + name;
555     // no longer need this listener
556 wakaba 1.25 worker.port.removeEventListener('message', configure, false);
557 wakaba 1.23 }
558 wakaba 1.30 worker.port.addEventListener('message', configure, false);
559 wakaba 1.23
560     // MAP
561     function paintMap(event) {
562 wakaba 1.42 if (event.data.substr(0, 4) != 'map ') return;
563     var data = event.data.substr(4).split(',');
564 wakaba 1.23 // display tiles data[0] .. data[8]
565     var canvas = document.getElementById('map');
566     var context = canvas.getContext('2d');
567     for (var y = 0; y &lt; 3; y += 1) {
568     for (var x = 0; x &lt; 3; x += 1) {
569     var tile = data[y * 3 + x];
570     if (tile == '0')
571     context.fillStyle = 'green';
572     else
573     context.fillStyle = 'maroon';
574     fillRect(x * 50, y * 50, 50, 50);
575     }
576     }
577     }
578 wakaba 1.30 worker.port.addEventListener('message', paintMap, false);
579 wakaba 1.23
580     // PUBLIC CHAT
581     function updatePublicChat(event) {
582 wakaba 1.42 if (event.data.substr(0, 4) != 'txt ') return;
583     var name = event.data.substr(4).split(' ', 1);
584     var message = event.data.substr(4 + length(name) + 1);
585 wakaba 1.23 // display "&lt;name> message" in public chat
586     var dialog = document.getElementById('public');
587     var dt = document.createElement('dt');
588     dt.textContent = name;
589     dialog.appendChild(dt);
590     var dd = document.createElement('dd');
591     dd.textContent = message;
592     dialog.appendChild(dd);
593     }
594 wakaba 1.30 worker.port.addEventListener('message', updatePublicChat, false);
595 wakaba 1.23
596     // PRIVATE CHAT
597     function startPrivateChat(event) {
598 wakaba 1.42 if (event.data.substr(0, 4) != 'msg ') return;
599     var name = event.data.substr(4).split(' ', 1);
600 wakaba 1.23 var port = event.port;
601     // display a private chat UI
602     var ul = document.getElementById('private');
603     var li = document.createElement('li');
604     var h3 = document.createElement('h3');
605     h3.textContent = 'Private chat with ' + name;
606     li.appendChild(h3);
607     var dialog = document.createElement('dialog');
608     var addMessage = function(name, message) {
609     var dt = document.createElement('dt');
610     dt.textContent = name;
611     dialog.appendChild(dt);
612     var dd = document.createElement('dd');
613     dd.textContent = message;
614     dialog.appendChild(dd);
615     };
616     port.onmessage = function (event) {
617 wakaba 1.42 addMessage(name, event.data);
618 wakaba 1.23 };
619     li.appendChild(dialog);
620     var form = document.createElement('form');
621     var p = document.createElement('p');
622     var input = document.createElement('input');
623     input.size = 50;
624     p.appendChild(input);
625     p.appendChild(document.createTextNode(' '));
626     var button = document.createElement('button');
627     button.textContent = 'Post';
628     p.appendChild(button);
629     form.onsubmit = function () {
630     port.postMessage(input.value);
631     addMessage('me', input.value);
632     input.value = '';
633     return false;
634     };
635     form.appendChild(p);
636     li.appendChild(form);
637     }
638 wakaba 1.30 worker.port.addEventListener('message', startPrivateChat, false);
639 wakaba 1.23 &lt;/script>
640     &lt;/head>
641 wakaba 1.29 &lt;body>
642 wakaba 1.23 &lt;h1>Viewer&lt;/h1>
643     &lt;h2>Map&lt;/h2>
644     &lt;p>&lt;canvas id="map" height=150 width=150>&lt;/canvas>&lt;/p>
645     &lt;p>
646 wakaba 1.30 &lt;button type=button onclick="worker.port.postMessage('mov left')">Left&lt;/button>
647     &lt;button type=button onclick="worker.port.postMessage('mov up')">Up&lt;/button>
648     &lt;button type=button onclick="worker.port.postMessage('mov down')">Down&lt;/button>
649     &lt;button type=button onclick="worker.port.postMessage('mov right')">Right&lt;/button>
650     &lt;button type=button onclick="worker.port.postMessage('set 0')">Set 0&lt;/button>
651     &lt;button type=button onclick="worker.port.postMessage('set 1')">Set 1&lt;/button>
652 wakaba 1.23 &lt;/p>
653     &lt;h2>Public Chat&lt;/h2>
654     &lt;dialog id="public">&lt;/dialog>
655 wakaba 1.30 &lt;form onsubmit="worker.port.postMessage('txt ' + message.value); message.value = ''; return false;">
656 wakaba 1.23 &lt;p>
657     &lt;input type="text" name="message" size="50">
658     &lt;button>Post&lt;/button>
659     &lt;/p>
660     &lt;/form>
661     &lt;h2>Private Chat&lt;/h2>
662     &lt;ul id="private">&lt;/ul>
663     &lt;/body>
664 wakaba 1.25 &lt;/html>
665 wakaba 1.36 </span></pre>
666 wakaba 1.23
667 wakaba 1.36 <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 viewer is
668 wakaba 1.23 written.
669    
670 wakaba 1.36 </span><span class=ja-translation lang=ja>表示器の書き方についていくつか注意したい重要な点があります。</span><p class="has-ja-translation" data-ja-hash="8bc9c1f9e0e102128838ea8c31c51306"><span class=en-original lang=en><strong>Multiple listeners</strong>. Instead of a single message
671 wakaba 1.23 processing function, the code here attaches multiple event listeners, each
672     one performing a quick check to see if it is relevant for the message. In
673     this example it doesn't make much difference, but if multiple authors
674     wanted to collaborate using a single port to communicate with a worker, it
675     would allow for independent code instead of changes having to all be made
676     to a single event handling function.
677    
678 wakaba 1.36 </span><span class=ja-translation lang=ja><strong>複数の聴取器</strong>。この符号では、メッセージ処理関数を1つ用意する代わりに、
679     複数の事象聴取器を付与し、それぞれが、それがメッセージに関連するかどうかを見るためにさらりと検査を行っています。
680     この例では大きな違いにはなりませんが、複数の著者が労働者と通信するために1つのポートを使って協調したい場合には、
681     独立した符号にできるので変更がある度に1つの事象取扱関数をいじらざるを得なくて済みます。</span><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 unregister
682 wakaba 1.23 specific listeners when you are done with them, as is done with the <code
683     title="">configure()</code> method in this example.
684    
685 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="4eb1fa2095f65662225da4c52db274f1"><span class=en-original lang=en>Finally, the worker:
686 wakaba 1.23
687 wakaba 1.42 </span><span class=ja-translation lang=ja>最後に、労働者は次のようになります。</span><pre class="no-ja-translation" data-ja-hash="70993f8765f69b748af6943ac4387c72"><span class=en-original lang=en>
688 wakaba 1.23 var nextName = 0;
689     function getNextName() {
690     // this could use more friendly names
691     // but for now just return a number
692     return nextName++;
693     }
694    
695     var map = [
696     [0, 0, 0, 0, 0, 0, 0],
697     [1, 1, 0, 1, 0, 1, 1],
698     [0, 1, 0, 1, 0, 0, 0],
699     [0, 1, 0, 1, 0, 1, 1],
700     [0, 0, 0, 1, 0, 0, 0],
701     [1, 0, 0, 1, 1, 1, 1],
702     [1, 1, 0, 1, 1, 0, 1],
703     ];
704    
705     function wrapX(x) {
706     if (x &lt; 0) return wrapX(x + map[0].length);
707     if (x >= map[0].length) return wrapX(x - map[0].length);
708     return x;
709     }
710    
711     function wrapY(y) {
712     if (y &lt; 0) return wrapY(y + map.length);
713     if (y >= map[0].length) return wrapY(y - map.length);
714     return y;
715     }
716    
717 wakaba 1.29 function sendMapData(callback) {
718 wakaba 1.23 var data = '';
719     for (var y = viewer.y-1; y &lt;= viewer.y+1; y += 1) {
720     for (var x = viewer.x-1; x &lt;= viewer.x+1; x += 1) {
721     if (data != '')
722     data += ',';
723     data += map[y][x];
724     }
725     }
726 wakaba 1.29 callback('map ' + data);
727 wakaba 1.23 }
728    
729     var viewers = {};
730     onconnect = function (event) {
731     event.port._name = getNextName();
732     event.port._data = { port: event.port, x: 0, y: 0, };
733     viewers[event.port._name] = event.port._data;
734     event.port.postMessage('cfg ' + name);
735     event.port.onmessage = getMessage;
736 wakaba 1.29 sendMapData(event.port.postMessage);
737 wakaba 1.23 };
738    
739     function getMessage(event) {
740 wakaba 1.42 switch (event.data.substr(0, 4)) {
741 wakaba 1.23 case 'mov ':
742 wakaba 1.42 var direction = event.data.substr(4);
743 wakaba 1.23 var dx = 0;
744     var dy = 0;
745     switch (direction) {
746     case 'up': dy = -1; break;
747     case 'down': dy = 1; break;
748     case 'left': dx = -1; break;
749     case 'right': dx = 1; break;
750     }
751     event.target._data.x = wrapX(event.target._data.x + dx);
752     event.target._data.y = wrapY(event.target._data.y + dy);
753 wakaba 1.29 sendMapData(event.target.postMessage);
754 wakaba 1.23 break;
755     case 'set ':
756 wakaba 1.42 var value = event.data.substr(4);
757 wakaba 1.23 map[event.target._data.y][event.target._data.x] = value;
758     for (var viewer in viewers)
759 wakaba 1.29 sendMapData(viewers[viewer].port.postMessage);
760 wakaba 1.23 break;
761     case 'txt ':
762     var name = event.target._name;
763 wakaba 1.42 var message = event.data.substr(4);
764 wakaba 1.23 for (var viewer in viewers)
765     viewers[viewer].port.postMessage('txt ' + name + ' ' + message);
766     break;
767     case 'msg ':
768     var party1 = event._data;
769 wakaba 1.42 var party2 = viewers[event.data.substr(4).split(' ', 1)];
770 wakaba 1.23 if (party2) {
771     var channel = new MessageChannel();
772     party1.port.postMessage('msg ' + party2.name, channel.port1);
773     party2.port.postMessage('msg ' + party1.name, channel.port2);
774     }
775     break;
776     }
777 wakaba 1.36 }</span></pre>
778 wakaba 1.23
779 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="b0014972506b918202f48b09f30424bd"><span class=en-original lang=en><strong>Connecting to multiple pages</strong>. The script uses the <code
780 wakaba 1.30 title=handler-SharedWorkerGlobalScope-onconnect><a
781     href="#onconnect">onconnect</a></code> event listener to listen for
782     multiple connections.
783 wakaba 1.23
784 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="5ce666b6338718b46fb0dee22dbea88c"><span class=en-original lang=en><strong>Direct channels</strong>. When the worker receives a "msg"
785 wakaba 1.23 message from one viewer naming another viewer, it sets up a direct
786     connection between the two, so that the two viewers can communicate
787     directly without the worker having to proxy all the messages.
788    
789 wakaba 1.36 </span><span class=ja-translation lang=ja><strong>直接通信路</strong>。労働者がある閲覧器から他の閲覧器を名指した「msg」メッセージを受信した時は、
790     両者間の直接の接続を設定し、労働者がすべてのメッセージを仲介せずとも両閲覧器が直接通信できるようにします。</span><p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="4c5ed82f8da671a56292686cc3a60981"><span class=en-original lang=en><a href="http://www.whatwg.org/demos/workers/multiviewer/page.html">View
791 wakaba 1.32 this example online</a>.
792    
793 wakaba 1.42 </span><span class=ja-translation lang=ja><a href="http://www.whatwg.org/demos/workers/multiviewer/page.html">この例をオンラインで表示する</a>。</span><h4 id=delegation class="has-ja-translation" data-ja-hash="57b11d3816e9f83adb4dd2ecb2a311b5"><span class=en-original lang=en><span class=secno>1.2.5 </span>Delegation</span><span class=ja-translation lang=ja><span class=secno>1.2.5 </span>委譲</span></h4>
794 wakaba 1.23
795 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
796 wakaba 1.32
797 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><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
798 wakaba 1.23 performance is to split computationally expensive tasks amongst multiple
799     workers. In this example, a computationally expensive task that is to be
800     performed for every number from 1 to 10,000,000 is farmed out to ten
801     subworkers.
802    
803 wakaba 1.37 </span><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:
804 wakaba 1.23
805 wakaba 1.42 </span><span class=ja-translation lang=ja>主たる頁は次の通りで、単に結果を報告するだけです。</span><pre class="no-ja-translation" data-ja-hash="537851d8b0d221cfefc798638131dbcd"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
806 wakaba 1.23 &lt;html>
807     &lt;head>
808     &lt;title>Worker example: One-core computation&lt;/title>
809     &lt;/head>
810     &lt;body>
811     &lt;p>The highest prime number discovered so far is: &lt;output id="result">&lt;/output>&lt;/p>
812     &lt;script>
813 wakaba 1.29 var worker = new Worker('worker.js');
814     worker.onmessage = function (event) {
815 wakaba 1.42 document.getElementById('result').textContent = event.data;
816 wakaba 1.23 };
817     &lt;/script>
818     &lt;/body>
819 wakaba 1.36 &lt;/html></span></pre>
820 wakaba 1.23
821 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="12a62a74d5156b6d85136f5fc41a4ee1"><span class=en-original lang=en>The worker itself is as follows:
822 wakaba 1.32
823 wakaba 1.42 </span><span class=ja-translation lang=ja>労働者自体は次の通りです。</span><pre class="no-ja-translation" data-ja-hash="c2f14df3c3648ecb143c9e271b6721df"><span class=en-original lang=en>// settings
824 wakaba 1.23 var num_workers = 10;
825     var items_per_worker = 1000000;
826    
827     // start the workers
828     var result = 0;
829     var pending_workers = num_workers;
830     for (var i = 0; i &lt; num_workers; i += 1) {
831 wakaba 1.29 var worker = new Worker('core.js');
832     worker.postMessage(i * items_per_worker);
833     worker.postMessage((i+1) * items_per_worker);
834     worker.onmessage = storeResult;
835 wakaba 1.23 }
836    
837     // handle the results
838     function storeResult(event) {
839 wakaba 1.42 result += 1*event.data;
840 wakaba 1.23 pending_workers -= 1;
841     if (pending_workers &lt;= 0)
842 wakaba 1.29 postMessage(result); // finished!
843 wakaba 1.36 }</span></pre>
844 wakaba 1.23
845 wakaba 1.36 <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 that
846 wakaba 1.23 waits for all the subworkers to respond.
847    
848 wakaba 1.36 </span><span class=ja-translation lang=ja>これは部分労働者を開始するループと、
849     すべての部分労働者が応答するのを待つ取扱器から成っています。</span><p class="has-ja-translation" data-ja-hash="53f3483f6fffa25f7c6963e58d683f43"><span class=en-original lang=en>The subworkers are implemented as follows:
850 wakaba 1.23
851 wakaba 1.44 </span><span class=ja-translation lang=ja>部分労働者は次のように実装します。</span><pre class="no-ja-translation" data-ja-hash="90fc569c1c634a87b725ebbe4cc1e2f4"><span class=en-original lang=en>var start;
852 wakaba 1.23 onmessage = getStart;
853     function getStart(event) {
854 wakaba 1.42 start = 1*event.data;
855 wakaba 1.23 onmessage = getEnd;
856     }
857    
858     var end;
859     function getEnd(event) {
860 wakaba 1.42 end = 1*event.data;
861 wakaba 1.23 onmessage = null;
862 wakaba 1.44 work();
863 wakaba 1.23 }
864    
865 wakaba 1.44 function work() {
866 wakaba 1.23 var result = 0;
867     for (var i = start; i &lt; end; i += 1) {
868     // perform some complex calculation here
869     result += 1;
870     }
871 wakaba 1.29 postMessage(result);
872     close();
873 wakaba 1.36 }</span></pre>
874 wakaba 1.23
875 wakaba 1.36 <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 for the
876 wakaba 1.23 range of numbers thus specified, and then report the result back to the
877     parent.
878    
879 wakaba 1.36 </span><span class=ja-translation lang=ja>部分労働者は2つの事象で2つの数を受信し、指定された数の範囲の計算を行った後、
880     結果を親に報告します。
881     </span><p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="c560664d07d84902d5e9e6c68ffc2f01"><span class=en-original lang=en><a href="http://www.whatwg.org/demos/workers/multicore/page.html">View
882 wakaba 1.32 this example online</a>.
883    
884 wakaba 1.52 </span><span class=ja-translation lang=ja><a href="http://www.whatwg.org/demos/workers/multicore/page.html">この例をオンラインで表示する</a>。</span><h4 id=providing-libraries class="has-ja-translation" data-ja-hash="6c37218e175bff77f69bd84b1ab5da58"><span class=en-original lang=en><span class=secno>1.2.6 </span>Providing
885     libraries</span><span class=ja-translation lang=ja><span class=secno>1.2.6 </span>ライブラリーの提供</span></h4>
886 wakaba 1.28
887 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="585b83d0801ae75a14554d8d2c737fb2"><span class=en-original lang=en><em>This section is non-normative.</em>
888 wakaba 1.32
889 wakaba 1.36 </span><span class=ja-translation lang=ja><em>この節は規定の一部ではありません。</em></span><p class="no-ja-translation" data-ja-hash="12371907fb7e8389f76fabaf7a5f8303"><span class=en-original lang=en>Suppose that a cryptography library is made available that provides
890 wakaba 1.28 three tasks:
891    
892 wakaba 1.36 </span><dl>
893 wakaba 1.37 <dt class="has-ja-translation" data-ja-hash="6ea027035e660e254aba77f4bd9cb6e7"><span class=en-original lang=en>Generate a public/private key pair
894 wakaba 1.28
895 wakaba 1.37 </span><span class=ja-translation lang=ja>公開鍵・秘密鍵の組の生成</span><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 public key
896 wakaba 1.28 and then the private key.
897    
898 wakaba 1.36 </span><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
899 wakaba 1.28 cyphertext
900    
901 wakaba 1.36 </span><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 first
902 wakaba 1.28 giving the public key, and the remainder giving the plaintext, each of
903     which is encrypted and then sent on that same channel as the cyphertext.
904     The user can close the port when it is done encrypting content.
905    
906 wakaba 1.36 </span><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
907 wakaba 1.28 plaintext
908    
909 wakaba 1.36 </span><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 first
910 wakaba 1.28 giving the private key, and the remainder giving the cyphertext, each of
911     which is decrypted and then sent on that same channel as the plaintext.
912     The user can close the port when it is done decrypting content.
913 wakaba 1.36 </span></dl>
914 wakaba 1.28
915 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="0e39ac88e71e60206c341926e3785dcd"><span class=en-original lang=en>The library itself is as follows:
916 wakaba 1.28
917 wakaba 1.42 </span><span class=ja-translation lang=ja>ライブラリー自体は次のようになります。</span><pre class="no-ja-translation" data-ja-hash="ece93540f76bf50f9d9ac650f14a714c"><span class=en-original lang=en>function handleMessage(e) {
918     if (e.data == "genkeys")
919 wakaba 1.28 genkeys(e.port);
920 wakaba 1.42 else if (e.data == "encrypt")
921 wakaba 1.28 encrypt(e.port);
922 wakaba 1.42 else if (e.data == "decrypt")
923 wakaba 1.28 decrypt(e.port);
924     }
925    
926     function genkeys(p) {
927     var keys = _generateKeyPair();
928     p.postMessage(keys[0]);
929     p.postMessage(keys[1]);
930     }
931    
932     function encrypt(p) {
933     var key, state = 0;
934     p.onmessage = function (e) {
935     if (state == 0) {
936 wakaba 1.42 key = e.data;
937 wakaba 1.28 state = 1;
938     } else {
939 wakaba 1.42 p.postMessage(_encrypt(key, e.data));
940 wakaba 1.28 }
941     };
942     }
943    
944     function decrypt(p) {
945     var key, state = 0;
946     p.onmessage = function (e) {
947     if (state == 0) {
948 wakaba 1.42 key = e.data;
949 wakaba 1.28 state = 1;
950     } else {
951 wakaba 1.42 p.postMessage(_decrypt(key, e.data));
952 wakaba 1.28 }
953     };
954     }
955    
956 wakaba 1.29 // support being used as a shared worker as well as a dedicated worker
957     if (this.onmessage) // dedicated worker
958     onmessage = handleMessage;
959     else // shared worker
960     onconnect = function (e) { e.port.onmessage = handleMessage; }
961 wakaba 1.28
962    
963     // the "crypto" functions:
964    
965     function _generateKeyPair() {
966     return [Math.random(), Math.random()];
967     }
968    
969     function _encrypt(k, s) {
970     return 'encrypted-' + k + ' ' + s;
971     }
972    
973     function _decrypt(k, s) {
974     return s.substr(s.indexOf(' ')+1);
975 wakaba 1.36 }</span></pre>
976 wakaba 1.28
977 wakaba 1.36 <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 real
978 wakaba 1.28 cryptography.
979    
980 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="76f1d5866d92bc1036d1198cf4eda428"><span class=en-original lang=en>This library could be used as follows:
981 wakaba 1.28
982 wakaba 1.42 </span><span class=ja-translation lang=ja>このライブラリーは次のように使うことができます。</span><pre class="no-ja-translation" data-ja-hash="02df9ec9921dac18bca9782664a47c5b"><span class=en-original lang=en>&lt;!DOCTYPE HTML>
983 wakaba 1.28 &lt;html>
984     &lt;head>
985     &lt;title>Worker example: Crypto library&lt;/title>
986     &lt;script>
987 wakaba 1.29 var crytoLib = new Worker('libcrypto-v1.js'); // or could use 'libcrypto-v2.js'
988 wakaba 1.28 function getKeys() {
989     var state = 0;
990 wakaba 1.29 cryptoLib.startConversation("genkeys").onmessage = function (e) {
991 wakaba 1.28 if (state == 0)
992 wakaba 1.42 document.getElementById('public').value = e.data;
993 wakaba 1.28 else if (state == 1)
994 wakaba 1.42 document.getElementById('private').value = e.data;
995 wakaba 1.28 state += 1;
996     };
997     }
998     function enc() {
999 wakaba 1.29 var port = cryptoLib.startConversation("encrypt");
1000     port.postMessage(document.getElementById('public').value);
1001     port.postMessage(document.getElementById('input').value);
1002     port.onmessage = function (e) {
1003 wakaba 1.42 document.getElementById('input').value = e.data;
1004 wakaba 1.29 port.close();
1005 wakaba 1.28 };
1006     }
1007     function dec() {
1008 wakaba 1.29 var port = cryptoLib.startConversation("decrypt");
1009     port.postMessage(document.getElementById('private').value);
1010     port.postMessage(document.getElementById('input').value);
1011     port.onmessage = function (e) {
1012 wakaba 1.42 document.getElementById('input').value = e.data;
1013 wakaba 1.29 port.close();
1014 wakaba 1.28 };
1015     }
1016     &lt;/script>
1017     &lt;style>
1018     textarea { display: block; }
1019     &lt;/style>
1020     &lt;/head>
1021     &lt;body onload="getKeys()">
1022     &lt;fieldset>
1023     &lt;legend>Keys&lt;/legend>
1024 wakaba 1.29 &lt;p>&lt;label>Public Key: &lt;textarea id="public">&lt;/textarea>&lt;/label>&lt;/p>
1025     &lt;p>&lt;label>Private Key: &lt;textarea id="private">&lt;/textarea>&lt;/label>&lt;/p>
1026 wakaba 1.28 &lt;/fieldset>
1027 wakaba 1.29 &lt;p>&lt;label>Input: &lt;textarea id="input">&lt;/textarea>&lt;/label>&lt;/p>
1028 wakaba 1.28 &lt;p>&lt;button onclick="enc()">Encrypt&lt;/button> &lt;button onclick="dec()">Decrypt&lt;/button>&lt;/p>
1029     &lt;/body>
1030 wakaba 1.36 &lt;/html></span></pre>
1031 wakaba 1.28
1032 wakaba 1.36 <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 crypto
1033 wakaba 1.28 work onto subworkers. This could be done as follows:
1034    
1035 wakaba 1.42 </span><pre class="no-ja-translation" data-ja-hash="12b84d4be6a7f7bdc55d6f3ea37a96b3"><span class=en-original lang=en>function handleMessage(e) {
1036     if (e.data == "genkeys")
1037 wakaba 1.28 genkeys(e.port);
1038 wakaba 1.42 else if (e.data == "encrypt")
1039 wakaba 1.28 encrypt(e.port);
1040 wakaba 1.42 else if (e.data == "decrypt")
1041 wakaba 1.28 decrypt(e.port);
1042     }
1043    
1044     function genkeys(p) {
1045 wakaba 1.29 var generator = new Worker('libcrypto-v2-generator.js');
1046 wakaba 1.28 generator.postMessage('', p);
1047     }
1048    
1049     function encrypt(p) {
1050     p.onmessage = function (e) {
1051 wakaba 1.42 var key = e.data;
1052 wakaba 1.29 var encryptor = new Worker('libcrypto-v2-encryptor.js');
1053 wakaba 1.28 encryptor.postMessage(key, p);
1054     };
1055     }
1056    
1057     function encrypt(p) {
1058     p.onmessage = function (e) {
1059 wakaba 1.42 var key = e.data;
1060 wakaba 1.29 var decryptor = new Worker('libcrypto-v2-decryptor.js');
1061 wakaba 1.28 decryptor.postMessage(key, p);
1062     };
1063     }
1064    
1065 wakaba 1.29 // support being used as a shared worker as well as a dedicated worker
1066     if (this.onmessage) // dedicated worker
1067     onmessage = handleMessage;
1068     else // shared worker
1069     onconnect = function (e) { e.port.onmessage = handleMessage; }
1070 wakaba 1.36 </span></pre>
1071 wakaba 1.28
1072 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="fc1d14c413a94a9015153067739845e7"><span class=en-original lang=en>The little subworkers would then be as follows.
1073 wakaba 1.28
1074 wakaba 1.36 </span><span class=ja-translation lang=ja>小部分労働者は次の通りです。</span><p class="has-ja-translation" data-ja-hash="66f9c4d246b0081919ced7e46c4a9db2"><span class=en-original lang=en>For generating key pairs:
1075 wakaba 1.28
1076 wakaba 1.36 </span><span class=ja-translation lang=ja>鍵組の生成用:</span><pre class="no-ja-translation" data-ja-hash="69e6e4b66305b1a92aee9fcc2372196d"><span class=en-original lang=en>onmessage = function (e) {
1077 wakaba 1.29 var k = _generateKeyPair();
1078     e.port.postMessage(k[0]);
1079     e.port.postMessage(k[1]);
1080 wakaba 1.28 close();
1081     }
1082 wakaba 1.29
1083     function _generateKeyPair() {
1084     return [Math.random(), Math.random()];
1085 wakaba 1.36 }</span></pre>
1086 wakaba 1.28
1087 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="1f07f24df05f20de47483db4dfde2017"><span class=en-original lang=en>For encrypting:
1088 wakaba 1.28
1089 wakaba 1.42 </span><span class=ja-translation lang=ja>暗号化用:</span><pre class="no-ja-translation" data-ja-hash="efa3d6d66bd704b621cb5c4562d9a3cf"><span class=en-original lang=en>onmessage = function (e) {
1090     var key = e.data;
1091 wakaba 1.28 e.port.onmessage = function (e) {
1092 wakaba 1.42 var s = e.data;
1093 wakaba 1.29 postMessage(_encrypt(key, s));
1094 wakaba 1.28 }
1095 wakaba 1.29 e.port.onclose = function (e) {
1096 wakaba 1.28 close();
1097     }
1098 wakaba 1.29 }
1099    
1100     function _encrypt(k, s) {
1101     return 'encrypted-' + k + ' ' + s;
1102 wakaba 1.36 }</span></pre>
1103 wakaba 1.28
1104 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="abf884f40593747f458e7d7400b1eb21"><span class=en-original lang=en>For decrypting:
1105 wakaba 1.28
1106 wakaba 1.42 </span><span class=ja-translation lang=ja>解読用:</span><pre class="no-ja-translation" data-ja-hash="854f6f4811f0f485f12e062b97d487ce"><span class=en-original lang=en>onmessage = function (e) {
1107     var key = e.data;
1108 wakaba 1.28 e.port.onmessage = function (e) {
1109 wakaba 1.42 var s = e.data;
1110 wakaba 1.29 postMessage(_decrypt(key, s));
1111 wakaba 1.28 }
1112 wakaba 1.29 e.port.onclose = function (e) {
1113 wakaba 1.28 close();
1114     }
1115 wakaba 1.29 }
1116    
1117     function _decrypt(k, s) {
1118     return s.substr(s.indexOf(' ')+1);
1119 wakaba 1.36 }</span></pre>
1120 wakaba 1.28
1121 wakaba 1.36 <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 is
1122 wakaba 1.28 happening &mdash; the API hasn't changed; the library can delegate to
1123     subworkers without changing its API, even though it is accepting data
1124     using message channels.
1125    
1126 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="add583522732edb8aca6202c451ddb27" data-ja-real-hash="268a742b1731b3f55fd4ab398fa56d34"><span class=en-original lang=en><a href="http://www.whatwg.org/demos/workers/crypto/page.html">View this
1127 wakaba 1.32 example online</a>.
1128    
1129 wakaba 1.52 </span><span class=ja-translation lang=ja><a href="http://www.whatwg.org/demos/workers/crypto/page.html">この例をオンラインで表示する</a>。</span><h3 id=conformance-requirements class="has-ja-translation" data-ja-hash="05644f41fb2fbf61aaab52464b2edf3b"><span class=en-original lang=en><span class=secno>1.3 </span>Conformance
1130     requirements</span><span class=ja-translation lang=ja><span class=secno>1.3 </span>適合性要件</span></h3>
1131 wakaba 1.1
1132 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="8b0f72fe04577949924ab1e2997e0d8b"><span class=en-original lang=en>All diagrams, examples, and notes in this specification are
1133 wakaba 1.32 non-normative, as are all sections explicitly marked non-normative.
1134     Everything else in this specification is normative.
1135    
1136     </span><span class=ja-translation lang=ja>この仕様書のすべての図、例示、注意書き、ならびに規定の一部ではないと明記したすべての節は、
1137 wakaba 1.1 規定の一部ではありません。
1138 wakaba 1.36 この仕様書のそれ以外の部分はすべて規定の一部です。</span><p class="no-ja-translation" data-ja-hash="6b9cae822cc27a0168c340eee0cff438"><span class=en-original lang=en>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
1139 wakaba 1.31 NOT",-->
1140     "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the
1141     normative parts of this document are to be interpreted as described in
1142     RFC2119. For readability, these words do not appear in all uppercase
1143 wakaba 1.46 letters in this specification. <a href="#refsRFC2119">[RFC2119]</a>
1144 wakaba 1.1
1145 wakaba 1.46 </span><p class="has-ja-translation" data-ja-hash="63dc4357c416e0e0f292a5f662ca71ab"><span class=en-original lang=en>Requirements phrased in the imperative as part of algorithms (such as
1146 wakaba 1.32 "strip any leading space characters" or "return false and abort these
1147     steps") are to be interpreted with the meaning of the key word ("must",
1148     "should", "may", etc) used in introducing the algorithm.
1149    
1150     </span><span class=ja-translation lang=ja>算法の一部として<ins class=ja-note>動作の指示の形で (原文では</ins>命令形で<ins class=ja-note>) </ins>記述された要件
1151 wakaba 1.1 (例えば「先頭の間隔文字をすべて除去します」や「偽を返し、これらの段階を停止します」)
1152 wakaba 1.24 は、算法を紹介するに当たって使われたキーワード (<em class=rfc2119 title="MUST">しなければなりません</em>、
1153 wakaba 1.36 <em class=rfc2119 title="SHOULD">するべきです</em>、<em class=rfc2119 title="MAY">して構いません</em>など) の意味により解釈します。</span><p class="has-ja-translation" data-ja-hash="a5a0db584980ce3f2448983d6188b2d1"><span class=en-original lang=en>Some conformance requirements are phrased as requirements on attributes,
1154 wakaba 1.32 methods or objects. Such requirements are to be interpreted as
1155     requirements on user agents.
1156    
1157     </span><span class=ja-translation lang=ja>いくつかの適合性要件は属性やメソッドやオブジェクトの要件として説明されています。
1158 wakaba 1.36 そのような要件は、利用者エージェントに関する要件として解釈します。</span><p class="has-ja-translation" data-ja-hash="27386c326b98d878b3c408c60b6095b0"><span class=en-original lang=en>Conformance requirements phrased as algorithms or specific steps may be
1159 wakaba 1.32 implemented in any manner, so long as the end result is equivalent. (In
1160     particular, the algorithms defined in this specification are intended to
1161     be easy to follow, and not intended to be performant.)
1162    
1163     </span><span class=ja-translation lang=ja>算法や特定の段階として説明されている適合性要件は、
1164 wakaba 1.1 最終的な結果が等価である限り、任意の方法で実装して<em class=rfc2119 title="MAY">構いません</em>。
1165     (特に、この仕様書で定義されている算法は追うのを簡単にしており、
1166 wakaba 1.36 高性能であることを目指してはいません。)</span><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 agents.
1167 wakaba 1.32
1168 wakaba 1.36 </span><span class=ja-translation lang=ja>この仕様書で定義する唯一の適合性の級は利用者エージェントです。</span><p class="has-ja-translation" data-ja-hash="57959e6c42e8d5141b11e501bf60cc2f"><span class=en-original lang=en>User agents may impose implementation-specific limits on otherwise
1169 wakaba 1.32 unconstrained inputs, e.g. to prevent denial of service attacks, to guard
1170     against running out of memory, or to work around platform-specific
1171     limitations.
1172    
1173     </span><span class=ja-translation lang=ja>利用者エージェントは、サービス拒否攻撃を防ぐため、
1174 wakaba 1.1 記憶容量を使い尽くすことを防ぐため、
1175     あるいは環境特有の制限に対応するためなどの目的で、
1176 wakaba 1.42 別段の制約のない入力に対して実装特有の制限を設けて<em class=rfc2119 title="MAY">構いません</em>。</span><h4 id=dependencies class="has-ja-translation" data-ja-hash="896f4eaa4f12972b56ed9cdd9a90b949"><span class=en-original lang=en><span class=secno>1.3.1 </span>Dependencies</span><span class=ja-translation lang=ja><span class=secno>1.3.1 </span>依存性</span></h4>
1177 wakaba 1.1
1178 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="8dc27a34324d9e41d25c6bbbc2d2551c"><span class=en-original lang=en>This specification relies on several other underlying specifications.
1179 wakaba 1.32
1180     </span><span class=ja-translation lang=ja>この仕様書は、他のいくつかの下位の仕様書に依存しています。</span><dl>
1181 wakaba 1.36 <dt class="no-ja-translation" data-ja-hash="6bff62b10d884fb77428cfe168cd783d"><span class=en-original lang=en>HTML5
1182 wakaba 1.1
1183 wakaba 1.36 </span><dd>
1184     <p class="no-ja-translation" data-ja-hash="692ef0a750fa95ddb11f05608021ff02"><span class=en-original lang=en>Many fundamental concepts from HTML5 are used by this specification.
1185     <a href="#refsHTML5">[HTML5]</a></span></p>
1186 wakaba 1.1
1187 wakaba 1.36 <dt class="no-ja-translation" data-ja-hash="760145493119c1b42cb6fe0bbde08987"><span class=en-original lang=en>ECMAScript
1188 wakaba 1.1
1189 wakaba 1.36 </span><dd>
1190     <p class="no-ja-translation" data-ja-hash="9fbcf32dffdec6694cf4ea145ef5db36"><span class=en-original lang=en>This specification is intended to be used with JavaScript as the
1191     scripting language. <a href="#refsJS">[JS]</a></span></p>
1192 wakaba 1.1
1193 wakaba 1.36 <dt class="no-ja-translation" data-ja-hash="21838f6e93b1a2157b16dcb6281ff225"><span class=en-original lang=en>WebIDL
1194 wakaba 1.1
1195 wakaba 1.36 </span><dd>
1196     <p class="no-ja-translation" data-ja-hash="f0d2498c8bb497932f36ddf86e0cf1e4"><span class=en-original lang=en>The IDL blocks in this specification use the semantics of the WebIDL
1197     specification. <a href="#refsWebIDL">[WebIDL]</a></span></p>
1198 wakaba 1.1 </dl>
1199    
1200 wakaba 1.42 <h3 id=terminology class="has-ja-translation" data-ja-hash="e182a8a3f2adf774fb1c959df71b8600"><span class=en-original lang=en><span class=secno>1.4 </span>Terminology</span><span class=ja-translation lang=ja><span class=secno>1.4 </span>用語</span></h3>
1201 wakaba 1.32
1202 wakaba 1.46 <p class="has-ja-translation" data-ja-hash="f99630e4a7f12f2c4ecb88e02bf4a644"><span class=en-original lang=en>The construction "a <code title="">Foo</code> object", where <code
1203 wakaba 1.32 title="">Foo</code> is actually an interface, is sometimes used instead of
1204     the more accurate "an object implementing the interface <code
1205     title="">Foo</code>".
1206    
1207     </span><span class=ja-translation lang=ja>「<code title="">Foo</code> オブジェクト」という構文 (<code title="">Foo</code>
1208 wakaba 1.10 は実際には界面) を時々使いますが、より正確な「界面 <code title="">Foo</code>
1209 wakaba 1.36 を実装しているオブジェクト」の代わりに用いています。</span><p class="no-ja-translation" data-ja-hash="eb827c696acddeb1a8d0447095c94e07"><span class=en-original lang=en>The term DOM is used to refer to the API set made available to scripts
1210 wakaba 1.31 in Web applications, and does not necessarily imply the existence of an
1211     actual <code>Document</code> object or of any other <code>Node</code>
1212     objects as defined in the DOM Core specifications. <a
1213     href="#refsDOM3CORE">[DOM3CORE]</a>
1214    
1215 wakaba 1.36 </span><p class="has-ja-translation" data-ja-hash="5b9242da79aeab74bccc57781ac3103e"><span class=en-original lang=en>A DOM attribute is said to be <em>getting</em> when its value is being
1216 wakaba 1.32 retrieved (e.g. by author script), and is said to be <em>setting</em> when
1217     a new value is assigned to it.
1218    
1219     </span><span class=ja-translation lang=ja>DOM 属性は、その値が (例えば著者のスクリプトにより) 取り出される時<em>取得される</em>といい、
1220 wakaba 1.50 新しい値がその属性に割り当てられる時<em>設定される</em>といいます。</span><h2 id=infrastructure class="has-ja-translation" data-ja-hash="cba4f4cee5c6a3e6d8be8da68fa1234e"><span class=en-original lang=en><span class=secno>2 </span>Infrastructure</span><span class=ja-translation lang=ja><span class=secno>2 </span>基盤</span></h2>
1221 wakaba 1.9
1222 wakaba 1.42 <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 workers.
1223 wakaba 1.29 Dedicated workers, once created, and are linked to their creator; but
1224     message ports can be used to communicate from a dedicated worker to
1225 wakaba 1.42 multiple other browsing contexts or workers. Shared workers, on the other
1226 wakaba 1.29 hand, are named, and once created any script running in the same
1227     <span>origin</span> can obtain a reference to that worker and communicate
1228     with it.
1229    
1230 wakaba 1.52 </span><h3 id=the-global-scope class="has-ja-translation" data-ja-hash="16d7670f16b3aaf6130252e8f11702eb"><span class=en-original lang=en><span class=secno>2.1 </span>The global scope</span><span class=ja-translation lang=ja><span class=secno>2.1 </span>大域作用域</span></h3>
1231 wakaba 1.29
1232 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="216dee088449fef485a489ea8a7432f4"><span class=en-original lang=en>The global scope is the "inside" of a worker.
1233 wakaba 1.29
1234 wakaba 1.52 </span><span class=ja-translation lang=ja>大域作用域は労働者の「内側」です。</span><h4 id=the-workerglobalscope-abstract-interface class="has-ja-translation" data-ja-hash="fe5227371e801f4ac588d0d07472a900" data-ja-real-hash="cc17376e4eee7e97d5ab420959bcac76"><span class=en-original lang=en><span class=secno>2.1.1
1235     </span>The <code><a href="#workerglobalscope">WorkerGlobalScope</a></code>
1236     abstract interface</span><span class=ja-translation lang=ja><span class=secno>2.1.1
1237     </span><code><a href="#workerglobalscope">WorkerGlobalScope</a></code> 抽象界面</span></h4>
1238 wakaba 1.9
1239     <pre
1240 wakaba 1.50 class="idl no-ja-translation" data-ja-hash="330e32b358fd04f4f8631c7d12551185"><span class=en-original lang=en>interface <dfn id=workerglobalscope>WorkerGlobalScope</dfn> {
1241 wakaba 1.22 readonly attribute <a href="#workerglobalscope">WorkerGlobalScope</a> <a href="#self" title=dom-WorkerGlobalScope-self>self</a>;
1242 wakaba 1.23 readonly attribute <a href="#workerlocation">WorkerLocation</a> <a href="#location" title=dom-WorkerGlobalScope-location>location</a>;
1243 wakaba 1.29 // also implements everything on <a href="#workerutils">WorkerUtils</a>
1244    
1245 wakaba 1.22 void <a href="#close" title=dom-WorkerGlobalScope-close>close</a>();
1246 wakaba 1.29 attribute <span>EventListener</span> <a href="#onclose" title=handler-WorkerGlobalScope-onclose>onclose</a>;
1247 wakaba 1.48 attribute <span>EventListener</span> <a href="#onerror" title=handler-WorkerGlobalScope-onerror>onerror</a>;
1248 wakaba 1.36 };</span></pre>
1249 wakaba 1.9
1250 wakaba 1.42 <p class="no-ja-translation" data-ja-hash="1eaadf1fd34d0295b8799d73be1a9135"><span class=en-original lang=en>Objects implementing the <code><a
1251     href="#workerglobalscope">WorkerGlobalScope</a></code> interface must also
1252     implement the <code>EventTarget</code> interface.
1253 wakaba 1.23
1254 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="087af626d2f79d49dcf366c0227c32c0"><span class=en-original lang=en>The <dfn id=self
1255 wakaba 1.22 title=dom-WorkerGlobalScope-self><code>self</code></dfn> attribute must
1256     return the <code><a href="#workerglobalscope">WorkerGlobalScope</a></code>
1257     object itself.
1258    
1259 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="8e9bf18a7820b4401892ba71daf05527"><span class=en-original lang=en>The <dfn id=location
1260 wakaba 1.23 title=dom-WorkerGlobalScope-location><code>location</code></dfn> attribute
1261     must return the <code><a href="#workerlocation">WorkerLocation</a></code>
1262     object created for the <code><a
1263     href="#workerglobalscope">WorkerGlobalScope</a></code> object when the
1264     worker was created. It represents the <span>absolute URL</span> of the
1265     script that was used to initialize the worker.
1266 wakaba 1.22
1267 wakaba 1.36 </span><hr>
1268 wakaba 1.29
1269 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="4613c16766e1a2533e8acb2824c6f9fe"><span class=en-original lang=en>When a script invokes the <dfn id=close
1270 wakaba 1.29 title=dom-WorkerGlobalScope-close><code>close()</code></dfn> method on a
1271     <code><a href="#workerglobalscope">WorkerGlobalScope</a></code> object,
1272     the user agent must run the following steps:
1273    
1274 wakaba 1.36 </span><ol>
1275 wakaba 1.29 <li>
1276 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="60169fead4ccffa67d9a836cd2db0eda"><span class=en-original lang=en><span>Queue a task</span> to <span>fire a simple event</span> called
1277     <code title=event-close>close</code> at the <code><a
1278     href="#workerglobalscope">WorkerGlobalScope</a></code> object.
1279 wakaba 1.29
1280 wakaba 1.36 </span><li>
1281     <p class="no-ja-translation" data-ja-hash="6243c3e4951724a3633743634fccb06e"><span class=en-original lang=en>Set the worker's <code><a
1282 wakaba 1.29 href="#workerglobalscope">WorkerGlobalScope</a></code> object's <a
1283     href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag to
1284     true.
1285    
1286 wakaba 1.36 </span><li>
1287 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="facd4a44e5a83273873024773bc8359e"><span class=en-original lang=en>For each <code>MessagePort</code> object that is entangled with
1288 wakaba 1.29 another port and that has one (but only one) port whose owner is the
1289     <code><a href="#workerglobalscope">WorkerGlobalScope</a></code> object
1290     on which the method was invoked (this would include, for instance, the
1291 wakaba 1.46 implicit port in used for dedicated workers), unentangle the two ports.
1292     </span></ol>
1293 wakaba 1.9
1294 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="3df99fd92cbc7213b4f00b8953997403"><span class=en-original lang=en>The following are the <span>event handler DOM attributes</span> that
1295 wakaba 1.22 must be supported by objects implementing the <code><a
1296     href="#workerglobalscope">WorkerGlobalScope</a></code> interface:
1297    
1298 wakaba 1.36 </span><dl>
1299     <dt class="no-ja-translation" data-ja-hash="96d62a92c59fca4cd2589c560425090f"><span class=en-original lang=en><dfn id=onclose
1300 wakaba 1.29 title=handler-WorkerGlobalScope-onclose><code>onclose</code></dfn>
1301 wakaba 1.11
1302 wakaba 1.36 </span><dd>
1303     <p class="has-ja-translation" data-ja-hash="91a2ce3a21f7ed687afe756baa5387d8" data-ja-real-hash="1388215c8f7c8c11b36e9c90d06b48e3"><span class=en-original lang=en>Must be invoked whenever a <code title=event-close>close</code> event
1304 wakaba 1.32 is targeted at or bubbles through the <code><a
1305     href="#workerglobalscope">WorkerGlobalScope</a></code> object.
1306 wakaba 1.48
1307     </span><span class=ja-translation lang=ja><code title=event-close>close</code> 事象が当該 <code><a href="#workerglobalscope">WorkerGlobalScope</a></code> オブジェクトを対象としているか、泡立って当該オブジェクトを通過する時に、
1308     呼び出されなければなりません。</span><dt class="no-ja-translation" data-ja-hash="218f1d215c51e4b4df0c668fe3526b03"><span class=en-original lang=en><dfn id=onerror
1309     title=handler-WorkerGlobalScope-onerror><code>onerror</code></dfn>
1310    
1311     </span><dd>
1312 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="5fd473ab04adf1430f12edcf14d79738"><span class=en-original lang=en>Must be invoked whenever an <code title=event-error>error</code> event
1313     is targeted at or bubbles through the <code><a
1314     href="#workerglobalscope">WorkerGlobalScope</a></code> object.
1315 wakaba 1.48 </span></dl>
1316 wakaba 1.29
1317 wakaba 1.52 <h4 id=dedicated-workers-and-the-dedicatedworke class="no-ja-translation" data-ja-hash="01e2b66319613f26fcb4ea361d2009e4"><span class=en-original lang=en><span class=secno>2.1.2
1318     </span>Dedicated workers and the <code><a
1319 wakaba 1.29 href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1320 wakaba 1.36 interface</span></h4>
1321 wakaba 1.50 <!-- the XXX below is for collapsing this interface onto WorkerGlobalScope so it looks like just one interface - the inheritance is a spec fiction only -->
1322 wakaba 1.29
1323     <pre
1324 wakaba 1.50 class="idl no-ja-translation" data-ja-hash="817afbdc0867386ba16e8a0ed83a2c3b"><span class=en-original lang=en>[NoInterfaceObject, XXX] interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href="#workerglobalscope">WorkerGlobalScope</a> {
1325     void <a href="#postmessage" title=dom-DedicatedWorkerGlobalScope-postMessage>postMessage</a>(in any message, [Optional] in <span>MessagePort</span> messagePort);<!--
1326     <span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(in any message);-->
1327 wakaba 1.29 attribute <span>EventListener</span> <a href="#onmessage" title=handler-DedicatedWorkerGlobalScope-onmessage>onmessage</a>;
1328 wakaba 1.36 };</span></pre>
1329 wakaba 1.29
1330 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="c6ea7d83d489d6962a5dafa4cb9883ac"><span class=en-original lang=en><code><a
1331 wakaba 1.29 href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1332     objects act as if they had an implicit <code>MessagePort</code> associated
1333     with them. This port is part of a channel that is set up when the worker
1334     is created, but it is not exposed. This object must never be garbage
1335     collected before the <code><a
1336     href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1337     object.
1338    
1339 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="cd46f0a484fa815888d26bffc00cd30a"><span class=en-original lang=en>All messages received by that port must immediately be retargetted at
1340 wakaba 1.29 the <code><a
1341     href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1342     object.
1343    
1344 wakaba 1.42 </span><p class="no-ja-translation" data-ja-hash="c343842e8ec7635e987fef78935dd0ae"><span class=en-original lang=en>The <dfn id=postmessage
1345     title=dom-DedicatedWorkerGlobalScope-postMessage><code>postMessage()</code></dfn><!--
1346     and <dfn
1347     title="dom-DedicatedWorkerGlobalScope-startConversation"><code>startConversation()</code></dfn>-->
1348     method<!--s (startConversation)--> on <code><a
1349 wakaba 1.29 href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1350 wakaba 1.42 objects must act as if, when invoked, it<!--/they (startConversation)-->
1351     immediately invoked the method of the same name on the port, with the same
1352     arguments, and returned the same return value.
1353 wakaba 1.29
1354 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="a1ce69c9e43bed80103920cd0e52253e"><span class=en-original lang=en>The following are the <span>event handler DOM attributes</span> that
1355 wakaba 1.29 must be supported by objects implementing the <code><a
1356     href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1357     interface:
1358    
1359 wakaba 1.36 </span><dl>
1360     <dt class="no-ja-translation" data-ja-hash="160334ee188f54bd11cad6927542df5d"><span class=en-original lang=en><dfn id=onmessage
1361 wakaba 1.29 title=handler-DedicatedWorkerGlobalScope-onmessage><code>onmessage</code></dfn>
1362 wakaba 1.11
1363 wakaba 1.36 </span><dd>
1364     <p class="has-ja-translation" data-ja-hash="91a2ce3a21f7ed687afe756baa5387d8" data-ja-real-hash="693bf14ecd01b81e9953c2197c4ce97b"><span class=en-original lang=en>Must be invoked whenever a <code
1365 wakaba 1.32 title=event-DedicatedWorkerGlobalScope-message>message</code> event is
1366     targeted at or bubbles through the <code><a
1367     href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1368     object.
1369     </span><span class=ja-translation lang=ja><code title=event-DedicatedWorkerGlobalScope-message>message</code> 事象が当該 <code><a href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code> オブジェクトを対象としているか、泡立って当該オブジェクトを通過する時に、
1370 wakaba 1.12 呼び出されなければなりません。</span></dl>
1371 wakaba 1.11
1372 wakaba 1.52 <h4 id=shared-workers-and-the-sharedworkergloba class="no-ja-translation" data-ja-hash="da49a2eed6f0ff2e53a41e7fe6e36a3a"><span class=en-original lang=en><span class=secno>2.1.3
1373     </span>Shared workers and the <code><a
1374 wakaba 1.29 href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
1375 wakaba 1.36 inteface</span></h4>
1376 wakaba 1.50 <!-- the XXX below is for collapsing this interface onto WorkerGlobalScope so it looks like just one interface - the inheritance is a spec fiction only -->
1377 wakaba 1.29
1378     <pre
1379 wakaba 1.50 class="idl no-ja-translation" data-ja-hash="26beedd870e9a7ebdb290905ca86d932"><span class=en-original lang=en>[NoInterfaceObject, XXX] interface <dfn id=sharedworkerglobalscope>SharedWorkerGlobalScope</dfn> : <a href="#workerglobalscope">WorkerGlobalScope</a> {
1380 wakaba 1.29 readonly attribute DOMString <a href="#name" title=dom-SharedWorkerGlobalScope-name>name</a>;
1381     attribute <span>EventListener</span> <a href="#onconnect" title=handler-SharedWorkerGlobalScope-onconnect>onconnect</a>;
1382 wakaba 1.36 };</span></pre>
1383 wakaba 1.29
1384 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="9d344498c69a5ed60029b76fb274beb2"><span class=en-original lang=en>Shared workers receive message ports through <code
1385 wakaba 1.29 title=event-WorkerGlobalScope-connect>connect</code> events on their
1386     global object for each connection.
1387    
1388 wakaba 1.36 </span><span class=ja-translation lang=ja>共有労働者は、各接続について大域オブジェクトの <code
1389 wakaba 1.52 title=event-WorkerGlobalScope-connect>connect</code> 事象を通じてメッセージ・ポートを受信します。</span><p class="no-ja-translation" data-ja-hash="651a31b192bd53ce7f71d3112566c737"><span class=en-original lang=en>The <dfn id=name
1390 wakaba 1.29 title=dom-SharedWorkerGlobalScope-name><code>name</code></dfn> attribute
1391     must return the value it was assigned when the <code><a
1392     href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code> object
1393 wakaba 1.52 was created by the "<a href="#run-a-worker">run a worker</a>" algorithm.
1394     Its value represents the name that can be used to obtain a reference to
1395     the worker using the <code><a href="#sharedworker">SharedWorker</a></code>
1396 wakaba 1.29 constructor.
1397    
1398 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="586e890e429389a63f2656c2d194935f"><span class=en-original lang=en>The following are the <span>event handler DOM attributes</span> that
1399 wakaba 1.29 must be supported by objects implementing the <code><a
1400     href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
1401     interface:
1402    
1403 wakaba 1.36 </span><dl>
1404     <dt class="no-ja-translation" data-ja-hash="bb403ab8991a4f893a1ad1d0ffad30b0"><span class=en-original lang=en><dfn id=onconnect
1405 wakaba 1.29 title=handler-SharedWorkerGlobalScope-onconnect><code>onconnect</code></dfn>
1406    
1407 wakaba 1.36 </span><dd>
1408     <p class="has-ja-translation" data-ja-hash="91a2ce3a21f7ed687afe756baa5387d8" data-ja-real-hash="848b5a001778cd88e138b16d00959122"><span class=en-original lang=en>Must be invoked whenever a <code
1409 wakaba 1.32 title=event-SharedWorkerGlobalScope-connect>connect</code> event is
1410     targeted at or bubbles through the <code><a
1411     href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
1412     object.
1413     </span><span class=ja-translation lang=ja><code title=event-SharedWorkerGlobalScope-connect>connect</code> 事象が当該 <code><a href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code> オブジェクトを対象としているか、泡立って当該オブジェクトを通過する時に、
1414 wakaba 1.29 呼び出されなければなりません。</span></dl>
1415 wakaba 1.23
1416 wakaba 1.52 <h3 id=base-urls-and-origins-of-workers class="has-ja-translation" data-ja-hash="87cf5066db3fe786def6b713cf422c90"><span class=en-original lang=en><span class=secno>2.2 </span>Base
1417     URLs and origins of workers</span><span class=ja-translation lang=ja><span class=secno>2.2 </span>労働者の基底 URL と起源</span></h3>
1418 wakaba 1.16
1419 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="7f0ec0a21b0d5485348f47fb8c3ac07a"><span class=en-original lang=en>Both the <span>origin</span> and <span>effective script origin</span> of
1420 wakaba 1.22 scripts running in workers are the <span>origin</span> of the
1421 wakaba 1.46 <span>absolute URL</span> given in that the worker's <code
1422 wakaba 1.23 title=dom-WorkerGlobalScope-location><a
1423     href="#location">location</a></code> attribute represents.
1424 wakaba 1.22
1425 wakaba 1.52 </span><h3 id=the-event-loop class="no-ja-translation" data-ja-hash="96715962ce61ea28085d7e170ec30e73"><span class=en-original lang=en><span class=secno>2.3 </span>The event loop</span></h3>
1426 wakaba 1.22
1427 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4cf906d54465dc9ce5dff2f4ec35a160"><span class=en-original lang=en>Each <code><a href="#workerglobalscope">WorkerGlobalScope</a></code>
1428 wakaba 1.46 object is asssociated with a <span>event loop</span>. This <span>event
1429     loop</span> has no associated <span>browsing context</span>, and its <span
1430     title="task queue">task queues</span> only have events, callbacks, and
1431     networking activity as <span title=concept-task>tasks</span>. The
1432     processing model of these <span title="event loop">event loops</span> is
1433 wakaba 1.52 defined below in the <a href="#run-a-worker">run a worker</a> algorithm.
1434 wakaba 1.31
1435 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="3c5a8b0b9b710969e93d11ed5ae2ce7e"><span class=en-original lang=en>Each <code><a href="#workerglobalscope">WorkerGlobalScope</a></code>
1436 wakaba 1.29 object also has a <dfn id=closing
1437     title=dom-WorkerGlobalScope-closing>closing</dfn> flag, which must
1438     initially be false, but which can get set to true by the algorithms in the
1439     processing model section below.
1440    
1441 wakaba 1.46 </span><p class="no-ja-translation" data-ja-hash="f6e75a83e42204ac3c8508f490737285"><span class=en-original lang=en>Once the <code><a
1442 wakaba 1.29 href="#workerglobalscope">WorkerGlobalScope</a></code>'s <a
1443     href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag is
1444 wakaba 1.46 set to true, the <span>event loop</span>'s <span title="task queue">task
1445     queues</span> must discard any further <span
1446     title=concept-task>tasks</span> that would be added to them (tasks already
1447     on the queue are unaffected unless otherwise specified). Effectively, once
1448     the <a href="#closing" title=dom-WorkerGlobalScope-closing>closing</a>
1449     flag is true, timers stop firing, notifications for all pending
1450     asynchronous operations are dropped, etc.
1451 wakaba 1.22
1452 wakaba 1.52 </span><h3 id=the-workers-ports class="has-ja-translation" data-ja-hash="b0a758845322b24463d7ebe35160f526"><span class=en-original lang=en><span class=secno>2.4 </span>The worker's ports</span><span class=ja-translation lang=ja><span class=secno>2.4 </span>労働者のポート</span></h3>
1453 wakaba 1.11
1454 wakaba 1.36 <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
1455 wakaba 1.32 context">browsing contexts</span> through <span title="channel
1456     messaging">message channels</span> and their <code>MessagePort</code>
1457     objects.
1458    
1459     </span><span class=ja-translation lang=ja>労働者は、メッセージ通信路とその <code>MessagePort</code>
1460 wakaba 1.52 オブジェクトを通じて、他の労働者や閲覧文脈と通信します。</span><p class="no-ja-translation" data-ja-hash="07ffa6a69fa49518128a9ffcc4e81b77"><span class=en-original lang=en>Each <code><a href="#workerglobalscope">WorkerGlobalScope</a></code>
1461 wakaba 1.29 <var title="">worker global scope</var> has a list of <dfn
1462 wakaba 1.52 id=the-workers-ports0>the worker's ports</dfn>, which consists of all the
1463 wakaba 1.29 <code>MessagePort</code> objects that are entangled with another port and
1464     that have one (but only one) port owned by <var title="">worker global
1465 wakaba 1.43 scope</var>. This list includes
1466     <!--all the <code>MessagePort</code> objects that are in events
1467 wakaba 1.46 pending in the <span>event loop</span>, as well as (commented out
1468     because in practice it makes no difference either way as far as I
1469     can tell, and it would be hard to strictly implement since these
1470 wakaba 1.43 ports might not yet be across the thread boundary)-->
1471     the implicit <code>MessagePort</code> in the case of <a
1472 wakaba 1.29 href="#dedicatedworkerglobalscope"
1473     title=DedicatedWorkerGlobalScope>dedicated workers</a>.
1474 wakaba 1.16
1475 wakaba 1.36 </span><hr>
1476 wakaba 1.16
1477 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="d179c3a965c7114b941eb9f6055e4539"><span class=en-original lang=en>A worker is said to be a <dfn id=permissible-worker>permissible
1478     worker</dfn> if either:
1479 wakaba 1.23
1480 wakaba 1.36 </span><ul>
1481     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="1408e830059dcfb69df672a38b4b1286"><span class=en-original lang=en>at some point past or present a <code>MessagePort</code> owned by the
1482 wakaba 1.23 worker was entangled with a <code>MessagePort</code> <var
1483     title="">p</var> whose owner is a <code>Window</code> object whose
1484     <span>active document</span> is the <code>Document</code> that was that
1485     <span>browsing context</span>'s <span>active document</span> when <var
1486     title="">p</var> was created, and that <code>Document</code> is
1487     <span>fully active</span>, or
1488    
1489 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="6e85367f7ba3f822a1bc102a7cdc3a36"><span class=en-original lang=en>at some point past or present a <code>MessagePort</code> owned by the
1490 wakaba 1.23 worker was entangled with a <code>MessagePort</code> owned by another
1491 wakaba 1.52 worker that is currently a <a href="#permissible-worker">permissible
1492     worker</a>.
1493 wakaba 1.36 </span></ul>
1494 wakaba 1.23
1495     <hr>
1496    
1497 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="e28a47461e2800f81adbe89d9ba7ddc0"><span class=en-original lang=en>A worker is said to be a <dfn id=protected-worker>protected worker</dfn>
1498     if either:
1499 wakaba 1.23
1500 wakaba 1.52 </span><ul>
1501     <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="308984805a6b6a74a20cd2d7f376ea15"><span class=en-original lang=en>it has outstanding timers, database transactions, or network
1502     connections, and is a <a href="#permissible-worker">permissible
1503     worker</a>, or
1504    
1505     </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ffae9b03e692b5ab154161d912ee89cb"><span class=en-original lang=en>there is a <a href="#protected-worker">protected worker</a> that at
1506     some point past or present owned a <code>MessagePort</code> that was
1507     entangled with a <code>MessagePort</code> owned by this worker.
1508 wakaba 1.36 </span></ul>
1509 wakaba 1.23
1510     <hr>
1511    
1512 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="0f35ba0a68fecabc0a9dc78ba90d72b6"><span class=en-original lang=en>A worker is said to be an <dfn id=active-needed-worker>active needed
1513     worker</dfn> if either:
1514 wakaba 1.23
1515 wakaba 1.36 </span><ul>
1516 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="56971cb1ef44fc323deb6beab7ff03e4"><span class=en-original lang=en>the worker is a <a href="#protected-worker">protected worker</a>, or
1517 wakaba 1.23
1518 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="bd1a89f3fa4f1173529f60f5b868bdfd"><span class=en-original lang=en>at least one of the <a href="#the-workers-ports0">the worker's
1519     ports</a> is entangled with a <code>MessagePort</code> <var
1520     title="">p</var> whose owner is a <code>Window</code> object whose
1521     <span>active document</span> is the <code>Document</code> that was that
1522     <span>browsing context</span>'s <span>active document</span> when that
1523 wakaba 1.23 <code>MessagePort</code> <var title="">p</var> was created, and that
1524     <code>Document</code> is <span>fully active</span>, or
1525 wakaba 1.22
1526 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="ce647edb7e33afe85b0d129c19d90d90"><span class=en-original lang=en>at least one of the <a href="#the-workers-ports0">the worker's
1527     ports</a> has an entangled <code>MessagePort</code> owned by a <code><a
1528 wakaba 1.22 href="#workerglobalscope">WorkerGlobalScope</a></code> object that is
1529 wakaba 1.52 itself an <a href="#active-needed-worker">active needed worker</a>.
1530 wakaba 1.36 </span></ul>
1531 wakaba 1.22
1532     <hr>
1533    
1534 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="e17bda5e82400e59a9f5ae009aae5669"><span class=en-original lang=en>A worker is said to be a <dfn id=suspendable-worker>suspendable
1535     worker</dfn> if it is not an <a href="#active-needed-worker">active needed
1536     worker</a> but either:
1537 wakaba 1.22
1538 wakaba 1.36 </span><ul>
1539 wakaba 1.52 <li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="1ccf5cb6b988823826648a79907f89a0"><span class=en-original lang=en>at least one of the <a href="#the-workers-ports0">the worker's
1540     ports</a> has an entangled <code>MessagePort</code> owned by a
1541     <code>Window</code> object, or
1542 wakaba 1.23
1543 wakaba 1.52 </span><li><p class="no-ja-translation ja-translation-inserted" data-ja-hash="fd115e2420872ba67adf26e4d91185db"><span class=en-original lang=en>at least one of the <a href="#the-workers-ports0">the worker's
1544     ports</a> has an entangled <code>MessagePort</code> owned by a <code><a
1545 wakaba 1.22 href="#workerglobalscope">WorkerGlobalScope</a></code> object that is
1546 wakaba 1.23 itself a <span>needed worker</span>.
1547 wakaba 1.36 </span></ul>
1548 wakaba 1.16
1549 wakaba 1.52 <h3 id=processing-model class="has-ja-translation" data-ja-hash="4eeffb677544f6c8799408c6b9021b4c"><span class=en-original lang=en><span class=secno>2.5 </span>Processing model</span><span class=ja-translation lang=ja><span class=secno>2.5 </span>処理モデル</span></h3>
1550 wakaba 1.12
1551 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="c45c1611a5572d560022f94383f4daf7"><span class=en-original lang=en>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a
1552     script with <span>URL</span> <var title="">url</var>, a browsing context
1553     <var title="">owner browsing context</var>, and with global scope <var
1554 wakaba 1.46 title="">worker global scope</var>, it must run the following steps:
1555    
1556     </span><ol>
1557 wakaba 1.12 <li>
1558 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="6fdced8613c508a9db62b2a4bec3fba3"><span class=en-original lang=en>Create a completely separate and parallel execution environment (i.e.
1559 wakaba 1.30 a separate thread or process or equivalent construct), and run the rest
1560 wakaba 1.36 of these steps asychronously in that context.</span><span class=ja-translation lang=ja>完全に分離された並列の実行環境 (すなわち、別のスレッドやプロセスや等価な構造体) を作り、
1561     その文脈で非同期にこれらの段階の残りを走らせます。</span></p>
1562 wakaba 1.30
1563     <li>
1564 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="83920af54821d7c307267e9565d86ea3"><span class=en-original lang=en>Attempt to <span>fetch</span> the resource identified by <var
1565     title="">url</var>.</span></p>
1566 wakaba 1.12
1567 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="bd3c788d8aac4638e1c6ca88e26d3d47"><span class=en-original lang=en>If the attempt fails, then for each <code><a
1568     href="#worker">Worker</a></code> or <code><a
1569 wakaba 1.46 href="#sharedworker">SharedWorker</a></code> object associated with <var
1570     title="">worker global scope</var>, <span>queue a task</span> to
1571     <span>fire a simple event</span> called <code
1572     title=event-error>error</code> at that object. Abort these steps.</span></p>
1573    
1574     <p class="no-ja-translation" data-ja-hash="5f99e80db6dd85e61521ca081da0a897"><span class=en-original lang=en>If the attempt succeeds, then let <var title="">source</var> be the
1575     text of the resource that was obtained.</span></p>
1576     <!-- XXX do we need
1577     to define character encoding decoding here? -->
1578     <p class="no-ja-translation" data-ja-hash="c880bce97c5a1aadccd8989fc4ec8551"><span class=en-original lang=en>Let <var title="">language</var> be JavaScript.</span></p>
1579 wakaba 1.12
1580 wakaba 1.36 <p class="note has-ja-translation" data-ja-hash="5ba762159d9de3f8bd326fe0bcfac206"><span class=en-original lang=en>As with <code>script</code> elements, the MIME type of the
1581 wakaba 1.32 script is ignored. Unlike with <code>script</code> elements, there is no
1582     way to override the type. It's always assumed to be JavaScript.</span><span class=ja-translation lang=ja><code>script</code> 要素と同様に、スクリプトの MIME 型は無視します。
1583 wakaba 1.12 <code>script</code> 要素とは異なり、
1584     型を上書きする方法はありません。スクリプトは常に JavaScript
1585     と仮定します。</span></p>
1586 wakaba 1.11 <!-- XXX people will complain about
1587     this. I guess we might want to examine the MIME type... -->
1588    
1589    
1590     <li>
1591 wakaba 1.46 <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 created, as
1592     follows.</span></p>
1593 wakaba 1.23
1594 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="2dfcd0f76cde607de6cc88d70f390825"><span class=en-original lang=en>Create a new <span>script execution environment</span> set up as
1595     appropriate for the scripting language <var title="">language</var>.</span></p>
1596    
1597     <p class="no-ja-translation" data-ja-hash="fdf8b5f9ba18a31a8f48670142f51442"><span class=en-original lang=en>Parse/compile/initialize <var title="">source</var> using that
1598     <span>script execution environment</span>, as appropriate for <var
1599     title="">language</var>, and thus obtain a <span>list of code
1600     entry-points</span>; set the <i>initial code entry-point</i> to the
1601     entry-point for any executable code to be immediately run.</span></p>
1602    
1603     <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
1604 wakaba 1.36 global scope</var>.</span></p>
1605 wakaba 1.9
1606 wakaba 1.46 <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
1607     browsing context</var>.</span></p>
1608    
1609     <p class="no-ja-translation" data-ja-hash="99ad90cb28611ed3165f61e920e91176"><span class=en-original lang=en>Set the <span>script's character encoding</span> to UTF-8. (This is
1610     just used for encoding non-ASCII characters in the query component of
1611     URLs.)</span></p>
1612    
1613     <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>
1614 wakaba 1.9
1615 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="9f54fba41a34171b216a6a1d3c585815"><span class=en-original lang=en>Create a new <span>script group</span> and add the <span
1616     title=concept-script>script</span> to it.</span></p>
1617 wakaba 1.9
1618     <li>
1619 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="0ef64ab9ab35499d2458827d1d9d786d"><span class=en-original lang=en><strong>Closing orphan workers</strong>: Start monitoring the worker
1620     such that as soon as it stops being either an <a
1621     href="#active-needed-worker">active needed worker</a> or a <a
1622     href="#suspendable-worker">suspendable worker</a>, <var title="">worker
1623     global scope</var>'s <a href="#closing"
1624 wakaba 1.29 title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true and
1625 wakaba 1.46 <span title="queue a task">a task is queued</span> to <span>fire a
1626     simple event</span> called <code title=event-close>close</code> at <var
1627     title="">worker global scope</var>.</span></p>
1628 wakaba 1.29
1629     <li>
1630 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="33e71193866fc33d05099790b3ed6ef3"><span class=en-original lang=en><strong>Suspending workers</strong>: Start monitoring the worker, such
1631 wakaba 1.46 that whenever <var title="">worker global scope</var>'s <a
1632 wakaba 1.29 href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag is
1633 wakaba 1.52 false and the worker is a <a href="#suspendable-worker">suspendable
1634     worker</a>, the user agent suspends execution of script in that worker
1635     until such time as either the <a href="#closing"
1636 wakaba 1.29 title=dom-WorkerGlobalScope-closing>closing</a> flag switches to true or
1637 wakaba 1.52 the worker stops being a <a href="#suspendable-worker">suspendable
1638     worker</a>.</span></p>
1639 wakaba 1.29
1640     <li>
1641 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="df6a7097d669676339c537263c6df4d2"><span class=en-original lang=en><span title="jump to a code entry-point">Jump</span> to the <span
1642 wakaba 1.46 title=concept-script>script</span>'s <i>initial code entry-point</i>,
1643     and let that run until it either returns, fails to catch an exception,
1644 wakaba 1.52 or gets prematurely aborted by the "<a href="#kill-a-worker">kill a
1645     worker</a>" or "<a href="#terminate-a-worker">terminate a worker</a>"
1646     algorithms defined below.</span></p>
1647    
1648     <p class="note no-ja-translation" data-ja-hash="492d2400f92aadada78cb4659bb8c5d8"><span class=en-original lang=en>If the script gets aborted by the "<a
1649     href="#kill-a-worker">kill a worker</a>" algorithm, then that same
1650     algorithm will cause there to only be a single <span
1651     title=concept-task>task</span> in the <span>event loop</span> at the
1652     next step, namely the task for the <code
1653 wakaba 1.46 title=message-close>close</code> event. The "<a
1654 wakaba 1.52 href="#terminate-a-worker">terminate a worker</a>" algorithm removes all
1655     the events.</span></p>
1656 wakaba 1.9
1657     <li>
1658 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="6e519912f34fcb58933d31516eec2c61"><span class=en-original lang=en><i title="">Event loop</i>: Wait until either there is a <span
1659     title=concept-task>task</span> in one of the <span>event loop</span>'s
1660     <span title="task queue">task queues</span> or <var title="">worker
1661     global scope</var>'s <a href="#closing"
1662     title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true.</span></p>
1663    
1664     <li>
1665     <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 <span
1666     title="task queue">task queues</span>, if any. The user agent may pick
1667     any <span>task queue</span>.</span></p>
1668    
1669 wakaba 1.52 <p class="note no-ja-translation" data-ja-hash="78f6017f2531b2113d50be256ebd6900"><span class=en-original lang=en>The handling of events or the execution of callbacks might
1670     get prematurely aborted by the "<a href="#kill-a-worker">kill a
1671     worker</a>" or "<a href="#terminate-a-worker">terminate a worker</a>"
1672     algorithms defined below.</span></p>
1673 wakaba 1.9
1674     <li>
1675 wakaba 1.46 <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 <span>task
1676     queue</span>.</span></p>
1677 wakaba 1.9
1678     <li>
1679 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="1e197805331dfc3aa6f8583697d9d623"><span class=en-original lang=en>If there are any more events in the <span>event loop</span>'s <span
1680     title="task queue">task queues</span> or if <var title="">worker global
1681     scope</var>'s <a href="#closing"
1682     title=dom-WorkerGlobalScope-closing>closing</a> flag is set to false,
1683     then jump back to the step above labeled <i>event loop</i>.</span></p>
1684 wakaba 1.9
1685     <li>
1686 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="76aff645037fb93242c0b3e0ed29b90b"><span class=en-original lang=en>Freeze the <span>script group</span>.</span></p>
1687    
1688     <p class="note no-ja-translation" data-ja-hash="d32bd424c711e966967069f368ca26ad"><span class=en-original lang=en>This kills timers, database transactions, etc.</span></p>
1689 wakaba 1.25
1690     <li>
1691 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="e5efd6f1690b302062500ae47d269b08"><span class=en-original lang=en>For each <code><a href="#worker">Worker</a></code> or <code><a
1692 wakaba 1.46 href="#sharedworker">SharedWorker</a></code> object associated with <var
1693     title="">worker global scope</var>, <span>queue a task</span> to
1694     <span>fire a simple event</span> called <code
1695     title=event-close>close</code> at that object.</span></p>
1696 wakaba 1.9 </ol>
1697    
1698     <hr>
1699    
1700 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="aac5ed012e7c0bb439e868075184c613"><span class=en-original lang=en>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it
1701     must run the following steps in parallel with the worker's main loop (the
1702     "<a href="#run-a-worker">run a worker</a>" processing model defined
1703     above):
1704 wakaba 1.29
1705 wakaba 1.36 </span><ol>
1706 wakaba 1.14 <li>
1707 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="a76ddc03676d95e40e0240ba3be551c8"><span class=en-original lang=en>If the worker's <code><a
1708 wakaba 1.22 href="#workerglobalscope">WorkerGlobalScope</a></code> object's <a
1709 wakaba 1.46 href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag is
1710     false, <span>queue a task</span> to <span>fire a simple event</span>
1711     called <code title=event-close>close</code> at the worker's <code><a
1712     href="#workerglobalscope">WorkerGlobalScope</a></code> object.
1713 wakaba 1.22
1714 wakaba 1.46 </span><li>
1715 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="6243c3e4951724a3633743634fccb06e"><span class=en-original lang=en>Set the worker's <code><a
1716 wakaba 1.29 href="#workerglobalscope">WorkerGlobalScope</a></code> object's <a
1717     href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag to
1718     true.
1719 wakaba 1.22
1720 wakaba 1.36 </span><li>
1721 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="a5395395c8d815e40fc3fc1f2381ec68"><span class=en-original lang=en>Wait a user-agent-defined amount of time. If the "<a
1722     href="#run-a-worker">run a worker</a>" processing model defined above
1723     immediately starts running event listeners registered for the <code
1724     title=event-close>close</code> event, this time should not be zero
1725     &mdash; the idea is that the <code title=event-close>close</code> event
1726     can be used to clean up when shutting down unexpectedly.
1727 wakaba 1.29
1728 wakaba 1.36 </span><li>
1729 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="e062300b1a0b646e14e0f8d084f3ab6a"><span class=en-original lang=en>If there are any <span title=concept-task>tasks</span> queued in the
1730     <span>event loop</span>'s <span title="task queue">task queues</span>
1731 wakaba 1.29 other than the <code title=event-close>close</code> event that this
1732 wakaba 1.46 algorithm just added, discard them without processing them.
1733 wakaba 1.29
1734 wakaba 1.36 </span><li>
1735 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="e9d30d31f5050c8a6a15b9c403a3573a"><span class=en-original lang=en>If the <code title=event-close>close</code> event that this algorithm
1736     just queued hasn't yet been dispatched, then abort the script currently
1737 wakaba 1.29 running in the worker.
1738 wakaba 1.23
1739 wakaba 1.46 </span><li>
1740 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="a53f0acde0e4a21781c4b31d5a0f110a"><span class=en-original lang=en>Wait a user-agent-defined amount of time.
1741 wakaba 1.32
1742     </span><span class=ja-translation lang=ja>利用者エージェント定義の時間、待ちます。</span><li>
1743 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="6f55d58072eaadf9aaac96514d919df8"><span class=en-original lang=en>Abort the script currently running in the worker (if any script is
1744 wakaba 1.29 running, then it will be a handler for the <code
1745     title=event-close>close</code> event).
1746 wakaba 1.36 </span><span class=ja-translation lang=ja>労働者中で現在走っているスクリプトを停止します
1747     (何かスクリプトが走っているとすれば、それは <code
1748     title=event-close>close</code>
1749     事象の取扱器のはずです)。</span></ol>
1750 wakaba 1.9
1751 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4d131da72af89a3736028444b27f690b"><span class=en-original lang=en>User agents may invoke the "<a href="#kill-a-worker">kill a worker</a>"
1752 wakaba 1.22 processing model on a worker at any time, e.g. in response to user
1753     requests, in response to CPU quota management, or when a worker stops
1754 wakaba 1.52 being an <a href="#active-needed-worker">active needed worker</a> if the
1755     worker continues executing even after its <a href="#closing"
1756 wakaba 1.29 title=dom-WorkerGlobalScope-closing>closing</a> flag was set to true.
1757 wakaba 1.16
1758 wakaba 1.36 </span><hr>
1759 wakaba 1.11
1760 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4ca807005723b4b6c7d4eae3ef0635ed"><span class=en-original lang=en>When a user agent is to <dfn id=terminate-a-worker>terminate a
1761     worker</dfn> it must run the following steps in parallel with the worker's
1762     main loop (the "<a href="#run-a-worker">run a worker</a>" processing model
1763     defined above):
1764 wakaba 1.22
1765 wakaba 1.36 </span><ol>
1766 wakaba 1.22 <li>
1767 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="6243c3e4951724a3633743634fccb06e"><span class=en-original lang=en>Set the worker's <code><a
1768 wakaba 1.22 href="#workerglobalscope">WorkerGlobalScope</a></code> object's <a
1769 wakaba 1.29 href="#closing" title=dom-WorkerGlobalScope-closing>closing</a> flag to
1770     true.
1771 wakaba 1.22
1772 wakaba 1.36 </span><li>
1773 wakaba 1.46 <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> queued in the
1774     <span>event loop</span>'s <span title="task queue">task queues</span>,
1775     discard them without processing them.
1776 wakaba 1.22
1777 wakaba 1.36 </span><li>
1778     <p class="has-ja-translation" data-ja-hash="fcb471f3c8cace3a86095dcb29d25515"><span class=en-original lang=en>Abort the script currently running in the worker.
1779 wakaba 1.47
1780     </span><span class=ja-translation lang=ja>労働者中で現在走っているスクリプトを停止します。</span><li>
1781     <p class="no-ja-translation" data-ja-hash="ef13ce5f71f3f69e0dafefdd9f47eccc"><span class=en-original lang=en>If the worker's <code><a
1782     href="#workerglobalscope">WorkerGlobalScope</a></code> object is
1783     actually a <code><a
1784     href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1785     object (i.e. the worker is a dedicated worker), then empty the
1786     <span>port message queue</span> of the port that the worker's implicit
1787     port is entangled with.
1788     </span></ol>
1789 wakaba 1.11
1790 wakaba 1.52 <h4 id=runtime-script-errors class="has-ja-translation" data-ja-hash="eb260f04266c3b94080b5c3f88c55a31"><span class=en-original lang=en><span class=secno>2.5.1 </span>Runtime script
1791     errors</span><span class=ja-translation lang=ja><span class=secno>2.5.1 </span>実行時スクリプト誤り</span></h4>
1792 wakaba 1.48
1793 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="ddd00515fcd65f1a54ba0ee6a758231c"><span class=en-original lang=en>Whenever a runtime script error occurs in one of the worker's scripts,
1794     if the error did not occur while handling a previous script error, the
1795     user agent must <span>queue a task</span> to <a
1796     href="#fire-an-error-event">fire an error event</a> at the the <code><a
1797 wakaba 1.48 href="#workerglobalscope">WorkerGlobalScope</a></code> object.
1798    
1799 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="5e3eb9f9d97fa8709f5aaf8f872611d6"><span class=en-original lang=en>For shared workers, if the error is still <i title="">not handled</i>
1800     afterwards, or if the error occured while handling a previous script
1801     error, the error should be reported to the user.
1802    
1803     </span><p class="no-ja-translation" data-ja-hash="e36e829ad0a08b1593aefe4c613df689"><span class=en-original lang=en>For dedicated workers, if the error is still <i title="">not handled</i>
1804     afterwards, or if the error occured while handling a previous script
1805     error, the user agent must further <span>queue a task</span> to <a
1806     href="#fire-an-error-event">fire an error event</a> at the <code><a
1807     href="#worker">Worker</a></code> object associated with the worker.
1808    
1809     </span><p class="no-ja-translation" data-ja-hash="ac471258f02d57e573984e6891b2d661"><span class=en-original lang=en>When the user agent is to <dfn id=fire-an-error-event>fire an error
1810     event</dfn> at a <code><a href="#worker">Worker</a></code> object, it must
1811     dispatch an event that uses the <code><a
1812     href="#errorevent">ErrorEvent</a></code> interface, with the name <code
1813     title=event-error>error</code>, that doesn't bubble and is cancelable,
1814     with its <code title=dom-ErrorEvent-message><a
1815     href="#message">message</a></code>, <code title=dom-ErrorEvent-filename><a
1816     href="#filename">filename</a></code>, and <code
1817     title=dom-ErrorEvent-lineno><a href="#lineno">lineno</a></code> attributes
1818     set appropriately. The default action of this event depends on whether the
1819     <code><a href="#worker">Worker</a></code> object is itself in a worker. If
1820     it is, and that worker is also a dedicated worker, then the user agent
1821     must again <span>queue a task</span> to <a
1822     href="#fire-an-error-event">fire an error event</a> at the <code><a
1823     href="#worker">Worker</a></code> object associated with <em>that</em>
1824     worker. Otherwise, then the error should be reported to the user.
1825 wakaba 1.48
1826     </span><hr>
1827    
1828 wakaba 1.49 <pre class="idl no-ja-translation" data-ja-hash="59e062a983391e726ed049c6ae57aaea"><span class=en-original lang=en>interface <dfn id=errorevent>ErrorEvent</dfn> : Event {
1829 wakaba 1.48 readonly attribute DOMObject <a href="#message" title=dom-ErrorEvent-message>message</a>;
1830     readonly attribute DOMObject <a href="#filename" title=dom-ErrorEvent-filename>filename</a>;
1831 wakaba 1.49 readonly attribute unsigned long <a href="#lineno" title=dom-ErrorEvent-lineno>lineno</a>;
1832     void <a href="#initerrorevent" title=dom-ErrorEvent-initErrorEvent>initErrorEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMObject messageArg, in DOMObject filenameArg, in unsigned long linenoArg);
1833     void <a href="#initerroreventns" title=dom-ErrorEvent-initErrorEventNS>initErrorEventNS</a>(in DOMString namespaceURIArg, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMObject messageArg, in DOMObject filenameArg, in unsigned long linenoArg);
1834 wakaba 1.48 };</span></pre>
1835    
1836     <p class="no-ja-translation" data-ja-hash="9d43314493123a2b2149ea035cc1b572"><span class=en-original lang=en>The <dfn id=initerrorevent
1837     title=dom-ErrorEvent-initErrorEvent><code>initErrorEvent()</code></dfn>
1838     and <dfn id=initerroreventns
1839     title=dom-ErrorEvent-initErrorEventNS><code>initErrorEventNS()</code></dfn>
1840     methods must initialize the event in a manner analogous to the
1841     similarly-named methods in the DOM3 Events interfaces. <a
1842     href="#refsDOM3EVENTS">[DOM3EVENTS]</a>
1843    
1844     </span><p class="no-ja-translation" data-ja-hash="7d24fa221c135ec2b437946226400737"><span class=en-original lang=en>The <dfn id=message
1845     title=dom-ErrorEvent-message><code>message</code></dfn> attribute
1846     represents the error message.
1847    
1848     </span><p class="no-ja-translation" data-ja-hash="47c39cbddc08e2a5d463cd6e0a27d4b7"><span class=en-original lang=en>The <dfn id=filename
1849     title=dom-ErrorEvent-filename><code>filename</code></dfn> attribute
1850     represents the <span>absolute URL</span> of the script in which the error
1851     originally occured.
1852    
1853 wakaba 1.49 </span><p class="no-ja-translation" data-ja-hash="8f00dc144763f529c193251c4ae6579e"><span class=en-original lang=en>The <dfn id=lineno title=dom-ErrorEvent-lineno><code>lineno</code></dfn>
1854 wakaba 1.48 attribute represents the line number where the error occured in the
1855     script.
1856    
1857 wakaba 1.52 </span><h3 id=creating-workers class="has-ja-translation" data-ja-hash="f0a4732d38d01e3d103b68468f9fe234"><span class=en-original lang=en><span class=secno>2.6 </span>Creating workers</span><span class=ja-translation lang=ja><span class=secno>2.6 </span>労働者の作成</span></h3>
1858 wakaba 1.9
1859 wakaba 1.52 <h4 id=the-abstractworker-abstract-interface class="has-ja-translation" data-ja-hash="fe5227371e801f4ac588d0d07472a900" data-ja-real-hash="9a7040b26903cb67873e70582b2e3a5b"><span class=en-original lang=en><span class=secno>2.6.1
1860     </span>The <code><a href="#abstractworker">AbstractWorker</a></code>
1861     abstract interface</span><span class=ja-translation lang=ja><span class=secno>2.6.1
1862     </span><code><a href="#abstractworker">AbstractWorker</a></code> 抽象界面</span></h4>
1863 wakaba 1.29
1864 wakaba 1.50 <pre class="idl no-ja-translation" data-ja-hash="c9e3c7c45c089ab5b21145c0aa2fb17e"><span class=en-original lang=en>interface <dfn id=abstractworker>AbstractWorker</dfn> {
1865 wakaba 1.48 attribute <span>EventListener</span> <a href="#onerror0" title=handler-AbstractWorker-onerror>onerror</a>;
1866 wakaba 1.29 attribute <span>EventListener</span> <a href="#onclose0" title=handler-AbstractWorker-onclose>onclose</a>;
1867 wakaba 1.36 };</span></pre>
1868 wakaba 1.29
1869 wakaba 1.42 <p class="no-ja-translation" data-ja-hash="e39a76d762bfd9fb1a4ef6442ded36b3"><span class=en-original lang=en>Objects implementing the <code><a
1870     href="#abstractworker">AbstractWorker</a></code> interface must also
1871     implement the <code>EventTarget</code> interface.
1872    
1873     </span><p class="no-ja-translation" data-ja-hash="4f7356effb9eccb6268b11a363b0c51d"><span class=en-original lang=en>The following are the <span>event handler DOM attributes</span> that
1874 wakaba 1.29 must be supported by objects implementing the <code><a
1875     href="#abstractworker">AbstractWorker</a></code> interface:
1876    
1877 wakaba 1.36 </span><dl>
1878 wakaba 1.48 <dt class="no-ja-translation" data-ja-hash="9271e517353d64116733d90133259cae"><span class=en-original lang=en><dfn id=onerror0
1879 wakaba 1.29 title=handler-AbstractWorker-onerror><code>onerror</code></dfn>
1880    
1881 wakaba 1.36 </span><dd>
1882     <p class="no-ja-translation" data-ja-hash="3998f6cd6a9193846f5e07b04202500c"><span class=en-original lang=en>Must be invoked whenever an <code title=event-error>error</code> event
1883 wakaba 1.29 is targeted at or bubbles through the <code><a
1884     href="#abstractworker">AbstractWorker</a></code> object.
1885    
1886 wakaba 1.36 </span><dt class="no-ja-translation" data-ja-hash="a66f8d800a45cc2273dc71888c78ecd0"><span class=en-original lang=en><dfn id=onclose0
1887 wakaba 1.29 title=handler-AbstractWorker-onclose><code>onclose</code></dfn>
1888    
1889 wakaba 1.36 </span><dd>
1890     <p class="no-ja-translation" data-ja-hash="90325fa5f5171b4f558eabaeac83bba8"><span class=en-original lang=en>Must be invoked whenever an <code title=event-close>close</code> event
1891 wakaba 1.29 is targeted at or bubbles through the <code><a
1892     href="#abstractworker">AbstractWorker</a></code> object.
1893 wakaba 1.36 </span></dl>
1894 wakaba 1.25
1895 wakaba 1.52 <h4 id=dedicated-workers-and-the-worker-interfa class="no-ja-translation" data-ja-hash="f99ec451918345369dc3593ab99df253"><span class=en-original lang=en><span class=secno>2.6.2
1896     </span>Dedicated workers and the <code><a href="#worker">Worker</a></code>
1897     interface</span></h4>
1898 wakaba 1.25
1899 wakaba 1.50 <pre
1900 wakaba 1.52 class="idl no-ja-translation" data-ja-hash="ade372664d27fd297be42e35c6879e8b"><span class=en-original lang=en>[<a href="#workerscripturl" title=dom-Worker>Constructor</a>(in DOMString scriptURL)]
1901     interface <dfn id=worker>Worker</dfn> : <a href="#abstractworker">AbstractWorker</a> {
1902     void <a href="#terminate" title=dom-Worker-terminate>terminate</a>();
1903 wakaba 1.29
1904 wakaba 1.50 void <a href="#postmessage0" title=dom-Worker-postMessage>postMessage</a>(in any message, [Optional] in <span>MessagePort</span> messagePort);<!--
1905     <span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(in any message);-->
1906 wakaba 1.29 attribute <span>EventListener</span> <a href="#onmessage0" title=handler-Worker-onmessage>onmessage</a>;
1907 wakaba 1.36 };</span></pre>
1908 wakaba 1.9
1909 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4d3f5ca5827bb7d6e625a0c515bee4f1"><span class=en-original lang=en>The <dfn id=terminate
1910 wakaba 1.42 title=dom-Worker-terminate><code>terminate()</code></dfn> method, when
1911 wakaba 1.52 invoked, must cause the "<a href="#terminate-a-worker">terminate a
1912     worker</a>" algorithm to be run on the worker with with the object is
1913     associated.
1914 wakaba 1.29
1915 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="6f799cbcee539c6d772be1358bcf7ab7"><span class=en-original lang=en><code><a href="#worker">Worker</a></code> objects act as if they had an
1916 wakaba 1.29 implicit <code>MessagePort</code> associated with them. This port is part
1917     of a channel that is set up when the worker is created, but it is not
1918     exposed. This object must never be garbage collected before the <code><a
1919 wakaba 1.52 href="#worker">Worker</a></code> object.
1920 wakaba 1.29
1921 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="a9fdf992e05bf1f06e38e68ebd578510"><span class=en-original lang=en>All messages received by that port must immediately be retargetted at
1922     the <code><a href="#worker">Worker</a></code> object.
1923 wakaba 1.29
1924 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="64141206d6090572ac2f725f689bcff9"><span class=en-original lang=en>The <dfn id=postmessage0
1925 wakaba 1.42 title=dom-Worker-postMessage><code>postMessage()</code></dfn><!--
1926     and <dfn
1927     title="dom-Worker-startConversation"><code>startConversation()</code></dfn>-->
1928     method<!--s (startConversation)--> on <code><a
1929 wakaba 1.52 href="#worker">Worker</a></code> objects must act as if, when invoked,
1930 wakaba 1.42 it<!--/they (startConversation)--> immediately invoked the method of the
1931     same name on the port, with the same arguments, and returned the same
1932     return value.
1933 wakaba 1.29
1934 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="e5aa29689a3fa6d3aa9f3d87806009aa"><span class=en-original lang=en>The following are the <span>event handler DOM attributes</span> that
1935 wakaba 1.29 must be supported by objects implementing the <code><a
1936 wakaba 1.52 href="#worker">Worker</a></code> interface:
1937 wakaba 1.29
1938 wakaba 1.36 </span><dl>
1939     <dt class="no-ja-translation" data-ja-hash="1e7efb7f0b77ed1e6f543f6c9cc3387e"><span class=en-original lang=en><dfn id=onmessage0
1940 wakaba 1.29 title=handler-Worker-onmessage><code>onmessage</code></dfn>
1941    
1942 wakaba 1.36 </span><dd>
1943 wakaba 1.52 <p class="has-ja-translation" data-ja-hash="91a2ce3a21f7ed687afe756baa5387d8" data-ja-real-hash="32d4001c5288b0a4b14489685b127fc0"><span class=en-original lang=en>Must be invoked whenever a <code
1944 wakaba 1.32 title=event-Worker-message>message</code> event is targeted at or
1945 wakaba 1.52 bubbles through the <code><a href="#worker">Worker</a></code> object.
1946     </span><span class=ja-translation lang=ja><code title=event-Worker-message>message</code> 事象が当該 <code><a href="#worker">Worker</a></code> オブジェクトを対象としているか、泡立って当該オブジェクトを通過する時に、
1947 wakaba 1.29 呼び出されなければなりません。</span></dl>
1948 wakaba 1.22
1949     <hr>
1950 wakaba 1.13
1951 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="f0add0350ca163097f27c8dd9efd2468"><span class=en-original lang=en>When the <dfn id=workerscripturl title=dom-Worker><code>Worker(<var
1952 wakaba 1.29 title="">scriptURL</var>)</code></dfn> constructor is invoked, the user
1953     agent must run the following steps:
1954    
1955 wakaba 1.36 </span><ol>
1956 wakaba 1.13 <li>
1957 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="3219e42f1040482201a693e248f580cb"><span class=en-original lang=en><span title="resolve a url">Resolve</span> the <var
1958 wakaba 1.32 title="">scriptURL</var> argument.
1959    
1960     </span><span class=ja-translation lang=ja><var
1961 wakaba 1.15 title="">scriptURL</var> 引数を<span title="resolve a url">解決</span>します。</span><li>
1962 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="160444b5a61c1e71f39825a01936237f"><span class=en-original lang=en>If this fails, throw a <code>SYNTAX_ERR</code> exception.
1963 wakaba 1.32
1964     </span><span class=ja-translation lang=ja>これが失敗した場合、 <code>SYNTAX_ERR</code>
1965 wakaba 1.15 例外を投げます。</span><li>
1966 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="b087dd24bd7b57655bef9f719db30b9a"><span class=en-original lang=en>If the <span>origin</span> of the resulting <span>absolute URL</span>
1967 wakaba 1.29 is not the <span title="same origin">same</span> as the origin of the
1968     script that invoked the constructor, then throw a <span>security
1969     exception</span>.
1970    
1971 wakaba 1.36 </span><li>
1972 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="1b3db8a7e7ece473ac900f50243dc62c"><span class=en-original lang=en><span>Create a new <code><a
1973 wakaba 1.29 href="#dedicatedworkerglobalscope">DedicatedWorkerGlobalScope</a></code>
1974 wakaba 1.46 object</span>. Let <var title="">worker global scope</var> be this new
1975     object.
1976 wakaba 1.29
1977 wakaba 1.36 </span><li>
1978 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="ea4b03d1d834cdaa763e8ee60b8eef95"><span class=en-original lang=en>Create a new <code><a href="#worker">Worker</a></code> object,
1979 wakaba 1.46 associated with <var title="">worker global scope</var>. Let <var
1980     title="">worker</var> be this new object.
1981 wakaba 1.29
1982 wakaba 1.36 </span><li>
1983     <p class="no-ja-translation" data-ja-hash="07cc057567324a83e25ec6344dc011a7"><span class=en-original lang=en><span>Create a <code>MessagePort</code> object</span> owned by the
1984 wakaba 1.29 <span>script execution context</span> of the script that invoked the
1985     method. Let this be the <var title="">outside port</var>.
1986    
1987 wakaba 1.36 </span><li>
1988     <p class="has-ja-translation" data-ja-hash="91024eaaebdc23ea683ace1b3e316962"><span class=en-original lang=en>Associate the <var title="">outside port</var> with <var
1989 wakaba 1.29 title="">worker</var>.
1990    
1991 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">outside port</var> を <var
1992     title="">worker</var> に関連付けます。</span><li>
1993 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="2d1b035dbaad3feca57eb124d161b034"><span class=en-original lang=en><span>Create a <code>MessagePort</code> object</span> owned by <var
1994     title="">worker global scope</var>. Let <var title="">inside port</var>
1995     be this new object.
1996 wakaba 1.29
1997 wakaba 1.46 </span><li>
1998     <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
1999     global scope</var>.
2000 wakaba 1.29
2001 wakaba 1.46 </span><li>
2002 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var> and <var
2003 wakaba 1.29 title="">inside port</var>.
2004    
2005 wakaba 1.36 </span><li>
2006     <p class="has-ja-translation" data-ja-hash="2c5bd80faeda34c67a2533f32a477c51"><span class=en-original lang=en>Return <var title="">worker</var>, and run the following steps
2007 wakaba 1.29 asynchronously.
2008    
2009 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">worker</var> を返し、以降の段階を非同期に走らせます。</span><li>
2010     <p class="has-ja-translation" data-ja-hash="faa1ae1399f8e4f6b212fe45bba07893"><span class=en-original lang=en>Open <var title="">inside port</var>'s <span>port message
2011 wakaba 1.29 queue</span>.
2012    
2013 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">inside port</var> の<span>ポート・メッセージ待ち行列</span>を開きます。</span><li>
2014     <p class="has-ja-translation" data-ja-hash="5eaa92a75cbbf580809052327262059a"><span class=en-original lang=en>Open <var title="">outside port</var>'s <span>port message
2015 wakaba 1.30 queue</span>.
2016    
2017 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">outside port</var> の<span>ポート・メッセージ待ち行列</span>を開きます。</span><li>
2018 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4a57d1c2466ccecf10284d888b922af3"><span class=en-original lang=en><a href="#run-a-worker">Run a worker</a> for the resulting
2019     <span>absolute URL</span>, with the <span>script browsing context</span>
2020     of the script that invoked the method as the <var title="">owner
2021     browsing context</var>, and with <var title="">worker global scope</var>
2022     as the global scope.</span></p>
2023 wakaba 1.25 </ol>
2024 wakaba 1.11
2025 wakaba 1.52 <h4 id=shared-workers-and-the-sharedworker-inte class="no-ja-translation" data-ja-hash="660755479f7743bee608286560e94bfd"><span class=en-original lang=en><span class=secno>2.6.3
2026     </span>Shared workers and the <code><a
2027     href="#sharedworker">SharedWorker</a></code> interface</span></h4>
2028 wakaba 1.29
2029 wakaba 1.50 <pre
2030 wakaba 1.52 class="idl no-ja-translation" data-ja-hash="c8aa4a784cf47de0102e41622c91265e"><span class=en-original lang=en>[<a href="#sharedworkerscripturl-name" title=dom-SharedWorker>Constructor</a>(in DOMString scriptURL, in DOMString name)]
2031 wakaba 1.29 interface <dfn id=sharedworker>SharedWorker</dfn> : <a href="#abstractworker">AbstractWorker</a> {
2032 wakaba 1.50 readonly attribute <span>MessagePort</span> <a href="#port" title=dom-SharedWorker-port>port</a>;
2033 wakaba 1.36 };</span></pre>
2034 wakaba 1.29
2035 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="fa90f278bf10ccc803f16340cb3454f3"><span class=en-original lang=en>The <dfn id=port title=dom-SharedWorker-port><code>port</code></dfn>
2036 wakaba 1.29 attribute must return the value it was assigned by the object's
2037     constructor. It represents the <code>MessagePort</code> for communicating
2038     with the shared worker.
2039    
2040 wakaba 1.52 </span><p class="no-ja-translation" data-ja-hash="85e5f80232b74496de5af03115b09630"><span class=en-original lang=en>When the <dfn id=sharedworkerscripturl-name
2041 wakaba 1.29 title=dom-SharedWorker><code>SharedWorker(<var title="">scriptURL</var>,
2042     <var title="">name</var>)</code></dfn> constructor is invoked, the user
2043     agent must run the following steps:
2044 wakaba 1.11
2045 wakaba 1.36 </span><ol>
2046 wakaba 1.13 <li>
2047 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="3219e42f1040482201a693e248f580cb"><span class=en-original lang=en><span title="resolve a url">Resolve</span> the <var
2048 wakaba 1.32 title="">scriptURL</var> argument.
2049    
2050     </span><span class=ja-translation lang=ja><var
2051 wakaba 1.15 title="">scriptURL</var> 引数を<span title="resolve a url">解決</span>します。</span><li>
2052 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="160444b5a61c1e71f39825a01936237f"><span class=en-original lang=en>If this fails, throw a <code>SYNTAX_ERR</code> exception.
2053 wakaba 1.32
2054     </span><span class=ja-translation lang=ja>これが失敗した場合、 <code>SYNTAX_ERR</code>
2055 wakaba 1.15 例外を投げます。</span><li>
2056 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="b087dd24bd7b57655bef9f719db30b9a"><span class=en-original lang=en>If the <span>origin</span> of the resulting <span>absolute URL</span>
2057 wakaba 1.29 is not the <span title="same origin">same</span> as the origin of the
2058     script that invoked the constructor, then throw a <span>security
2059     exception</span>.
2060    
2061 wakaba 1.36 </span><li>
2062     <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>
2063 wakaba 1.13
2064     <ol>
2065     <li>
2066 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="2800d1a8667906afc331a67e21d9ea29"><span class=en-original lang=en>Create a new <code><a href="#sharedworker">SharedWorker</a></code>
2067 wakaba 1.29 object, which will shortly be associated with a <code><a
2068     href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
2069     object. Let this <code><a href="#sharedworker">SharedWorker</a></code>
2070     object be <var title="">worker</var>.
2071 wakaba 1.22
2072 wakaba 1.36 </span><li>
2073     <p class="no-ja-translation" data-ja-hash="07cc057567324a83e25ec6344dc011a7"><span class=en-original lang=en><span>Create a <code>MessagePort</code> object</span> owned by the
2074 wakaba 1.29 <span>script execution context</span> of the script that invoked the
2075     method. Let this be the <var title="">outside port</var>.
2076 wakaba 1.25
2077 wakaba 1.36 </span><li>
2078     <p class="no-ja-translation" data-ja-hash="95cd5e27932141432ed9ff6323032568"><span class=en-original lang=en>Assign <var title="">outside port</var> to the <code
2079 wakaba 1.29 title=dom-SharedWorker-port><a href="#port">port</a></code> attribute
2080     of <var title="">worker</var>.
2081 wakaba 1.25
2082 wakaba 1.36 </span><li>
2083     <p class="no-ja-translation" data-ja-hash="5aec0369bd40bfd0f0ff2dc70f75b9f5"><span class=en-original lang=en>If there exists a <code><a
2084 wakaba 1.29 href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
2085     object whose <a href="#closing"
2086     title=dom-WorkerGlobalScope-closing>closing</a> flag is false, whose
2087     <code title=dom-WorkerGlobalScope-name>name</code> attribute is
2088     exactly equal to the <var title="">name</var> argument, and whose
2089     <code title=dom-WorkerGlobalScope-location><a
2090     href="#location">location</a></code> attribute represents an
2091     <span>absolute URL</span> that has the <span>same origin</span> as the
2092 wakaba 1.36 resulting <span>absolute URL</span>, then run these substeps:</span></p>
2093 wakaba 1.25
2094 wakaba 1.29 <ol>
2095     <li>
2096 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="826754f668578065470b1f9de24553bc"><span class=en-original lang=en>Let <var title="">worker global scope</var> be that <code><a
2097 wakaba 1.29 href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
2098     object.
2099    
2100 wakaba 1.36 </span><li>
2101     <p class="no-ja-translation" data-ja-hash="7b6f8fa4ae92ed20dd16a2fb90c3e618"><span class=en-original lang=en>If <var title="">worker global scope</var>'s <code
2102 wakaba 1.29 title=dom-WorkerGlobalScope-location><a
2103     href="#location">location</a></code> attribute represents an
2104     <span>absolute URL</span> that is not exactly equal to the resulting
2105     <span>absolute URL</span>, then throw a
2106     <code>URL_MISMATCH_ERR</code> exception and abort all these steps.
2107     <span class=big-issue>code 21</span>
2108    
2109 wakaba 1.36 </span><li>
2110     <p class="has-ja-translation" data-ja-hash="9c4f87efaa1e868cd6bf63dbffa749c0"><span class=en-original lang=en>Associate <var title="">worker</var> with <var title="">worker
2111 wakaba 1.29 global scope</var>.
2112    
2113 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">worker</var> を <var title="">worker
2114     global scope</var> に関連付けます。</span><li>
2115 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="bab9c8cea075e0f3614c731f09b49892"><span class=en-original lang=en><span>Create a <code>MessagePort</code> object</span> owned by
2116 wakaba 1.29 <var title="">worker global scope</var>. Let this be the <var
2117     title="">inside port</var>.
2118    
2119 wakaba 1.46 </span><li>
2120 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var> and <var
2121 wakaba 1.29 title="">inside port</var>.
2122    
2123 wakaba 1.36 </span><li>
2124     <p class="has-ja-translation" data-ja-hash="ebb713e9e29aab450d79b533c42b67ae"><span class=en-original lang=en>Return <var title="">worker</var> and perform the next step
2125 wakaba 1.29 asynchronously.
2126    
2127 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">worker</var> を返し、
2128     次の段階を非同期に実行します。</span><li>
2129 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="59d27c5ea77ba33df367bcf4df580a15"><span class=en-original lang=en>Create an event that uses the <code>MessageEvent</code> interface,
2130 wakaba 1.29 with the name <code title=event-connect>connect</code>, which does
2131     not bubble, is cancelable, has no default action, has a <code
2132     title=dom-MessageEvent-data>data</code> attribute whose value is the
2133     empty string and has a <code
2134     title=dom-MessageEvent-messagePort>messagePort</code> attribute
2135 wakaba 1.46 whose value is the newly created port, and <span>queue a task</span>
2136     to dispatch the event at <var title="">worker global scope</var>.
2137 wakaba 1.29
2138 wakaba 1.36 </span><li>
2139     <p class="has-ja-translation" data-ja-hash="dd866391287c967d4799df78a7249911"><span class=en-original lang=en>Abort all these steps.
2140     </span><span class=ja-translation lang=ja>これらの段階をすべて停止します。</span></ol>
2141 wakaba 1.11
2142 wakaba 1.29 <li>
2143 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="3431d32f7d58431abbb9fd0e6f63d6a1"><span class=en-original lang=en><span>Create a new <code><a
2144 wakaba 1.29 href="#sharedworkerglobalscope">SharedWorkerGlobalScope</a></code>
2145 wakaba 1.46 object</span>. Let <var title="">worker global scope</var> be this new
2146     object.
2147 wakaba 1.11
2148 wakaba 1.36 </span><li>
2149     <p class="has-ja-translation" data-ja-hash="9c4f87efaa1e868cd6bf63dbffa749c0"><span class=en-original lang=en>Associate <var title="">worker</var> with <var title="">worker
2150 wakaba 1.29 global scope</var>.
2151 wakaba 1.23
2152 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">worker</var> を <var title="">worker
2153     global scope</var> に関連付けます。</span><li>
2154 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="c285d8b77f24f839bfaaa69b872159c8"><span class=en-original lang=en>Set the <code title=dom-SharedWorkerGlobalScope-name><a
2155 wakaba 1.29 href="#name">name</a></code> attribute of <var title="">worker global
2156 wakaba 1.46 scope</var> to <var title="">name</var>.
2157 wakaba 1.11
2158 wakaba 1.36 </span><li>
2159 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="2d1b035dbaad3feca57eb124d161b034"><span class=en-original lang=en><span>Create a <code>MessagePort</code> object</span> owned by <var
2160     title="">worker global scope</var>. Let <var title="">inside
2161     port</var> be this new object.
2162 wakaba 1.11
2163 wakaba 1.46 </span><li>
2164 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="bf2642ced659847cb4402165d2ab3a8e"><span class=en-original lang=en><span>Entangle</span> <var title="">outside port</var> and <var
2165 wakaba 1.29 title="">inside port</var>.
2166 wakaba 1.36 </span></ol>
2167 wakaba 1.13
2168     <li>
2169 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="ebb713e9e29aab450d79b533c42b67ae"><span class=en-original lang=en>Return <var title="">worker</var> and perform the next step
2170 wakaba 1.29 asynchronously.
2171 wakaba 1.25
2172 wakaba 1.36 </span><span class=ja-translation lang=ja><var title="">worker</var> を返し、
2173     次の段階を非同期に実行します。</span><li>
2174 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="59d27c5ea77ba33df367bcf4df580a15"><span class=en-original lang=en>Create an event that uses the <code>MessageEvent</code> interface,
2175 wakaba 1.22 with the name <code title=event-connect>connect</code>, which does not
2176     bubble, is cancelable, has no default action, has a <code
2177     title=dom-MessageEvent-data>data</code> attribute whose value is the
2178     empty string and has a <code
2179     title=dom-MessageEvent-messagePort>messagePort</code> attribute whose
2180 wakaba 1.46 value is the newly created port, and <span>queue a task</span> to
2181     dispatch the event at <var title="">worker global scope</var>.
2182 wakaba 1.23
2183 wakaba 1.36 </span><li>
2184 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="4a57d1c2466ccecf10284d888b922af3"><span class=en-original lang=en><a href="#run-a-worker">Run a worker</a> for the resulting
2185     <span>absolute URL</span>, with the <span>script browsing context</span>
2186     of the script that invoked the method as the <var title="">owner
2187     browsing context</var>, and with <var title="">worker global scope</var>
2188     as the global scope.</span></p>
2189 wakaba 1.22 </ol>
2190 wakaba 1.15
2191 wakaba 1.52 <h2 id=apis-available-to-workers class="has-ja-translation" data-ja-hash="4fce100e6a2eccbb2df8631a438feeb6"><span class=en-original lang=en><span class=secno>3 </span>APIs available
2192     to workers</span><span class=ja-translation lang=ja><span class=secno>3 </span>労働者が利用可能な API</span></h2>
2193 wakaba 1.50 <!-- the XXX below is for collapsing this interface onto WorkerGlobalScope so it looks like just one interface - the inheritance is a spec fiction only -->
2194 wakaba 1.15
2195 wakaba 1.22 <pre
2196 wakaba 1.52 class="idl no-ja-translation" data-ja-hash="44658553a7e89545fb1712360b5f3aba"><span class=en-original lang=en>[NoInterfaceObject, ImplementedOn=WorkerGlobalScope, XXX] interface <dfn id=workerutils>WorkerUtils</dfn> {
2197     void <a href="#importscriptsurls" title=dom-WorkerGlobalScope-importScripts>importScripts</a>([Variadic] in DOMString urls);
2198 wakaba 1.22 readonly attribute <span>Storage</span> <a href="#localstorage" title=dom-localStorage>localStorage</a>;
2199 wakaba 1.42 readonly attribute <a href="#navigator0">Navigator</a> <a href="#navigator" title=dom-navigator>navigator</a>;
2200 wakaba 1.50 <span>Database</span> <a href="#opendatabase" title=dom-opendatabase>openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);<!--
2201     void <span title="dom-showNotification">showNotification</span>(in DOMString title, in DOMString subtitle, in DOMString description, [Optional] in VoidCallback onclick); XXX-NOTIFY -->
2202 wakaba 1.36 };</span></pre>
2203 wakaba 1.16
2204 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="fc1e0d30e2c0869e54fb2487a7dd6836" data-ja-real-hash="43ee0f4f7856a9484e5ed892bc4ab914"><span class=en-original lang=en>Objects that implement the <code><a
2205 wakaba 1.32 href="#workerglobalscope">WorkerGlobalScope</a></code> interface must also
2206     implement the <code><a href="#workerutils">WorkerUtils</a></code>
2207     interface.
2208    
2209 wakaba 1.42 </span><span class=ja-translation lang=ja><code><a href="#workerglobalscope">WorkerGlobalScope</a></code> 界面を実装するオブジェクトは、 <code><a href="#workerutils">WorkerUtils</a></code> 界面も実装しなければ<em class=rfc2119 title="MUST">なりません</em>。</span><p class="no-ja-translation" data-ja-hash="ee5c969b7e5c71d39f0fe9919b1173fe"><span class=en-original lang=en>Objects that implement the <code><a
2210     href="#workerutils">WorkerUtils</a></code> interface must also implement
2211     the <code>WindowTimers</code> interface. (This interface provides the
2212     <code title="">setTimeout()</code> method and its friends.)
2213 wakaba 1.16
2214 wakaba 1.42 </span><p class="big-issue no-ja-translation" data-ja-hash="fffa5f76ab27c1602edf28b5c8fbcc6d"><span class=en-original lang=en>Need to define a sync database API.</span></p>
2215 wakaba 1.16 <!-- XXX ApplicationCache -->
2216     <!-- XXX a way to set cookies on the URL for the script -->
2217     <!-- XXX debugging: void log(in DOMString s); // log to console -->
2218     <!-- XXX debugging: onerror -->
2219    
2220     <hr>
2221    
2222 wakaba 1.36 <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> objects,
2223 wakaba 1.32 etc) are not available to workers in this version of this specification.
2224    
2225     </span><span class=ja-translation lang=ja>DOM API (<code>Node</code> オブジェクト、 <code>Document</code>
2226 wakaba 1.52 オブジェクト、その他) は、この版のこの仕様書では労働者に利用可能ではありません。</span><h3 id=importing-scripts-and-libraries class="has-ja-translation" data-ja-hash="e7522d998689dc52be80feeff81470ca"><span class=en-original lang=en><span class=secno>3.1
2227     </span>Importing scripts and libraries</span><span class=ja-translation lang=ja><span class=secno>3.1
2228     </span>スクリプトとライブラリーの輸入</span></h3>
2229 wakaba 1.22
2230 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="775f19cb6dd1395bd00e1f9bb11e922d"><span class=en-original lang=en>When a script invokes the <dfn id=importscriptsurls
2231 wakaba 1.25 title=dom-WorkerGlobalScope-importScripts><code>importScripts(<var
2232     title="">urls</var>)</code></dfn> method on a <code><a
2233 wakaba 1.22 href="#workerglobalscope">WorkerGlobalScope</a></code> object, the user
2234     agent must run the following steps:
2235    
2236 wakaba 1.36 </span><ol>
2237 wakaba 1.22 <li>
2238 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="143a8bb07f4501807d2bbf2d2d2b345a"><span class=en-original lang=en>If there are no arguments, return without doing anything. Abort these
2239 wakaba 1.25 steps.
2240    
2241 wakaba 1.36 </span><span class=ja-translation lang=ja>引数がない場合、何も返さずに返ります。
2242     これらの段階を停止します。</span><li>
2243     <p class="has-ja-translation" data-ja-hash="b89818b453add85fbb5ec1e963e3072c"><span class=en-original lang=en><span title="resolve a url">Resolve</span> each argument.
2244 wakaba 1.22
2245 wakaba 1.36 </span><span class=ja-translation lang=ja>各引数を<span title="resolve a url">解決</span>します。</span><li>
2246     <p class="has-ja-translation" data-ja-hash="54adea3a3a07dd8833ad87eb937142f1"><span class=en-original lang=en>If any fail, throw a <code>SYNTAX_ERR</code> exception.
2247 wakaba 1.45 </span><span class=ja-translation lang=ja>いずれかが失敗した場合、 <code>SYNTAX_ERR</code> 例外を投げます。</span></li>
2248     <!--
2249     <li><p class="has-ja-translation" data-ja-hash="952d7bd44378695378ddf1084a1c5347"><span class=en-original lang=en>If any of the resulting <span title="absolute URL">absolute
2250     URLs</span> have an <span>origin</span> that is not the <span
2251     title="same origin">same</span> as the origin of the script that
2252     invoked the method, then throw a <span>security
2253     exception</span>.</span><span class=ja-translation lang=ja>結果として得られた<span title="absolute URL">絶対
2254 wakaba 1.36 URL</span>
2255     のいずれかが、メソッドを呼び出したスクリプトの<span>origin</span>と<span
2256     title="same origin">同じ</span>ではない起源を持つ場合、
2257 wakaba 1.45 <span>保安性例外</span>を投げます。</span></p></li>
2258     -->
2259 wakaba 1.42
2260     <li>
2261 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="9a0a1930525c4231da8248d6b7847c8d"><span class=en-original lang=en>Attempt to <span>fetch</span> each resource identified by the
2262     resulting <span title="absolute URLs">absolute URL</span>.</span><span class=ja-translation lang=ja>結果として得られた<span title="absolute URLs">絶対 URL</span>
2263     によって識別される資源をそれぞれ<span>取得</span>しようと試みます。</span></p>
2264 wakaba 1.22
2265     <li>
2266 wakaba 1.36 <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 the first
2267     one, run these substeps:</span><span class=ja-translation lang=ja>各引数について、与えられた順に最初のものから、次の部分段階群を走らせます。</span></p>
2268 wakaba 1.25
2269     <ol>
2270     <li>
2271 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="a5cd8fb5d75985afdc62f7ac228329d4"><span class=en-original lang=en>Wait for the fetching attempt for the corresponding resource to
2272     complete.</span><span class=ja-translation lang=ja>対応する資源を取得しようとする試みが完了するのを待ちます。</span></p>
2273 wakaba 1.25
2274 wakaba 1.46 <p class="no-ja-translation" data-ja-hash="c821b5a32a4316df06e95e2117d4d21a"><span class=en-original lang=en>If the fetching attempt failed, throw a <code>NETWORK_ERR</code>
2275     exception and abort all these steps.</span></p>
2276    
2277     <p class="no-ja-translation" data-ja-hash="d6801f59b2563b0c5b83889b85620faa"><span class=en-original lang=en>If the fetching attempt succeeded, then let <var
2278     title="">source</var> be the text of the resource that was obtained,
2279     and let <var title="">language</var> be JavaScript.</span></p>
2280 wakaba 1.36
2281     <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 always
2282     assumed to be JavaScript, regardless of the MIME type.</span><span class=ja-translation lang=ja>労働者のスクリプトと同じく、ここでのスクリプトも、 MIME 型に関わらず常に
2283     JavaScript であるとみなします。</span></p>
2284 wakaba 1.25 <!-- XXX -->
2285    
2286     <li>
2287 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="972ae4d7f35587ed4bf7ee57d86f6215"><span class=en-original lang=en><span>Create a script</span>, using <var title="">source</var> as
2288 wakaba 1.46 the script source and <var title="">language</var> as the scripting
2289     language, using the same global object, browsing context, character
2290     encoding, base URL, and script group as the <span
2291     title=concept-script>script</span> that was created by the worker's <a
2292 wakaba 1.52 href="#run-a-worker">run a worker</a> algorithm.</span></p>
2293 wakaba 1.46
2294 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="834a7e8d861cfdd270765e6e4c1ed01e"><span class=en-original lang=en>Let the newly created <span title=concept-script>script</span> run
2295 wakaba 1.46 until it either returns, fails to parse, fails to catch an exception,
2296 wakaba 1.52 or gets prematurely aborted by the "<a href="#kill-a-worker">kill a
2297     worker</a>" or "<a href="#terminate-a-worker">terminate a worker</a>"
2298 wakaba 1.46 algorithms defined above.</span></p>
2299 wakaba 1.42
2300     <p class="no-ja-translation" data-ja-hash="41014f4a697396a3e02475a4d61a7472"><span class=en-original lang=en>If it failed to parse, then throw a
2301     <code>SyntaxError</code><!-- XXX ref? --> exception and abort all
2302     these steps.</span></p>
2303 wakaba 1.25
2304 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="541949c1a960b479106667b83837469e"><span class=en-original lang=en>If an exception was raised or if the script was prematurely aborted,
2305 wakaba 1.25 then abort all these steps, letting the exception or aborting continue
2306     to be processed by the script that called the <code
2307     title=dom-WorkerGlobalScope-importScripts><a
2308 wakaba 1.52 href="#importscriptsurls">importScripts()</a></code> method.</span></p>
2309 wakaba 1.22
2310 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="b270b6f282bcc949f2e6b45f757f4747"><span class=en-original lang=en>If the "<a href="#kill-a-worker">kill a worker</a>" or "<a
2311     href="#terminate-a-worker">terminate a worker</a>" algorithms abort
2312     the script then abort all these steps.</span></p>
2313 wakaba 1.25 </ol>
2314 wakaba 1.22 </ol>
2315    
2316 wakaba 1.52 <h3 id=the-navigator-object class="no-ja-translation" data-ja-hash="920dd52a11144ff4776fa357ce6245e1"><span class=en-original lang=en><span class=secno>3.2 </span>The <code><a
2317 wakaba 1.42 href="#navigator0">Navigator</a></code> object</span></h3>
2318    
2319     <p class="no-ja-translation" data-ja-hash="2affbf4546661b0d28c37da361b1cf65"><span class=en-original lang=en>The <dfn id=navigator title=dom-navigator><code>navigator</code></dfn>
2320     attribute of the <code><a href="#workerutils">WorkerUtils</a></code>
2321     interface must return an instance of the <code><a
2322     href="#navigator0">Navigator</a></code> interface, which represents the
2323     identity and state of the user agent (the client):
2324    
2325 wakaba 1.50 </span><pre class="idl no-ja-translation" data-ja-hash="acb6d94ad25eb722cedfe999a7579982"><span class=en-original lang=en>interface <dfn id=navigator0>Navigator</dfn> {
2326 wakaba 1.42 // objects implementing this interface also implement the interfaces listed below
2327     };</span></pre>
2328    
2329     <p class="no-ja-translation" data-ja-hash="cc1c14039bdbf516ffffc18ed475544f"><span class=en-original lang=en>Objects implementing the <code><a
2330     href="#navigator0">Navigator</a></code> interface must also implement the
2331     <span>NavigatorID</span> and <span>NavigatorOnLine</span> interfaces
2332     specified in the HTML5 specification. <a href="#refsHTML5">[HTML5]</a>
2333    
2334     </span><p class="note no-ja-translation" data-ja-hash="0b5a83138f5e72c3cbeff9a2b59e9920"><span class=en-original lang=en>The <code><a href="#navigator0">Navigator</a></code>
2335     interface defined in this specification is different than the one defined
2336     in the HTML5 specification.
2337    
2338 wakaba 1.52 </span><h3 id=apis-defined-in-other-specifications class="has-ja-translation" data-ja-hash="d6d6885373ce92bfa8857f5a375a9c8f"><span class=en-original lang=en><span class=secno>3.3
2339     </span>APIs defined in other specifications</span><span class=ja-translation lang=ja><span class=secno>3.3
2340     </span>他の仕様書で定義されている API</span></h3>
2341 wakaba 1.22
2342 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="3c9a0dcc3dbfc7283eea34202de4d321"><span class=en-original lang=en>The <dfn id=localstorage
2343 wakaba 1.22 title=dom-localStorage><code>localStorage</code></dfn>, <dfn
2344     id=opendatabase title=dom-opendatabase><code>openDatabase()</code></dfn>
2345     must act as defined for the APIs with the same names on the
2346     <code>Window</code> object in the HTML5 specification, with the exception
2347     that where the API would use the <span>origin</span> of the <span>active
2348     document</span> of the <span>browsing context</span> of the
2349     <code>Window</code> object on which the method was supposedly invoked, it
2350     must instead use the <span>origin</span> of the script that invoked the
2351     method. <a href="#refsHTML5">[HTML5]</a>
2352    
2353 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="6563db877bfe3b57772fed7dedbfc84b"><span class=en-original lang=en>The <dfn id=shownotification
2354 wakaba 1.22 title=dom-showNotification><code>showNotification()</code></dfn> methods
2355     must act as defined for the APIs with the same names on the
2356     <code>Window</code> object in the HTML5 specification. <a
2357     href="#refsHTML5">[HTML5]</a>
2358    
2359 wakaba 1.52 </span><h3 id=interface-objects-and-constructors class="has-ja-translation" data-ja-hash="78e75b89c304218ef77a66cd9efdf398"><span class=en-original lang=en><span class=secno>3.4
2360     </span>Interface objects and constructors</span><span class=ja-translation lang=ja><span class=secno>3.4
2361     </span>界面オブジェクトと構築器</span></h3>
2362 wakaba 1.22
2363 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="2135421a70c368c728d0af40f99cee55"><span class=en-original lang=en>There must be no interface objects and constructors available in the
2364 wakaba 1.22 global scope of scripts whose <span>script execution context</span> is a
2365     <code><a href="#workerglobalscope">WorkerGlobalScope</a></code> object
2366     except for the following:
2367    
2368 wakaba 1.36 </span><ul>
2369 wakaba 1.22 <li>
2370 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="ee396bbb3d32ae2d31fc0a108ea3389c"><span class=en-original lang=en><code>XMLHttpRequest</code> and all interface objects and constructors
2371 wakaba 1.31 defined by the XMLHttpRequest specifications, except that the
2372     <span>document response entity body</span> must always be null. <a
2373     href="#refsXHR">[XHR]</a>
2374    
2375 wakaba 1.36 </span><li>
2376     <p class="has-ja-translation" data-ja-hash="3a205f7812c3029dcecfcbbd61199f90"><span class=en-original lang=en>The <code>WebSocket</code> interface object and constructor.
2377 wakaba 1.23
2378 wakaba 1.32 </span><span class=ja-translation lang=ja><code>WebSocket</code> 界面オブジェクトと構築器</span><li>
2379 wakaba 1.36 <p class="has-ja-translation" data-ja-hash="c537145c77e1103c3a76557f40172a5a"><span class=en-original lang=en>The <code>MessageChannel</code> interface object and constructor.
2380 wakaba 1.32
2381 wakaba 1.42 </span><span class=ja-translation lang=ja><code>MessageChannel</code> 界面オブジェクトと構築器</span><li>
2382 wakaba 1.52 <p class="no-ja-translation" data-ja-hash="7e076de480c4fdec8947de77d273d82c"><span class=en-original lang=en>The <code title=dom-Worker><a
2383     href="#workerscripturl">Worker()</a></code> and <code
2384     title=dom-SharedWorker><a
2385     href="#sharedworkerscripturl-name">SharedWorker(<var
2386 wakaba 1.42 title="">url</var>)</a></code> constructors.
2387     </span></ul>
2388    
2389 wakaba 1.52 <h3 id=worker-locations class="has-ja-translation" data-ja-hash="ae4aa0f882fcbd2ee8252e59113ec205"><span class=en-original lang=en><span class=secno>3.5 </span>Worker locations</span><span class=ja-translation lang=ja><span class=secno>3.5 </span>労働者の所在</span></h3>
2390 wakaba 1.23
2391 wakaba 1.50 <pre class="idl no-ja-translation" data-ja-hash="235fe0311fd11c41ec8ff0242ac64521"><span class=en-original lang=en>interface <dfn id=workerlocation>WorkerLocation</dfn> {
2392 wakaba 1.23 readonly attribute DOMString <a href="#href" title=dom-WorkerLocation-href>href</a>;
2393     readonly attribute DOMString <a href="#protocol" title=dom-WorkerLocation-protocol>protocol</a>;
2394     readonly attribute DOMString <a href="#host" title=dom-WorkerLocation-host>host</a>;
2395     readonly attribute DOMString <a href="#hostname" title=dom-WorkerLocation-hostname>hostname</a>;
2396 wakaba 1.29 readonly attribute DOMString <a href="#port0" title=dom-WorkerLocation-port>port</a>;
2397 wakaba 1.23 readonly attribute DOMString <a href="#pathname" title=dom-WorkerLocation-pathname>pathname</a>;
2398     readonly attribute DOMString <a href="#search" title=dom-WorkerLocation-search>search</a>;
2399     readonly attribute DOMString <a href="#hash" title=dom-WorkerLocation-hash>hash</a>;
2400 wakaba 1.36 };</span></pre>
2401 wakaba 1.23
2402 wakaba 1.36 <p class="no-ja-translation" data-ja-hash="36debbc2eb6f1156c1bae8ade6331936"><span class=en-original lang=en>A <code><a href="#workerlocation">WorkerLocation</a></code> object
2403 wakaba 1.23 represents an <span>absolute URL</span> set at its creation.
2404    
2405 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="2d034b308d5fd16e5cf88da132b7ecb7"><span class=en-original lang=en>The <dfn id=href title=dom-WorkerLocation-href><code>href</code></dfn>
2406 wakaba 1.23 attribute must return the <span>absolute URL</span> that the object
2407     represents.
2408    
2409 wakaba 1.36 </span><p class="no-ja-translation" data-ja-hash="f2d3c1ea8523c84f8de83e432d4ecb8e"><span class=en-original lang=en>The <code><a href="#workerlocation">WorkerLocation</a></code> interface
2410 wakaba 1.23 also has the complement of <span>URL decomposition attributes</span>, <dfn
2411     id=protocol title=dom-WorkerLocation-protocol><code>protocol</code></dfn>,
2412     <dfn id=host title=dom-WorkerLocation-host><code>host</code></dfn>, <dfn
2413 wakaba 1.29 id=port0 title=dom-WorkerLocation-port><code>port</code></dfn>, <dfn
2414 wakaba 1.23 id=hostname title=dom-WorkerLocation-hostname><code>hostname</code></dfn>,
2415     <dfn id=pathname
2416     title=dom-WorkerLocation-pathname><code>pathname</code></dfn>, <dfn
2417     id=search title=dom-WorkerLocation-search><code>search</code></dfn>, and
2418     <dfn id=hash title=dom-WorkerLocation-hash><code>hash</code></dfn>. These
2419     must follow the rules given for URL decomposition attributes, with the
2420     <span title=concept-uda-input>input</span> being the <span>absolute
2421     URL</span> that the object represents (same as the <code
2422     title=dom-WorkerLocation-href><a href="#href">href</a></code> attribute),
2423     and the <span title=concept-uda-setter>common setter action</span> being a
2424     no-op, since the attributes are defined to be readonly. <a
2425     href="#refsHTML5">[HTML5]</a>
2426 wakaba 1.22
2427 wakaba 1.37 </span><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>
2428 wakaba 1.32
2429 wakaba 1.39 <p class="big-issue no-ja-translation" data-ja-hash="683a8b064076b13e2c36958afe8b9897"><span class=en-original lang=en>This section will be written in a future
2430 wakaba 1.32 draft.<!--XXX-->
2431 wakaba 1.1
2432 wakaba 1.39 </span><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>
2433 wakaba 1.1 <!-- ACKS -->
2434    
2435 wakaba 1.50 <p class="has-ja-translation" data-ja-hash="a17a0feb6f58a31040d51121e80bc233" data-ja-real-hash="652eb8d20b353fa25a4dac94db2c5839"><span class=en-original lang=en>Thanks to Aaron Boodman,
2436 wakaba 1.47 &#1040;&#1083;&#1077;&#1082;&#1089;&#1077;&#1081;
2437     &#1055;&#1088;&#1086;&#1089;&#1082;&#1091;&#1088;&#1103;&#1082;&#1086;&#1074;
2438 wakaba 1.50 (Alexey Proskuryakov), Anne van Kesteren, Ben Turner, Dmitry Titov, Jonas
2439     Sicking, Justin James, Kevin Hakanson, Maciej Stachowiak, Michael Nordman,
2440     Mike Smith, and Philip Taylor for their useful and substantial comments.
2441 wakaba 1.32
2442 wakaba 1.50 </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, Jonas Sicking, Justin James, Kevin Hakanson, Maciej Stachowiak, Michael Nordman, Mike Smith, Philip Taylor の有用かつ重要なコメントに感謝します。</span><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 technology and
2443 wakaba 1.32 whose experience has been a huge influence on this specification.
2444     </span><span class=ja-translation lang=ja>Gears チームの方々にも非常に感謝します。
2445 wakaba 1.14 Gears チームの方々はこの技術を開拓し、その経験はこの仕様書にも多大な影響を与えています。
2446     </span>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24