/[suikacvs]/markup/html/html5/spec-ja/data/workers.dat
Suika

Contents of /markup/html/html5/spec-ja/data/workers.dat

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.43 - (hide annotations) (download)
Thu Oct 23 04:18:26 2008 UTC (17 years, 6 months ago) by wakaba
Branch: MAIN
CVS Tags: after-new-ids, HEAD
Changes since 1.42: +199 -199 lines
reflect id changes

1 apache 1.2 #en
2     This specification defines an API that allows Web application authors to
3     spawn background workers running scripts in parallel to their main page.
4     This allows for thread-like operation with message-passing as the
5     coordination mechanism.
6     #ja
7 apache 1.13 この仕様書は、 Web アプリケーションで、主たる頁とは並列に、
8 apache 1.14 背景労働者スクリプトを走らせるための API を定義します。
9 apache 1.13 これにより、メッセージ・パッシングによるスレッド的操作を協調機構として利用できるようになります。
10 apache 1.2
11     #en
12     The current focus is in developing a first draft proposal.
13     #ja
14     現在の焦点は、第1案の開発です。
15    
16     #pattern
17 apache 1.11 <span class=secno>* </span>Tutorial
18     #ja
19     <span class=secno>$1 </span>解説
20    
21     #pattern
22 apache 1.4 <span class=secno>* </span>Requirements
23     #ja
24     <span class=secno>$1 </span>要件
25    
26     #en
27     This specification aims to address the following use cases and
28     requirements:
29     #ja
30     この仕様書は、次に示す利用事例と要件に取り組むことを目指します。
31    
32     #en
33     Background workers: A Web application needs to keep its data
34     synchronised with the server, both sending updates to the server and
35     receiving updates from the server, including handling buffering of
36     updates for when the application goes offline. The code to do this would
37     ideally be independent of the UI code.
38     #ja
39     背景労働者: Web アプリケーションは、そのデータを鯖と同期しておく必要があります。
40     これは、鯖への更新の送信と鯖からの更新の両方を含み、
41     アプリケーションがオフラインとなった時の更新のバッファリングの取扱いも含みます。
42     そのための符号は利用者界面の符号とは独立しているのが理想でしょう。
43    
44     #en
45     URLs: Workers should be spawned from URLs, not from strings, since
46     script rarely has access to its own source.
47     #ja
48     URL: 労働者は、文字列からではなく、 URL から生み出される[[SHOULD:べきです]]。
49 apache 1.13 スクリプトはそれ自体の出典へのアクセスを滅多に有しないからです。
50 apache 1.4
51     #en
52     Message queuing: Messages sent to a worker before the worker has
53     initialised should not be lost.
54     #ja
55     メッセージ・キューイング: 労働者が初期化される前に送信されたメッセージが失われるべきでは[[SHOULD NOT:ありません]]。
56    
57     #en
58     Workers should have access to timers.
59     #ja
60     労働者はタイマーへのアクセスを有する[[SHOULD:べきです]]。
61    
62     #en
63     Workers should have access to the network.
64     #ja
65     労働者はネットワークへのアクセスを有する[[SHOULD:べきです]]。
66    
67     #en
68     Workers should be able to use libraries.
69     #ja
70     労働者はライブラリを使える[[SHOULD:べきです]]。
71    
72     #en
73     Implementations should not have to expose <code>Node</code> or
74     <code>Document</code> objects to workers.
75     #ja
76     実装は労働者に <code>Node</code> オブジェクトや
77     <code>Document</code> オブジェクトを晒さなければならない[[SHOULD NOT:べきではありません]]。
78    
79     #en
80     Workers should not share anything with the outside world. The objects
81     representing the worker in the worker itself and in the context that
82     created the worker should be different, for instance.
83     #ja
84     労働者は外界と何も共有する[[SHOULD NOT:べきではありません]]。
85     例えば、労働者自体の中で労働者を現すオブジェクトと労働者を作成した文脈で労働者を表すオブジェクトは異なる[[SHOULD:べきです]]。
86    
87     #en
88     Shared workers: Multiple instances of the same Web application would
89     want to keep just one connection back to the server.
90     #ja
91     共有労働者: 同じ Web アプリケーションの複数の実現値は鯖に対する接続を1つだけ維持したいでしょう。
92    
93     #en
94     Capabilities granting: It should be possible for code running in one
95     iframe to negotiate a connection to another iframe, with that connection
96     granting certain rights (e.g. adding to an address book but not reading
97     from it).
98     #ja
99 apache 1.14 能力保証: ある iframe で走っている符号が他の iframe と何らかの権限 (例えば、
100 apache 1.4 住所録へは追加するが読まない) を保証する接続を折衝することが可能である[[SHOULD:べきです]]。
101    
102     #en
103     Delegation: It should be possible for one worker to spawn another
104     worker and efficiently delagate a request to that worker, without the
105     caller being aware of the delagate and without the original worker having
106     to proxy all the messages.
107     #ja
108 apache 1.13 委譲: ある労働者が別の労働者を生み出した上で、呼び出し元が委譲に気づかず、
109 apache 1.4 かつ元の労働者がすべてのメッセージを仲介せずに、
110 apache 1.13 元の労働者に対する要求を効率的に委譲することができる[[SHOULD:べきです]]。
111 apache 1.10
112 apache 1.11 #pattern
113 apache 1.13 <span class=secno>* </span>Infrastructure
114 apache 1.11 #ja
115 apache 1.13 <span class=secno>$1 </span>基盤
116 apache 1.11
117 apache 1.10 #en
118 apache 1.13 The <dfn id=url title=dom-WindowWorker-URL><code>URL</code></dfn>
119     attribute must return the value it was assigned when the <code><a
120 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object was created by the "<a
121     href=#run-a>run a worker</a>" algorithm. It gives the <span>absolute
122 apache 1.13 URL</span> of the script that was used to initialize the worker.
123 apache 1.10 #ja
124 apache 1.13 <dfn id=url title=dom-WindowWorker-URL><code>URL</code></dfn>
125     属性は、 <code><a
126 wakaba 1.43 href=#windowworker>WindowWorker</a></code>
127 apache 1.13 オブジェクトが「<a
128 wakaba 1.43 href=#run-a>労働者を走らせる</a>」算法で作成された時に割り当てられた値を返さなければ[[MUST:なりません]]。
129 apache 1.13 その値は、労働者を初期化するために使用されたスクリプトの絶対 URL を表します。
130 apache 1.10
131     #en
132 wakaba 1.43 The <dfn id=attr-meta-name title=dom-WindowWorker-name><code>name</code></dfn>
133 apache 1.10 attribute must return the value it was assigned when the <code><a
134 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object was created by the "<a
135     href=#run-a>run a worker</a>" algorithm. If it has a value that isn't
136 apache 1.13 the empty string, its value represents the name that can be used to obtain
137     a reference to the worker using the <code
138     title=dom-WindowWorkerCreators-createNamedWorker><a
139 wakaba 1.43 href=#createnamedworker>createNamedWorker()</a></code> method.
140 apache 1.10 #ja
141 wakaba 1.43 <dfn id=attr-meta-name title=dom-windowworker-name><code>name</code></dfn>
142 apache 1.10 属性は、<code><a
143 wakaba 1.43 href=#windowworker>WindowWorker</a></code> オブジェクトが「<a
144     href=#run-a>労働者を走らせる</a>」算法で作成された時に割り当てられた値を返さなければ[[MUST:なりません]]。この値が空文字列でなければ、
145 apache 1.13 その値は、 <code
146     title=dom-WindowWorkerCreators-createNamedWorker><a
147 wakaba 1.43 href=#createnamedworker>createNamedWorker()</a></code>
148 apache 1.13 メソッドを使って労働者への参照を得るために使うことができる名前を表します。
149 apache 1.10
150     #en
151 wakaba 1.43 The <dfn id=closing-a-browsing-context
152 apache 1.10 title=dom-windowworker-closing><code>closing</code></dfn> attribute must
153 wakaba 1.43 return false until the "<a href=#kill-a>kill a worker</a>" processing
154 apache 1.10 model defined below sets it to true.
155     #ja
156 wakaba 1.43 <dfn id=closing-a-browsing-context
157 apache 1.10 title=dom-windowworker-closing><code>closing</code></dfn>
158 wakaba 1.43 属性は、後述の「<a href=#kill-a>労働者を殺す</a>」処理モデルがこれを真に設定するまで、
159 apache 1.10 偽を返さなければ[[MUST:なりません]]。
160    
161 apache 1.11 #en
162     The following are the <span>event handler DOM attributes</span> that
163     must be supported by objects implementing the <code><a
164 wakaba 1.43 href=#windowworker>WindowWorker</a></code> interface:
165 apache 1.11 #ja
166     次に示すのは、 <code><a
167 wakaba 1.43 href=#windowworker>WindowWorker</a></code>
168 apache 1.11 界面を実装するオブジェクトが対応しなければ[[MUST:ならない]]事象取扱器 DOM 属性です。
169    
170     #pattern
171     Must be invoked whenever a * event is targeted at or
172     bubbles through the * object.
173     #ja
174     $1 事象が当該 $2 オブジェクトを対象としているか、泡立って当該オブジェクトを通過する時に、
175     呼び出されなければなりません。
176    
177 apache 1.10 #pattern
178 apache 1.23 <span class=secno>* </span>Base URLs and origins of
179     workers
180     #ja
181     <span class=secno>$1 </span>労働者の基底 URL と起源
182    
183     #en
184     The <span>base URL</span> of a <span>URL</span> passed to an API in a
185     worker is the <span>absolute URL</span> given by the value of the <code
186 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code> attribute of the
187     worker's <code><a href=#windowworker>WindowWorker</a></code> object.
188 apache 1.23 #ja
189     労働者中で API に渡された <span>URL</span> の<span>基底 URL</span>は、
190 wakaba 1.43 労働者の <code><a href=#windowworker>WindowWorker</a></code>
191 apache 1.23 オブジェクトの <code
192 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code> 属性により与えられる<span>絶対 URL</span>
193 apache 1.23 です。
194    
195     #en
196     The <span>origin</span> and <span>effective script origin</span> of
197     scripts running in workers are both the <span>origin</span> of the
198     <span>absolute URL</span> given by the value of the <code
199 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code> attribute of the
200     worker's <code><a href=#windowworker>WindowWorker</a></code> object.
201 apache 1.23 #ja
202     労働者中で走っているスクリプトの<span>起源</span>と<span>実効スクリプト起源</span>は、
203 wakaba 1.43 共に、労働者の <code><a href=#windowworker>WindowWorker</a></code>
204 apache 1.23 オブジェクトの <code
205 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code>
206 apache 1.23 属性の値により与えられる<span>絶対 URL</span> の<span>起源</span>です。
207    
208     #pattern
209 apache 1.10 <span class=secno>* </span>The queue of events
210     #ja
211     <span class=secno>$1 </span>事象の待ち行列
212    
213     #en
214 wakaba 1.43 Each <code><a href=#windowworker>WindowWorker</a></code> object is
215     asssociated with a <dfn id=queue-a-task>queue of events</dfn>, which is initially
216 apache 1.10 empty.
217     #ja
218 wakaba 1.43 各 <code><a href=#windowworker>WindowWorker</a></code> オブジェクトは、
219     <dfn id=queue-a-task>事象の待ち行列</dfn> (はじめは空) と関連付けられています。
220 apache 1.10
221     #en
222     An event in the queue can be a DOM event or a timeout callback.
223     #ja
224 apache 1.11 待ち行列中の事象は、 DOM 事象か小休止呼び戻しのいずれかです。
225    
226     #en
227     All asynchronous callbacks and events that would be called or dispatched
228     in the worker must be added to the worker's queue, with the "<a
229 wakaba 1.43 href=#run-a>run a worker</a>" processing model below taking care of
230 apache 1.11 actually calling the callbacks or dispatching the events.
231     #ja
232     労働者中で呼び出しまたは発送されるすべての非同期の呼び戻しと事象は、
233 apache 1.22 労働者の待ち行列に追加されなければなりません。
234 apache 1.11 ただし、実際の呼び戻しの呼び出しや事象の発送は、後述の「<a
235 wakaba 1.43 href=#run-a>労働者を走らせる</a>」処理モデルに従い処理されます。
236 apache 1.11
237     #en
238 wakaba 1.43 Once the <code><a href=#windowworker>WindowWorker</a></code>'s <code
239     title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
240 apache 1.11 attribute is set to true, the queue must discard anything else that would
241     be added to it. Effectively, once the <code
242 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
243 apache 1.11 attribute is true, timers stop firing, notifications for all pending
244     asynchronous operations are dropped, etc.
245     #ja
246 wakaba 1.43 一旦 <code><a href=#windowworker>WindowWorker</a></code> の <code
247     title=dom-windowworker-closing><a href=#closing-a-browsing-context>closing</a></code>
248 apache 1.11 属性が真に設定されると、待ち行列は、以後追加されるべきものがあっても、
249     すべて捨てなければ[[MUST:なりません]]。実効的には、一旦 <code
250 wakaba 1.43 title=dom-windowworker-closing><a href=#closing-a-browsing-context>closing</a></code>
251 apache 1.11 属性が真となると、タイマーが発火を停止したり、
252 apache 1.13 すべての未決の非同期処理に関する通知は捨てられたりするようになるなどします。
253 apache 1.11
254     #pattern
255     <span class=secno>* </span>The worker's ports
256     #ja
257 apache 1.13 <span class=secno>$1 </span>労働者のポート
258 apache 1.11
259     #en
260     Workers communicate with other workers and with <span title="browsing
261     context">browsing contexts</span> through <span title="channel
262     messaging">message channels</span> and their <code>MessagePort</code>
263     objects.
264     #ja
265 apache 1.13 労働者は、メッセージ通信路とその <code>MessagePort</code>
266 apache 1.11 オブジェクトを通じて、他の労働者や閲覧文脈と通信します。
267    
268     #en
269 wakaba 1.43 Each <code><a href=#windowworker>WindowWorker</a></code> <var
270 apache 1.11 title="">worker</var> has a list of <dfn id=the-workers0>the worker's
271     ports</dfn>, which consists of all the <code>MessagePort</code> objects
272     that are entangled with another port and that have one (but only one) port
273     whose <code title=dom-MessagePort-ownerWindow>ownerWindow</code> is <var
274     title="">worker</var>. This list includes all the <code>MessagePort</code>
275 wakaba 1.43 objects that are in events pending in the <a href=#queue-a-task>queue of
276 apache 1.11 events</a>.
277     #ja
278 wakaba 1.43 各 <code><a href=#windowworker>WindowWorker</a></code> <var
279 apache 1.11 title="">worker</var> は、<dfn id=the-workers0>労働者のポート</dfn>の並びを持ちます。
280     これは、他のポートと絡められており、かつ <code title=dom-MessagePort-ownerWindow>ownerWindow</code>
281     が <var
282     title="">worker</var> であるポートを1つ (だけ) 持つような <code>MessagePort</code>
283 wakaba 1.43 オブジェクトすべてを含むものです。この並びは<a href=#queue-a-task>事象の待ち行列</a>中で未決の事象中にある
284 apache 1.11 <code>MessagePort</code> オブジェクトすべてを含みます。
285 apache 1.10
286 apache 1.17 #en
287 apache 1.24 A worker is said to be a <dfn id=front-line>front-line worker</dfn> if
288 wakaba 1.43 at least one of the <a href=#the-workers0>the worker's ports</a> has an
289 apache 1.24 entangled <code>MessagePort</code> whose <code
290     title=dom-MessagePort-ownerWindow>ownerWindow</code> is a
291     <code>WindowBrowsingContext</code> object.
292     #ja
293 wakaba 1.43 労働者は、<a href=#the-workers0>労働者のポート</a>の最低1つが、 <code
294 apache 1.24 title=dom-MessagePort-ownerWindow>ownerWindow</code> が
295     <code>WindowBrowsingContext</code>
296     オブジェクトであるような、絡められた <code>MessagePort</code>
297     を持つ場合、<dfn id=front-line>前線労働者</dfn>であるといいます。
298    
299     #en
300     A worker is said to be a <dfn id=needed>needed worker</dfn> if either:
301     #ja
302     労働者は、次のいずれかの場合、<dfn id=needed>必要な労働者</dfn>であるといいます。
303    
304     #en
305 wakaba 1.43 it is a <a href=#front-line>front-line worker</a>, or
306 apache 1.24 #ja
307 wakaba 1.43 <a href=#front-line>前線労働者</a>である場合。
308 apache 1.24
309     #en
310 wakaba 1.43 at least one of the <a href=#the-workers0>the worker's ports</a> has
311 apache 1.24 an entangled <code>MessagePort</code> whose <code
312     title=dom-MessagePort-ownerWindow>ownerWindow</code> is a <code><a
313 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object that is itself a <a
314     href=#needed>needed worker</a>.
315 apache 1.24 #ja
316 wakaba 1.43 <a href=#the-workers0>労働者のポート</a>の最低1つが、 <code
317 apache 1.24 title=dom-MessagePort-ownerWindow>ownerWindow</code> が<a
318 wakaba 1.43 href=#needed>必要な労働者</a>である <code><a
319     href=#windowworker>WindowWorker</a></code> オブジェクトであるような、
320 apache 1.24 絡められた <code>MessagePort</code> を持つ場合。
321    
322     #en
323 wakaba 1.43 A worker is said to be an <dfn id=active-document>active front-line worker</dfn>
324     if at least one of the <a href=#the-workers0>the worker's ports</a> has
325 apache 1.24 both an <code title=dom-MessagePort-active>active</code> attribute whose
326     value is true and an entangled <code>MessagePort</code> whose <code
327     title=dom-MessagePort-ownerWindow>ownerWindow</code> is a
328     <code>WindowBrowsingContext</code> object.
329     #ja
330 wakaba 1.43 労働者は、<a href=#the-workers0>労働者のポート</a>の最低1つが、
331 apache 1.24 その <code title=dom-MessagePort-active>active</code> 属性の値が真であり、
332     かつ <code
333     title=dom-MessagePort-ownerWindow>ownerWindow</code> が
334     <code>WindowBrowsingContext</code> オブジェクトであるような、
335     絡められた <code>MessagePort</code> を持つ場合、
336 wakaba 1.43 <dfn id=active-document>活性前線労働者</dfn>であるといいます。
337 apache 1.24
338     #en
339 wakaba 1.43 A worker is said to be an <dfn id=dom-messageport-active>active needed worker</dfn> if
340 apache 1.24 either:
341     #ja
342 wakaba 1.43 労働者は、次のいずれかの場合、<dfn id=dom-messageport-active>活性で必要な労働者</dfn>であるといいます。
343 apache 1.24
344     #en
345 wakaba 1.43 it is an <a href=#active-document>active front-line worker</a>, or
346 apache 1.24 #ja
347 wakaba 1.43 <a href=#active-document>活性前線労働者</a>である場合。
348 apache 1.24
349     #en
350 wakaba 1.43 at least one of the <a href=#the-workers0>the worker's ports</a> has
351 apache 1.24 an entangled <code>MessagePort</code> whose <code
352     title=dom-MessagePort-ownerWindow>ownerWindow</code> is a <code><a
353 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object that is itself an <a
354     href=#dom-messageport-active>active needed worker</a>.
355 apache 1.24 #ja
356 wakaba 1.43 <a href=#the-workers0>労働者のポート</a>の最低1つが、 <code
357 apache 1.24 title=dom-MessagePort-ownerWindow>ownerWindow</code> が<a
358 wakaba 1.43 href=#dom-messageport-active>活性で必要な労働者</a>である <code><a
359     href=#windowworker>WindowWorker</a></code> オブジェクトであるような、
360 apache 1.24 絡められた <code>MessagePort</code> を持つ場合。
361    
362     #en
363 apache 1.17 For each <code>MessagePort</code> object that is entangled with
364     another port and that has one (but only one) port whose <code
365     title=dom-MessagePort-ownerWindow>ownerWindow</code> is the <code><a
366 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object on which the method
367 apache 1.17 was invoked, run the following substeps:
368     #ja
369     他のポートと絡められており、かつ <code
370     title=dom-MessagePort-ownerWindow>ownerWindow</code>
371     がメソッドの呼び出された <code><a
372 wakaba 1.43 href=#windowworker>WindowWorker</a></code> オブジェクトであるポートを1つ
373 apache 1.17 (だけ) 持つような <code>MessagePort</code> について、それぞれ次の部分段階を走らせます。
374    
375 apache 1.10 #pattern
376     <span class=secno>* </span>Processing model
377     #ja
378     <span class=secno>$1 </span>処理モデル
379 apache 1.11
380     #en
381     When a user agent is to <dfn id=run-a>run a worker</dfn> named <var
382     title="">name</var> for a script with <span>URL</span> <var
383     title="">url</var>, a browsing context <var title="">owner browsing
384     context</var> and a <code>Document</code> <var title="">owner
385     document</var>, it must run the following steps in a completely separate
386     and parallel execution environment:
387     #ja
388     利用者エージェントが、<span>URL</span> <var
389     title="">url</var>、閲覧文脈 <var title="">owner browsing
390     context</var>、<code>Document</code> <var title="">owner
391     document</var> のスクリプトに対する、 <var
392 apache 1.14 title="">name</var> と名付けられた<dfn id=run-a>労働者を走らせる</dfn>、
393 apache 1.11 という時には、利用者エージェントは、次の段階を、完全に分離された並列実行環境で実行しなければ[[MUST:なりません]]。
394    
395     #en
396 apache 1.20 In a parallel execution context (i.e. a separate thread or process or
397 wakaba 1.43 equivalent construct), <a href=#run-a>run a worker</a> named <var
398 apache 1.20 title="">name</var> for the script with <span>URL</span> <var
399     title="">url</var>, with the <span>script browsing context</span> of the
400     script that invoked the method as the <var title="">owner browsing
401     context</var> and with the <span>script document context</span> of the
402     script that invoked the method as the <var title="">owner
403     document</var>.
404     #ja
405     並列実行文脈において (つまり、別のスレッドやプロセスや同様の構造において)、 <var title="">owner browsing
406     context</var> をメソッドを呼び出したスクリプトのスクリプト閲覧文脈、 <var title="">owner
407     document</var> をメソッドを呼び出したスクリプトのスクリプト文書文脈として、
408     URL
409     <var
410     title="">url</var> のスクリプトのための <var
411 wakaba 1.43 title="">name</var> という名前の<a href=#run-a>労働者を走らせます</a>。
412 apache 1.20
413     #en
414 apache 1.11 Attempt to <span>fetch</span><!-- XXX --> the resource identified by
415     <var title="">url</var>.
416     #ja
417     <var title="">url</var> で識別される資源を取って来ようと試みます。
418    
419     #en
420     If the attempt fails, then abort these steps and invoke the <a
421 wakaba 1.43 href=#worker title="worker creation failed">error handling steps</a>
422 apache 1.11 defined by the algorithm that called this one.
423     #ja
424     この試みが失敗した場合、これらの段階を停止し、この段階を呼び出した算法が定義する<a
425 wakaba 1.43 href=#worker title="worker creation failed">誤り取扱段階</a>を呼び出します。
426 apache 1.11
427     #en
428     If the attempt succeeds, then let <var title="">script</var> be the
429     resource that was obtained.
430     #ja
431     この試みが成功した場合、 <var title="">script</var>
432     を得られた資源とします。
433    
434     #en
435     As with <code>script</code> elements, the MIME type of the
436     script is ignored. Unlike with <code>script</code> elements, there is no
437     way to override the type. It's always assumed to be JavaScript.
438     #ja
439     <code>script</code> 要素と同様に、スクリプトの MIME 型は無視します。
440 apache 1.12 <code>script</code> 要素とは異なり、
441 apache 1.11 型を上書きする方法はありません。スクリプトは常に JavaScript
442     と仮定します。
443    
444     #en
445 wakaba 1.43 Create a new <code><a href=#windowworker>WindowWorker</a></code>
446 apache 1.25 object, <var title="">worker</var>.
447 apache 1.11 #ja
448 wakaba 1.43 新しい <code><a href=#windowworker>WindowWorker</a></code>
449 apache 1.25 オブジェクト <var title="">worker</var> を作成します。
450 apache 1.11
451     #en
452 wakaba 1.43 Set the <code title=dom-WindowWorker-URL><a href=#url>URL</a></code>
453 apache 1.25 attribute of <var title="">worker</var> to the value of <var
454 apache 1.13 title="">url</var>.
455     #ja
456 apache 1.25 <var title="">worker</var> の
457 wakaba 1.43 <code title=dom-WindowWorker-URL><a href=#url>URL</a></code>
458 apache 1.13 属性を <var
459     title="">url</var> の値に設定します。
460    
461     #en
462     Set the <code title=dom-WindowWorker-name><a
463 wakaba 1.43 href=#attr-meta-name>name</a></code> attribute of <var title="">worker</var> to
464 apache 1.11 the value of <var title="">name</var>.
465     #ja
466 apache 1.25 <var title="">worker</var> の <code title=dom-WindowWorker-name><a
467 wakaba 1.43 href=#attr-meta-name>name</a></code>
468 apache 1.11 属性を <var title="">name</var> の値に設定します。
469    
470     #en
471     Let <var title="">script</var>'s <span>script execution context</span>
472     (and thus also <span>global object</span>) be <var
473 apache 1.25 title="">worker</var>.
474 apache 1.11 #ja
475 apache 1.25 <var title="">script</var> のスクリプト実行文脈を (ひいては大域オブジェクトをも)
476     <var
477     title="">worker</var> とします。
478 apache 1.11
479     #en
480     Let <var title="">script</var>'s <span>script browsing context</span>
481     be <var title="">owner browsing context</var>.
482     #ja
483     <var title="">script</var> のスクリプト閲覧文脈を <var title="">owner browsing context</var>
484     とします。
485    
486     #en
487     Let <var title="">script</var>'s <span>script document context</span>
488    
489     be <var title="">owner document</var>.
490     #ja
491     <var title="">script</var> のスクリプト文書文脈を <var title="">owner document</var>
492     とします。
493    
494     #en
495 wakaba 1.43 Invoke the <a href=#success title="worker creation
496 apache 1.13 succeeded">success steps</a> defined by the algorithm that called this
497 apache 1.25 one.
498 apache 1.11 #ja
499 wakaba 1.43 この段階を呼び出す算法が定義する<a href=#success title="worker creation
500 apache 1.13 succeeded">成功段階</a>を呼び出します。
501 apache 1.25
502     #en
503     This will usually add an event to the <a
504 wakaba 1.43 href=#queue-a-task>queue of events</a>. If it does, that event will have a
505 apache 1.25 <code>MessagePort</code> and thus the list of <a
506 wakaba 1.43 href=#the-workers0>the worker's ports</a> will not be empty. If it
507 apache 1.25 doesn't, then the next step will set the <var title="">worker</var>
508     object's <code title=dom-WindowWorker-closing><a
509 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> attribute to true.
510 apache 1.25 #ja
511     これは、通常、事象を1つ<a
512 wakaba 1.43 href=#queue-a-task>事象の待ち行列</a>に追加します。その場合、
513 apache 1.25 追加される事象は <code>MessagePort</code> を持つはずなので、<a
514 wakaba 1.43 href=#the-workers0>労働者のポート</a>の並びは空にならないことになります。
515 apache 1.25 そうでない場合には、次の段階が <var title="">worker</var>
516     オブジェクトの <code title=dom-WindowWorker-closing><a
517 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> 属性を真に設定することとなります。
518 apache 1.11
519     #en
520 apache 1.26 Start monitoring <var title="">worker</var>, such that as soon as the
521 wakaba 1.43 worker stops being a <a href=#needed>needed worker</a>, the <var
522 apache 1.26 title="">worker</var> object's <code title=dom-WindowWorker-closing><a
523 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> attribute is set to true.
524 apache 1.26 #ja
525     <var title="">worker</var> の監視を開始し、
526 wakaba 1.43 労働者が<a href=#needed>必要な労働者</a>ではなくなると即座に
527 apache 1.26 <var title="">worker</var> オブジェクトの <code
528 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
529 apache 1.26 属性が真に設定されるようにします。
530    
531     #en
532 apache 1.11 Start monitoring <var title="">worker</var>, such that whenever the
533 apache 1.26 <var title="">worker</var> object's <code
534 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
535     attribute is false and the worker is not an <a href=#dom-messageport-active>active
536 apache 1.26 needed worker</a>, the user agent suspends execution of script in that
537     worker until such time as either the <code
538 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
539 apache 1.26 attribute switches to true or the worker becomes an <a
540 wakaba 1.43 href=#dom-messageport-active>active needed worker</a>.
541 apache 1.11 #ja
542     <var title="">worker</var> の監視を開始し、
543 apache 1.26 <var title="">worker</var> オブジェクトの <code
544 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
545     属性が偽であって、かつ労働者が<a href=#dom-messageport-active>活性で必要な労働者</a>ではないという時に、 <code
546     title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
547 apache 1.16 属性が真に切り替わるまで、
548 apache 1.26 または労働者が<a
549 wakaba 1.43 href=#dom-messageport-active>活性で必要な労働者</a>となるまでのいずれかの間、
550 apache 1.16 利用者エージェントがスクリプトを一時停止するようにします。
551 apache 1.13
552     #en
553     Run <var title="">script</var> until it either returns, fails to catch
554 wakaba 1.43 an exception, or gets prematurely aborted by the "<a href=#kill-a>kill
555 apache 1.13 a worker</a>" algorithm below.
556     #ja
557 wakaba 1.43 <var title="">script</var> を、返るか、例外の捕獲に失敗するか、後述の「<a href=#kill-a>労働者を殺す</a>」算法により早々に停止させられるかのいずれかまで走らせます。
558 apache 1.11
559 apache 1.15 #en
560 wakaba 1.43 If the script gets aborted by the "<a href=#kill-a>kill a
561 apache 1.15 worker</a>" algorithm, then that same algorithm will cause there to only
562 wakaba 1.43 be a single event in the <a href=#queue-a-task>queue of events</a> at the
563 apache 1.15 next step, namely the <code title=message-unload>unload</code> event.
564     However, if the event is ignored then it will become true as soon as
565     that port is garbage collected.
566     #ja
567 wakaba 1.43 スクリプトが「<a href=#kill-a>労働者を殺す</a>」算法で停止させられる場合には、
568     その同じ算法が、次の段階で、<a href=#queue-a-task>事象の待ち行列</a>には唯一
569 apache 1.15 <code title=message-unload>unload</code> 事象だけが含まれるようにします。
570     しかし、この事象が無視された場合には、これは、ポートがごみ収集される際に真となります。
571    
572     #en
573     <i>Event loop</i>: Wait until either there is an event in the <a
574 wakaba 1.43 href=#queue-a-task>queue of events</a> associated with <var
575 apache 1.27 title="">worker</var> or the <var title="">worker</var> object's <code
576 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
577 apache 1.15 attribute is set to true.
578     #ja
579     <i>事象ループ</i>: <var
580 apache 1.27 title="">worker</var> に関連付けられた<a
581 wakaba 1.43 href=#queue-a-task>事象の待ち行列</a>に事象が存在するようになるか、または
582 apache 1.27 <var title="">worker</var> オブジェクトの <code
583 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
584 apache 1.15 属性が真に設定されるまで待ちます。
585    
586     #en
587 wakaba 1.43 Dispatch the oldest event or callback in the <a href=#queue-a-task>queue of
588 apache 1.15 events</a>, if any. The handling of this event or the execution of this
589 wakaba 1.43 callback might get prematurely aborted by the "<a href=#kill-a>kill a
590 apache 1.15 worker</a>" algorithm below.
591     #ja
592 wakaba 1.43 <a href=#queue-a-task>事象の待ち行列</a>中で最古の事象か呼び戻しがあれば、
593     これを発送します。この事象の取扱いや呼び戻しの実行は、後述の「<a href=#kill-a>労働者を殺す</a>」
594 apache 1.15 算法により、早々に停止させられるかもしれません。
595    
596     #en
597 wakaba 1.43 If there are any more events in the <a href=#queue-a-task>queue of
598 apache 1.27 events</a> or if the <var title="">worker</var> object's <code
599 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
600 apache 1.15 attribute is set to false, then jump back to the step above labeled
601     <i>event loop</i>.
602     #ja
603 wakaba 1.43 <a href=#queue-a-task>事象の待ち行列</a>中に更に事象が存在する場合、
604 apache 1.27 または <var title="">worker</var> オブジェクトの <code
605 wakaba 1.43 title=dom-WindowWorker-closing><a href=#closing-a-browsing-context>closing</a></code>
606 apache 1.15 属性が偽に設定されている場合、前述の<i>事象ループ</i>との名札のある段階に飛んで戻ります。
607    
608     #en
609     timers, intervals, XMLHttpRequests, database
610     transactions, etc, must be killed; ports must be deactivated and
611     unentangled (do not send unload)
612     #ja
613     タイマー、休憩、 XMLHttpRequest、データベース取引、その他を殺さなければ[[MUST:なりません]]。
614     ポートを非活性化し、ほどかなければ[[MUST:なりません]] (unload を送りません)。
615    
616     #en
617     When a user agent is to <dfn id=kill-a>kill a worker</dfn>, it must run
618     the following steps in parallel with the worker's main loop (the "<a
619 wakaba 1.43 href=#run-a>run a worker</a>" processing model defined above):
620 apache 1.15 #ja
621     利用者エージェントが<dfn id=kill-a>労働者を殺す</dfn>という時には、
622     利用者エージェントは、次の段階を労働者の主たるループ (先に定義した「<a
623 wakaba 1.43 href=#run-a>労働者を走らせる</a>」処理モデル) と並列に走らせなければ[[MUST:なりません]]。
624 apache 1.15
625     #en
626     Create an <code>Event</code> object with the event name <code
627     title=event-unload>unload</code>, which does not bubble and is not
628     cancelable, and add it to the worker's <code><a
629 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object's <a
630     href=#queue-a-task>queue of events</a>, targetted at the <code><a
631     href=#windowworker>WindowWorker</a></code> object itself.
632 apache 1.15 #ja
633     事象名が <code
634     title=event-unload>unload</code> であり、
635     泡立たず、取消可能ではない
636     <code>Event</code> オブジェクトを作成し、労働者の <code><a
637 wakaba 1.43 href=#windowworker>WindowWorker</a></code>
638 apache 1.15 オブジェクトの<a
639 wakaba 1.43 href=#queue-a-task>事象の待ち行列</a>に追加し、 <code><a
640     href=#windowworker>WindowWorker</a></code>
641 apache 1.15 オブジェクト自体を対象とします。
642    
643     #en
644 apache 1.17 Create an <code>Event</code> object with the event name <code
645     title=event-unload>unload</code>, which does not bubble and is not
646     cancelable, and add it to the <code><a
647 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object's <a
648     href=#queue-a-task>queue of events</a>, targetted at the <code><a
649     href=#windowworker>WindowWorker</a></code> object itself.
650 apache 1.17 #ja
651     事象名が <code
652     title=event-unload>unload</code> であり、
653     泡立たず、取消可能ではない
654     <code>Event</code> オブジェクトを作成し、 <code><a
655 wakaba 1.43 href=#windowworker>WindowWorker</a></code>
656 apache 1.17 オブジェクトの<a
657 wakaba 1.43 href=#queue-a-task>事象の待ち行列</a>に追加し、 <code><a
658     href=#windowworker>WindowWorker</a></code>
659 apache 1.17 オブジェクト自体を対象とします。
660    
661     #en
662 wakaba 1.43 Set the worker's <code><a href=#windowworker>WindowWorker</a></code>
663 apache 1.15 object's <code title=dom-WindowWorker-closing><a
664 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> attribute to true.
665 apache 1.15 #ja
666 wakaba 1.43 労働者の <code><a href=#windowworker>WindowWorker</a></code>
667 apache 1.15 オブジェクトの
668     <code title=dom-WindowWorker-closing><a
669 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code>
670 apache 1.15 属性を真に設定します。
671    
672     #en
673 wakaba 1.43 Wait a user-agent-defined amount of time. If the "<a href=#run-a>run
674 apache 1.15 a worker</a>" processing model defined above immediately starts running
675     event listeners registered for <code title=event-unload>unload</code>
676     event, this time should not be zero &mdash; the idea is that the <code
677     title=event-unload>unload</code> event can be used to clean up when
678     shutting down unexpectedly.
679     #ja
680 wakaba 1.43 利用者エージェント定義の時間、待ちます。先に定義した「<a href=#run-a>労働者を走らせる</a>」
681 apache 1.15 処理モデルが <code title=event-unload>unload</code>
682     事象に登録された事象聴取器を即座に走らせ始める場合には、この時間は零である[[SHOULD NOT:べきではありません]]。
683     というのは、予期せず停止させる時に浄化するために <code
684     title=event-unload>unload</code> 事象を使えるようにするのが目的だからです。
685    
686     #en
687 wakaba 1.43 If there are any events in the <a href=#queue-a-task>queue of events</a>
688 apache 1.15 other than the <code title=event-unload>unload</code> event that this
689     algorithm just added, discard them without dispatching them.
690     #ja
691 wakaba 1.43 <a href=#queue-a-task>事象の待ち行列</a>中にこの算法が追加した
692 apache 1.15 <code title=event-unload>unload</code>
693     事象以外の事象が存在する場合には、それらを発送せずに捨てます。
694    
695     #en
696     If the <code title=event-unload>unload</code> event that this
697     algorithm just added hasn't yet been dispatched, then abort the script
698     currently running in the worker.
699     #ja
700     この算法が追加した <code title=event-unload>unload</code>
701     事象がまだ発送されていなければ、現在労働者中で走っているスクリプトを停止します。
702    
703     #en
704     Wait a user-agent-defined amount of time.
705     #ja
706     利用者エージェント定義の時間、待ちます。
707    
708     #en
709     Abort the script currently running in the worker (if any script is
710     running, then it will be a handler for the <code
711     title=event-unload>unload</code> event).
712     #ja
713     現在労働者中で走っているスクリプト (スクリプトが走っているとすると、
714     これは <code
715     title=event-unload>unload</code>
716     事象の取扱器です。) を停止します。
717    
718     #en
719 wakaba 1.43 User agents may invoke the "<a href=#kill-a>kill a worker</a>"
720 apache 1.28 processing model on a worker at any time, e.g. in response to user
721     requests, in response to CPU quota management, or when a worker stops
722 wakaba 1.43 being a <a href=#needed>needed worker</a> if the worker continues
723 apache 1.28 executing even after its <code title=dom-WindowWorker-closing><a
724 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> attribute was set to true.
725 apache 1.28 #ja
726     利用者エージェントは、いつであっても、例えば利用者の要求に応じて、 CPU
727     割当管理に応じて、あるいは労働者がその <code title=dom-WindowWorker-closing><a
728 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> 属性が真に設定された後であっても実行し続けている場合で労働者が<a href=#needed>必要な労働者</a>ではなくなった時などに、
729     「<a href=#kill-a>労働者を殺す</a>」処理モデルを呼び出して[[MAY:構いません]]。
730 apache 1.28
731     #en
732     When a script invokes the <dfn id=import
733     title=dom-WindowWorker-import><code>import(<var
734     title="">url</var>)</code></dfn> method on a <code><a
735 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object, the user agent must
736 apache 1.28 run the following steps:
737     #ja
738     利用者エージェントは、スクリプトが <code><a
739 wakaba 1.43 href=#windowworker>WindowWorker</a></code>
740 apache 1.28 オブジェクトの <dfn id=import
741     title=dom-WindowWorker-import><code>import(<var
742     title="">url</var>)</code></dfn> メソッドを呼び出した時、
743     次の段階を走らせなければ[[MUST:なりません]]。
744    
745     #en
746     <span title="resolve a url">Resolve</span> the <var title="">url</var>
747     argument.
748     #ja
749     <var title="">url</var> 引数を<span title="resolve a url">解決</span>します。
750    
751     #en
752     Attempt to <span>fetch</span><!-- XXX --> the resource identified by
753     the resulting <span>absolute URL</span>.
754     #ja
755     得られた<span>絶対 URL</span> で識別される資源を<span>取って来</span><!-- XXX -->ようとします。
756    
757     #en
758     If the attempt fails, return false and abort these steps.
759     #ja
760     この試みが失敗した場合、偽を返し、これらの段階を停止します。
761    
762     #en
763     As with the initial script, the script here is always
764     assumed to be JavaScript, regardless of the MIME type.
765     #ja
766     はじめのスクリプトと同様に、ここでのスクリプトも、 MIME 型に関わらず常に JavaScript
767     であると仮定します。
768    
769     #en
770     Let <var title="">script</var>'s <span>script execution
771     context</span>, <span>script browsing context</span>, and <span>script
772     document context</span> be the same as for the script that was executed
773 wakaba 1.43 by the <a href=#run-a>run a worker</a> processing model for this
774 apache 1.28 worker.
775     #ja
776     <var title="">script</var> の<span>スクリプト実行文脈</span>、
777     <span>スクリプト閲覧文脈</span>、<span>スクリプト文書文脈</span>を、
778 wakaba 1.43 この労働者についての<a href=#run-a>労働者を走らせる</a>処理モデルで実行されたスクリプトについてのものと同じとします。
779 apache 1.28
780     #en
781     If an exception was raised or if the script was prematurely aborted,
782     then abort these steps, letting the exception or aborting continue to be
783     processed by the script that called the <code
784 wakaba 1.43 title=dom-WindowWorker-import><a href=#import>import()</a></code>
785 apache 1.28 method.
786     #ja
787     実行が投げた場合やスクリプトが早々に停止された場合、これらの段階を停止し、
788     例外や停止を <code
789 wakaba 1.43 title=dom-WindowWorker-import><a href=#import>import()</a></code>
790 apache 1.28 メソッドを呼んだスクリプトに処理させ続けます。
791    
792     #en
793     Otherwise, return true.
794     #ja
795     そうでない場合、真を返します。
796    
797     #en
798 wakaba 1.43 When a script invokes the <dfn id=close-tag-open-state
799 apache 1.15 title=dom-WindowWorker-close><code>close()</code></dfn> method on a
800 wakaba 1.43 <code><a href=#windowworker>WindowWorker</a></code> object, the user
801 apache 1.15 agent must run the following steps:
802     #ja
803 wakaba 1.43 スクリプトが <code><a href=#windowworker>WindowWorker</a></code>
804     オブジェクトで <dfn id=close-tag-open-state
805 apache 1.15 title=dom-WindowWorker-close><code>close()</code></dfn>
806     メソッドを呼び出した場合、利用者エージェントは、次の段階を走らせなければ[[MUST:なりません]]。
807 apache 1.17
808     #en
809     Unentangle the two ports.
810     #ja
811     2つのポートをほどきます。
812    
813     #en
814     Set both ports' <code title=dom-MessagePort-active>active</code>
815     attribute to false.
816     #ja
817     両ポートの <code title=dom-MessagePort-active>active</code>
818     属性を偽に設定します。
819    
820     #en
821     At the next available opportunity, after any scripts have finished
822     executing<!-- XXX queue -->, <span>fire a simple event</span> called
823     <code title=event-unload>unload</code> at the other port (the one
824     whose <code title=dom-MessagePort-ownerWindow>ownerWindow</code> is
825 wakaba 1.43 not the <code><a href=#windowworker>WindowWorker</a></code> object
826 apache 1.17 on which the <code title=dom-WindowWorker-close><a
827 wakaba 1.43 href=#close-tag-open-state>close()</a></code> method was called).
828 apache 1.17 #ja
829 apache 1.20 次の利用可能な機会、何らかのスクリプトが実行し終えた後に、
830 apache 1.17 他方のポート (<code title=dom-MessagePort-ownerWindow>ownerWindow</code>
831     が <code title=dom-WindowWorker-close><a
832 wakaba 1.43 href=#close-tag-open-state>close()</a></code>
833     メソッドが呼ばれた <code><a href=#windowworker>WindowWorker</a></code>
834 apache 1.20 オブジェクトではない方) で <code title=event-unload>unload</code>
835 apache 1.17 と呼ばれる単純事象を発火します。
836    
837     #pattern
838     <span class=secno>* </span>Creating workers
839     #ja
840     <span class=secno>$1 </span>労働者の作成
841    
842     #pattern
843     Objects that implement the * interface must also
844     implement the * interface.
845     #ja
846     $1 界面を実装するオブジェクトは、 $2 界面も実装しなければ[[MUST:なりません]]。
847    
848 apache 1.19 #pattern
849     When the * method is invoked, the user agent
850 apache 1.17 must run the following steps:
851     #ja
852 apache 1.19 利用者エージェントは、 $1 メソッドが呼び出された時、
853 apache 1.17 次の段階を走らせなければ[[MUST:なりません]]。
854 apache 1.15
855 apache 1.18 #en
856     <span title="resolve a url">Resolve</span> the <var
857     title="">scriptURL</var> argument.
858     #ja
859     <var
860     title="">scriptURL</var> 引数を<span title="resolve a url">解決</span>します。
861    
862     #en
863     If this fails, throw a <code>SYNTAX_ERR</code> exception.
864     #ja
865     これが失敗した場合、 <code>SYNTAX_ERR</code>
866     例外を投げます。
867    
868     #en
869     If the <span>origin</span> of the resulting <span>absolute URL</span>
870     is not the <span title="same origin">same</span> as the origin of the
871     script that invoked the method, then throw a <span>security
872     exception</span>.
873     #ja
874     得られた絶対 URL の起源がメソッドを呼び出したスクリプトの起源と<span title="same origin">同じ</span>でない場合、
875     保安性例外を投げます。
876    
877     #en
878 wakaba 1.43 <a href=#create-a-new-messageport-object>Create a worker</a> from the resulting
879 apache 1.18 <span>absolute URL</span> whose name is the empty string.
880     #ja
881 wakaba 1.43 得られた絶対 URL から、名前が空文字列である<a href=#create-a-new-messageport-object>労働者を作成</a>します。
882 apache 1.18
883     #en
884     Return the <code>MessagePort</code> object returned from the <a
885 wakaba 1.43 href=#create-a-new-messageport-object>create a worker</a> algorithm.
886 apache 1.18 #ja
887     <a
888 wakaba 1.43 href=#create-a-new-messageport-object>労働者を作成</a>する算法が返した
889 apache 1.18 <code>MessagePort</code> オブジェクトを返します。
890 apache 1.19
891     #en
892     If the <var title="">name</var> argument is the empty string, <a
893 wakaba 1.43 href=#create-a-new-messageport-object>create a worker</a> from the resulting <span>absolute
894 apache 1.19 URL</span>, whose name is the empty string, and return the
895     <code>MessagePort</code> object returned from the <a
896 wakaba 1.43 href=#create-a-new-messageport-object>create a worker</a> algorithm. Then, abort these steps.
897 apache 1.19 #ja
898     <var title="">name</var> 引数が空文字列の場合、得られた絶対 URL から、
899     名前が空文字列である<a
900 wakaba 1.43 href=#create-a-new-messageport-object>労働者を作成</a>し、<a
901     href=#create-a-new-messageport-object>労働者を作成</a>する算法が返した <code>MessagePort</code>
902 apache 1.19 オブジェクトを返します。そして、これらの段階を停止します。
903    
904     #en
905     If there exists a worker whose <code title=dom-WindowWorker-closing><a
906 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> attribute is false, whose <code
907     title=dom-WindowWorker-name><a href=#attr-meta-name>name</a></code> attribute is
908 apache 1.19 exactly equal to the <var title="">name</var> argument, and whose <code
909 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code> attribute has
910 apache 1.19 the <span>same origin</span> as the resulting <span>absolute URL</span>,
911     then run these substeps:
912     #ja
913     <code title=dom-WindowWorker-closing><a
914 wakaba 1.43 href=#closing-a-browsing-context>closing</a></code> 属性が偽で、 <code
915     title=dom-WindowWorker-name><a href=#attr-meta-name>name</a></code>
916 apache 1.19 属性が <var title="">name</var> 引数と全く等しく、 <code
917 wakaba 1.43 title=dom-WindowWorker-URL><a href=#url>URL</a></code>
918 apache 1.19 属性が得られた絶対 URL と同じ起源を持つ労働者が存在する場合、
919     次の部分段階を走らせます。
920    
921     #en
922     If that worker's <code title=dom-WindowWorker-URL><a
923 wakaba 1.43 href=#url>URL</a></code> attribute is not exactly equal to the
924 apache 1.19 resulting <span>absolute URL</span>, then throw a
925     <code>URL_MISMATCH_ERR</code> exception and abort these steps. <span
926     class=big-issue>code 19</span>
927     #ja
928     当該労働者の <code title=dom-WindowWorker-URL><a
929 wakaba 1.43 href=#url>URL</a></code>
930 apache 1.19 属性が得られた絶対 URL と全く等しくはない場合、 <code>URL_MISMATCH_ERR</code>
931     例外を投げ、これらの段階を停止します。 <span
932     class=big-issue>code 19</span>
933    
934     #en
935     <span>Create a new <code>MessagePort</code> object</span> owned by
936     the <span>script execution context</span> of the script that invoked
937     the method.
938     #ja
939     メソッドを呼び出したスクリプトのスクリプト実行文脈が所有する新しい <code>MessagePort</code>
940     オブジェクトを作成します。
941    
942     #en
943     Return that port.
944     #ja
945     そのポートを返します。
946    
947     #en
948 wakaba 1.43 Asynchronously, <a href=#connect title="connect to a
949 apache 1.29 worker">connect</a> to this preexisting worker, with the newly created
950 apache 1.19 port.
951     #ja
952 wakaba 1.43 非同期に、この既存の労働者を新しく作成されたポートに<a href=#connect title="connect to a
953 apache 1.29 worker">接続</a>します。
954 apache 1.19
955     #en
956 wakaba 1.43 Otherwise, <a href=#create-a-new-messageport-object>create a worker</a> from the resulting
957 apache 1.19 <span>absolute URL</span>, whose name is the value of the <var
958     title="">name</var> argument, and return the <code>MessagePort</code>
959 wakaba 1.43 object returned from the <a href=#create-a-new-messageport-object>create a worker</a>
960 apache 1.19 algorithm.
961     #ja
962     そうでない場合、得られた絶対 URL から、名前が <var
963 wakaba 1.43 title="">name</var> 引数の値である<a href=#create-a-new-messageport-object>労働者を作成</a>し、
964     <a href=#create-a-new-messageport-object>労働者を作成</a>する算法が返した <code>MessagePort</code>
965 apache 1.19 オブジェクトを返します。
966    
967     #en
968 wakaba 1.43 The steps to <dfn id=create-a-new-messageport-object>create a worker</dfn> from a
969 apache 1.19 <span>URL</span> <var title="">url</var> and whose name is <var
970     title="">name</var>, in the context of a method call, are as follows:
971     #ja
972     メソッド呼び出しの文脈において、 URL <var title="">url</var> から名前 <var
973 wakaba 1.43 title="">name</var> の<dfn id=create-a-new-messageport-object>労働者を作成</dfn>する段階は、次の通りです。
974 apache 1.18
975 apache 1.20 #en
976     If that algorithm invokes the steps for <dfn id=success title="worker
977 wakaba 1.43 creation succeeded">success steps</dfn>, then <a href=#connect
978 apache 1.29 title="connect to a worker">connect</a> to this new worker, with the
979     newly created port.
980 apache 1.20 #ja
981     その算法が<dfn id=success title="worker
982     creation succeeded">成功段階</dfn>の段階を呼び出す場合は、
983 wakaba 1.43 この新しい労働者に、新しく作成されたポートと共に<a href=#connect
984 apache 1.29 title="connect to a worker">接続</a>します。
985 apache 1.20
986     #en
987     Otherwise, if the <dfn id=worker>worker creation failed</dfn>, then at
988     the next available opportunity, after any scripts have finished
989     executing<!-- XXX queue -->, <span>fire a simple event</span> called
990     <code title=event-error>error</code> at the newly created port.
991     #ja
992     そうでない場合、<dfn id=worker>労働者作成が失敗</dfn>した場合、次の利用可能な機会、
993     何らかのスクリプトが実行し終えた後に、新しく作成されたポートで
994     <code title=event-error>error</code>
995     と呼ばれる単純事象を発火します。
996    
997     #en
998 apache 1.30 The steps to <dfn id=connect>connect to a worker</dfn> given a
999 apache 1.20 <code>MessagePort</code> object <var title="">port</var> are as follows:
1000     #ja
1001 apache 1.30 与えられた <code>MessagePort</code> オブジェクト <var title="">port</var>
1002     により<dfn id=connect>労働者に接続</dfn>する段階は、次の通りです。
1003 apache 1.20
1004     #en
1005     If <var title="">port</var> would have been garbage collected, or if
1006     the <span>active document</span> of the <code
1007     title=dom-MessagePort-ownerWindow>ownerWindow</code> of <var
1008     title="">port</var> is no longer the same <code>Document</code> object
1009     as when <var title="">port</var> was created, then do nothing. Abort
1010     these steps. If the worker was just created, it'll get killed
1011     immediately.
1012     #ja
1013     <var title="">port</var> がごみ収集されている場合、あるいは <var
1014     title="">port</var> の <code
1015     title=dom-MessagePort-ownerWindow>ownerWindow</code> の活性文書が既に
1016     <var title="">port</var> が作成された時と同じ <code>Document</code>
1017     オブジェクトでない場合には、何もしません。これらの段階を停止します。
1018     労働者が丁度作成されたばかりの場合には、これはすぐに殺されることになります。
1019    
1020     #en
1021     <span>Create a new <code>MessagePort</code> object</span> owned by the
1022 wakaba 1.43 <code><a href=#windowworker>WindowWorker</a></code> of the worker.
1023 apache 1.20 #ja
1024 wakaba 1.43 労働者の <code><a href=#windowworker>WindowWorker</a></code>
1025 apache 1.35 が所有する<span>新しい <code>MessagePort</code>
1026     オブジェクトを作成</span>します。
1027 apache 1.20
1028     #en
1029     <span>Entangle</span> this newly created port and the port <var
1030     title="">port</var> that was passed to these steps.
1031     #ja
1032     この新しく作成されたポートとこれらの段階に渡されたポート <var
1033     title="">port</var> を絡めます。
1034    
1035     #en
1036     Set the <code title=dom-MessagePort-active>active</code> attribute of
1037     both ports to true.
1038     #ja
1039     両ポートの
1040     <code title=dom-MessagePort-active>active</code>
1041     属性を真に設定します。
1042    
1043     #en
1044     At the next available opportunity, after any scripts have finished
1045     executing<!-- XXX queue -->, <span>fire a simple event</span> called
1046     <code title=event-load>load</code> at <var title="">port</var>.
1047     #ja
1048     次の利用可能な機会、何らかのスクリプトが実行し終えた後に、
1049     <var title="">port</var> において <code title=event-load>load</code>
1050     と呼ばれる単純事象を発火します。
1051    
1052     #en
1053     Create an event that uses the <code>MessageEvent</code> interface,
1054 apache 1.30 with the name <code title=event-connect>connect</code>, which does not
1055 apache 1.20 bubble, is cancelable, has no default action, has a <code
1056     title=dom-MessageEvent-data>data</code> attribute whose value is the
1057     empty string and has a <code
1058     title=dom-MessageEvent-messagePort>messagePort</code> attribute whose
1059     value is the newly created port, and add it to the worker's <code><a
1060 wakaba 1.43 href=#windowworker>WindowWorker</a></code> object's <a
1061     href=#queue-a-task>queue of events</a>, targetted at the <code><a
1062     href=#windowworker>WindowWorker</a></code> object itself.
1063 apache 1.20 #ja
1064 apache 1.30 <code>MessageEvent</code> 界面を使った、名前 <code title=event-connect>connect</code>
1065 apache 1.20 の泡立たず、取消し可能で、既定作用を持たず、 <code
1066     title=dom-MessageEvent-data>data</code> 属性の値が空文字列で、 <code
1067     title=dom-MessageEvent-messagePort>messagePort</code> 属性の値が新たに作成されたポートである事象を作成し、
1068     これを労働者の <code><a
1069 wakaba 1.43 href=#windowworker>WindowWorker</a></code> オブジェクトの<a
1070     href=#queue-a-task>事象の待ち行列</a>に、 <code><a
1071     href=#windowworker>WindowWorker</a></code>
1072 apache 1.20 オブジェクト自体を対象として追加します。
1073    
1074     #pattern
1075     <span class=secno>* </span>APIs available to workers
1076     #ja
1077     <span class=secno>$1 </span>労働者が利用可能な API
1078    
1079     #en
1080 apache 1.31 There must be no interface objects and constructors available in the
1081     global scope of scripts whose <span>script execution context</span> is a
1082 wakaba 1.43 <code><a href=#windowworker>WindowWorker</a></code> object except for
1083 apache 1.31 the following:
1084     #ja
1085 wakaba 1.43 <span>スクリプト実行文脈</span>が <code><a href=#windowworker>WindowWorker</a></code>
1086 apache 1.31 オブジェクトであるスクリプトの大域範囲には、次のものを除き、
1087     界面オブジェクトや構築器を利用可能としては[[MUST:なりません]]。
1088    
1089     #en
1090     <code>XMLHttpRequest</code> and all interface objects and constructors
1091     defined by the XMLHttpRequest specifications, except that the
1092     <span>document response entity body</span> must always be null. <a
1093 wakaba 1.43 href=#refsXHR>[XHR]</a>
1094 apache 1.31 #ja
1095     XMLHttpRequest 仕様書で定義されている
1096 apache 1.34 <code>XMLHttpRequest</code> とすべての界面オブジェクトと構築器、
1097 apache 1.31 ただし<span>文書応答実体本体</span>は常に null でなければ[[MUST:なりません]]。 <a
1098 wakaba 1.43 href=#refsXHR>[XHR]</a>
1099 apache 1.31
1100     #en
1101     The <code>WebSocket</code> interface object and constructor.
1102     #ja
1103     <code>WebSocket</code> 界面オブジェクトと構築器
1104    
1105     #en
1106 apache 1.33 The <code>MessageChannel</code> interface object and constructor.
1107     #ja
1108 apache 1.31 <code>MessageChannel</code> 界面オブジェクトと構築器
1109    
1110     #en
1111 apache 1.20 Objects that implement the <code><a
1112 wakaba 1.43 href=#windowworker>WindowWorker</a></code> interface must also implement
1113 apache 1.20 the following interfaces:
1114     #ja
1115     <code><a
1116 wakaba 1.43 href=#windowworker>WindowWorker</a></code> 事象を実装するオブジェクトは、
1117 apache 1.20 次の界面も実装しなければ[[MUST:なりません]]。
1118    
1119     #en
1120     The <code>Window</code> interface, and interfaces that are required to
1121     be implemented by objects implementing that interface, including:
1122     #ja
1123     <code>Window</code> 界面と、この界面を実装するオブジェクトが実装することを[[REQUIRED:要求]]されている界面。
1124     これには、次の界面が含まれます。
1125    
1126 apache 1.32 #en
1127     The following APIs are available in workers due to their being defined
1128     on the <code>Window</code> object or one of the interfaces that are
1129     required to be implemented by objects implementing that interface:
1130     #ja
1131     次の API は、 <code>Window</code> オブジェクトに定義されているか、
1132     その界面を実装しているオブジェクトが実装することが要求<!-- lowercase required,
1133     since this paragraph is non-normative -->されている界面の1つで定義されているので、
1134     労働者に利用可能です。
1135    
1136     #en
1137     The <code title=dom-showNotification>showNotification()</code> APIs.
1138     #ja
1139     <code title=dom-showNotification>showNotification()</code> API。
1140    
1141     #en
1142     The <code title=dom-localStorage>localStorage</code> object and
1143     related name/value pair storage APIs.
1144     #ja
1145     <code title=dom-localStorage>localStorage</code> オブジェクトと、
1146     関連する名前・値組蓄積庫 API。
1147    
1148     #en
1149     The <code title=dom-openDatabase>openDatabase()</code> method and the
1150     related SQL database API.
1151     #ja
1152     <code title=dom-openDatabase>openDatabase()</code> メソッドと関連する
1153     SQL データベース API。
1154    
1155     #en
1156     The DOM APIs (<code>Node</code> objects, <code>Document</code> objects,
1157     etc) are not available to workers in this version of this specification.
1158     #ja
1159     DOM API (<code>Node</code> オブジェクト、 <code>Document</code>
1160     オブジェクト、その他) は、この版のこの仕様書では労働者に利用可能ではありません。
1161    
1162 apache 1.20 #pattern
1163     The * interface
1164     #ja
1165     $1 界面
1166 apache 1.21
1167     #pattern
1168     The * interface.
1169     #ja
1170     $1 界面。
1171 apache 1.42
1172    
1173     #en
1174 apache 1.36 There are a variety of uses that workers can be put to. The following
1175 apache 1.42 subsections show various examples of this use.
1176     #ja
1177     労働者は色々なことに使えます。次の各節では、色々な使い方の例を示します。
1178    
1179     #pattern
1180 apache 1.37 <span class=secno>* </span>A background
1181 apache 1.42 number-crunching worker
1182     #ja
1183     <span class=secno>$1 </span>数値処理背景労働者
1184    
1185     #en
1186     The simplest use of workers is for performing a computationally expensive task without interrupting the user interface.
1187     #ja
1188     労働者の一番単純な用法は、計算的に高価な仕事を利用者界面を中断させずに実行することです。
1189    
1190     #en
1191 apache 1.38 In this example, the main document spawns a worker to (na&iuml;vely)
1192     compute prime numbers, and progressively displays the most recently found
1193 apache 1.42 prime number.
1194     #ja
1195 apache 1.38 この例では、主たる文書が労働者を作って素数を (素朴な方法で) 計算させ、
1196     新しく見つかった素数を順番に表示してゆきます。
1197 apache 1.42
1198    
1199     #en
1200     The main page is as follows:
1201     #ja
1202     主たる頁は次の通りです。
1203    
1204     #en
1205     The worker itself is as follows:
1206     #ja
1207     労働者自体は次の通りです。
1208    
1209     #pattern
1210 wakaba 1.43 <a href=*>View this
1211 apache 1.42 example online</a>.
1212     #ja
1213 wakaba 1.43 <a href=$1>この例をオンラインで見る</a>。

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24