| 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 |
|
|
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 |
|
|
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 |
|
|
href="#windowworker">WindowWorker</a></code>
|
| 127 |
|
|
オブジェクトが「<a
|
| 128 |
apache |
1.14 |
href="#run-a">労働者を走らせる</a>」算法で作成された時に割り当てられた値を返さなければ[[MUST:なりません]]。
|
| 129 |
apache |
1.13 |
その値は、労働者を初期化するために使用されたスクリプトの絶対 URL を表します。
|
| 130 |
apache |
1.10 |
|
| 131 |
|
|
#en
|
| 132 |
apache |
1.13 |
The <dfn id=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 |
|
|
href="#windowworker">WindowWorker</a></code> object was created by the "<a
|
| 135 |
apache |
1.13 |
href="#run-a">run a worker</a>" algorithm. If it has a value that isn't
|
| 136 |
|
|
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 |
|
|
href="#createnamedworker">createNamedWorker()</a></code> method.
|
| 140 |
apache |
1.10 |
#ja
|
| 141 |
|
|
<dfn id=name title=dom-windowworker-name><code>name</code></dfn>
|
| 142 |
|
|
属性は、<code><a
|
| 143 |
|
|
href="#windowworker">WindowWorker</a></code> オブジェクトが「<a
|
| 144 |
apache |
1.14 |
href="#run-a">労働者を走らせる</a>」算法で作成された時に割り当てられた値を返さなければ[[MUST:なりません]]。この値が空文字列でなければ、
|
| 145 |
apache |
1.13 |
その値は、 <code
|
| 146 |
|
|
title=dom-WindowWorkerCreators-createNamedWorker><a
|
| 147 |
|
|
href="#createnamedworker">createNamedWorker()</a></code>
|
| 148 |
|
|
メソッドを使って労働者への参照を得るために使うことができる名前を表します。
|
| 149 |
apache |
1.10 |
|
| 150 |
|
|
#en
|
| 151 |
|
|
The <dfn id=closing
|
| 152 |
|
|
title=dom-windowworker-closing><code>closing</code></dfn> attribute must
|
| 153 |
|
|
return false until the "<a href="#kill-a">kill a worker</a>" processing
|
| 154 |
|
|
model defined below sets it to true.
|
| 155 |
|
|
#ja
|
| 156 |
|
|
<dfn id=closing
|
| 157 |
|
|
title=dom-windowworker-closing><code>closing</code></dfn>
|
| 158 |
apache |
1.11 |
属性は、後述の「<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 |
|
|
href="#windowworker">WindowWorker</a></code> interface:
|
| 165 |
|
|
#ja
|
| 166 |
|
|
次に示すのは、 <code><a
|
| 167 |
|
|
href="#windowworker">WindowWorker</a></code>
|
| 168 |
|
|
界面を実装するオブジェクトが対応しなければ[[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 |
|
|
<span class=secno>* </span>The queue of events
|
| 179 |
|
|
#ja
|
| 180 |
|
|
<span class=secno>$1 </span>事象の待ち行列
|
| 181 |
|
|
|
| 182 |
|
|
#en
|
| 183 |
|
|
Each <code><a href="#windowworker">WindowWorker</a></code> object is
|
| 184 |
|
|
asssociated with a <dfn id=queue>queue of events</dfn>, which is initially
|
| 185 |
|
|
empty.
|
| 186 |
|
|
#ja
|
| 187 |
|
|
各 <code><a href="#windowworker">WindowWorker</a></code> オブジェクトは、
|
| 188 |
|
|
<dfn id=queue>事象の待ち行列</dfn> (はじめは空) と関連付けられています。
|
| 189 |
|
|
|
| 190 |
|
|
#en
|
| 191 |
|
|
An event in the queue can be a DOM event or a timeout callback.
|
| 192 |
|
|
#ja
|
| 193 |
apache |
1.11 |
待ち行列中の事象は、 DOM 事象か小休止呼び戻しのいずれかです。
|
| 194 |
|
|
|
| 195 |
|
|
#en
|
| 196 |
|
|
All asynchronous callbacks and events that would be called or dispatched
|
| 197 |
|
|
in the worker must be added to the worker's queue, with the "<a
|
| 198 |
|
|
href="#run-a">run a worker</a>" processing model below taking care of
|
| 199 |
|
|
actually calling the callbacks or dispatching the events.
|
| 200 |
|
|
#ja
|
| 201 |
|
|
労働者中で呼び出しまたは発送されるすべての非同期の呼び戻しと事象は、
|
| 202 |
|
|
作業者の待ち行列に追加されなければなりません。
|
| 203 |
|
|
ただし、実際の呼び戻しの呼び出しや事象の発送は、後述の「<a
|
| 204 |
apache |
1.14 |
href="#run-a">労働者を走らせる</a>」処理モデルに従い処理されます。
|
| 205 |
apache |
1.11 |
|
| 206 |
|
|
#en
|
| 207 |
|
|
Once the <code><a href="#windowworker">WindowWorker</a></code>'s <code
|
| 208 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 209 |
apache |
1.11 |
attribute is set to true, the queue must discard anything else that would
|
| 210 |
|
|
be added to it. Effectively, once the <code
|
| 211 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 212 |
apache |
1.11 |
attribute is true, timers stop firing, notifications for all pending
|
| 213 |
|
|
asynchronous operations are dropped, etc.
|
| 214 |
|
|
#ja
|
| 215 |
|
|
一旦 <code><a href="#windowworker">WindowWorker</a></code> の <code
|
| 216 |
|
|
title=dom-windowworker-closing><a href="#closing">closing</a></code>
|
| 217 |
|
|
属性が真に設定されると、待ち行列は、以後追加されるべきものがあっても、
|
| 218 |
|
|
すべて捨てなければ[[MUST:なりません]]。実効的には、一旦 <code
|
| 219 |
|
|
title=dom-windowworker-closing><a href="#closing">closing</a></code>
|
| 220 |
|
|
属性が真となると、タイマーが発火を停止したり、
|
| 221 |
apache |
1.13 |
すべての未決の非同期処理に関する通知は捨てられたりするようになるなどします。
|
| 222 |
apache |
1.11 |
|
| 223 |
|
|
#pattern
|
| 224 |
|
|
<span class=secno>* </span>The worker's ports
|
| 225 |
|
|
#ja
|
| 226 |
apache |
1.13 |
<span class=secno>$1 </span>労働者のポート
|
| 227 |
apache |
1.11 |
|
| 228 |
|
|
#en
|
| 229 |
|
|
Workers communicate with other workers and with <span title="browsing
|
| 230 |
|
|
context">browsing contexts</span> through <span title="channel
|
| 231 |
|
|
messaging">message channels</span> and their <code>MessagePort</code>
|
| 232 |
|
|
objects.
|
| 233 |
|
|
#ja
|
| 234 |
apache |
1.13 |
労働者は、メッセージ通信路とその <code>MessagePort</code>
|
| 235 |
apache |
1.11 |
オブジェクトを通じて、他の労働者や閲覧文脈と通信します。
|
| 236 |
|
|
|
| 237 |
|
|
#en
|
| 238 |
|
|
Each <code><a href="#windowworker">WindowWorker</a></code> <var
|
| 239 |
|
|
title="">worker</var> has a list of <dfn id=the-workers0>the worker's
|
| 240 |
|
|
ports</dfn>, which consists of all the <code>MessagePort</code> objects
|
| 241 |
|
|
that are entangled with another port and that have one (but only one) port
|
| 242 |
|
|
whose <code title=dom-MessagePort-ownerWindow>ownerWindow</code> is <var
|
| 243 |
|
|
title="">worker</var>. This list includes all the <code>MessagePort</code>
|
| 244 |
|
|
objects that are in events pending in the <a href="#queue">queue of
|
| 245 |
|
|
events</a>.
|
| 246 |
|
|
#ja
|
| 247 |
|
|
各 <code><a href="#windowworker">WindowWorker</a></code> <var
|
| 248 |
|
|
title="">worker</var> は、<dfn id=the-workers0>労働者のポート</dfn>の並びを持ちます。
|
| 249 |
|
|
これは、他のポートと絡められており、かつ <code title=dom-MessagePort-ownerWindow>ownerWindow</code>
|
| 250 |
|
|
が <var
|
| 251 |
|
|
title="">worker</var> であるポートを1つ (だけ) 持つような <code>MessagePort</code>
|
| 252 |
|
|
オブジェクトすべてを含むものです。この並びは<a href="#queue">事象の待ち行列</a>中で未決の事象中にある
|
| 253 |
|
|
<code>MessagePort</code> オブジェクトすべてを含みます。
|
| 254 |
apache |
1.10 |
|
| 255 |
|
|
#pattern
|
| 256 |
|
|
<span class=secno>* </span>Processing model
|
| 257 |
|
|
#ja
|
| 258 |
|
|
<span class=secno>$1 </span>処理モデル
|
| 259 |
apache |
1.11 |
|
| 260 |
|
|
#en
|
| 261 |
|
|
When a user agent is to <dfn id=run-a>run a worker</dfn> named <var
|
| 262 |
|
|
title="">name</var> for a script with <span>URL</span> <var
|
| 263 |
|
|
title="">url</var>, a browsing context <var title="">owner browsing
|
| 264 |
|
|
context</var> and a <code>Document</code> <var title="">owner
|
| 265 |
|
|
document</var>, it must run the following steps in a completely separate
|
| 266 |
|
|
and parallel execution environment:
|
| 267 |
|
|
#ja
|
| 268 |
|
|
利用者エージェントが、<span>URL</span> <var
|
| 269 |
|
|
title="">url</var>、閲覧文脈 <var title="">owner browsing
|
| 270 |
|
|
context</var>、<code>Document</code> <var title="">owner
|
| 271 |
|
|
document</var> のスクリプトに対する、 <var
|
| 272 |
apache |
1.14 |
title="">name</var> と名付けられた<dfn id=run-a>労働者を走らせる</dfn>、
|
| 273 |
apache |
1.11 |
という時には、利用者エージェントは、次の段階を、完全に分離された並列実行環境で実行しなければ[[MUST:なりません]]。
|
| 274 |
|
|
|
| 275 |
|
|
#en
|
| 276 |
|
|
Attempt to <span>fetch</span><!-- XXX --> the resource identified by
|
| 277 |
|
|
<var title="">url</var>.
|
| 278 |
|
|
#ja
|
| 279 |
|
|
<var title="">url</var> で識別される資源を取って来ようと試みます。
|
| 280 |
|
|
|
| 281 |
|
|
#en
|
| 282 |
|
|
If the attempt fails, then abort these steps and invoke the <a
|
| 283 |
apache |
1.13 |
href="#worker" title="worker creation failed">error handling steps</a>
|
| 284 |
apache |
1.11 |
defined by the algorithm that called this one.
|
| 285 |
|
|
#ja
|
| 286 |
|
|
この試みが失敗した場合、これらの段階を停止し、この段階を呼び出した算法が定義する<a
|
| 287 |
apache |
1.13 |
href="#worker" title="worker creation failed">誤り取扱段階</a>を呼び出します。
|
| 288 |
apache |
1.11 |
|
| 289 |
|
|
#en
|
| 290 |
|
|
If the attempt succeeds, then let <var title="">script</var> be the
|
| 291 |
|
|
resource that was obtained.
|
| 292 |
|
|
#ja
|
| 293 |
|
|
この試みが成功した場合、 <var title="">script</var>
|
| 294 |
|
|
を得られた資源とします。
|
| 295 |
|
|
|
| 296 |
|
|
#en
|
| 297 |
|
|
As with <code>script</code> elements, the MIME type of the
|
| 298 |
|
|
script is ignored. Unlike with <code>script</code> elements, there is no
|
| 299 |
|
|
way to override the type. It's always assumed to be JavaScript.
|
| 300 |
|
|
#ja
|
| 301 |
|
|
<code>script</code> 要素と同様に、スクリプトの MIME 型は無視します。
|
| 302 |
apache |
1.12 |
<code>script</code> 要素とは異なり、
|
| 303 |
apache |
1.11 |
型を上書きする方法はありません。スクリプトは常に JavaScript
|
| 304 |
|
|
と仮定します。
|
| 305 |
|
|
|
| 306 |
|
|
#en
|
| 307 |
|
|
Create a new <code><a href="#windowworker">WindowWorker</a></code>
|
| 308 |
|
|
object, <var title="">window</var>.
|
| 309 |
|
|
#ja
|
| 310 |
|
|
新しい <code><a href="#windowworker">WindowWorker</a></code>
|
| 311 |
|
|
オブジェクト <var title="">window</var> を作成します。
|
| 312 |
|
|
|
| 313 |
|
|
#en
|
| 314 |
apache |
1.13 |
Set the <code title=dom-WindowWorker-URL><a href="#url">URL</a></code>
|
| 315 |
|
|
attribute of <var title="">window</var> to the value of <var
|
| 316 |
|
|
title="">url</var>.
|
| 317 |
|
|
#ja
|
| 318 |
|
|
<var title="">window</var> の
|
| 319 |
|
|
<code title=dom-WindowWorker-URL><a href="#url">URL</a></code>
|
| 320 |
|
|
属性を <var
|
| 321 |
|
|
title="">url</var> の値に設定します。
|
| 322 |
|
|
|
| 323 |
|
|
#en
|
| 324 |
|
|
Set the <code title=dom-WindowWorker-name><a
|
| 325 |
apache |
1.11 |
href="#name">name</a></code> attribute of <var title="">window</var> to
|
| 326 |
|
|
the value of <var title="">name</var>.
|
| 327 |
|
|
#ja
|
| 328 |
apache |
1.13 |
<var title="">window</var> の <code title=dom-WindowWorker-name><a
|
| 329 |
apache |
1.11 |
href="#name">name</a></code>
|
| 330 |
|
|
属性を <var title="">name</var> の値に設定します。
|
| 331 |
|
|
|
| 332 |
|
|
#en
|
| 333 |
|
|
Let <var title="">script</var>'s <span>script execution context</span>
|
| 334 |
|
|
(and thus also <span>global object</span>) be <var
|
| 335 |
|
|
title="">window</var>.
|
| 336 |
|
|
#ja
|
| 337 |
|
|
<var title="">script</var> のスクリプト実行文脈 (と大域オブジェクトも)
|
| 338 |
|
|
を <var
|
| 339 |
|
|
title="">window</var> とします。
|
| 340 |
|
|
|
| 341 |
|
|
#en
|
| 342 |
|
|
Let <var title="">script</var>'s <span>script browsing context</span>
|
| 343 |
|
|
be <var title="">owner browsing context</var>.
|
| 344 |
|
|
#ja
|
| 345 |
|
|
<var title="">script</var> のスクリプト閲覧文脈を <var title="">owner browsing context</var>
|
| 346 |
|
|
とします。
|
| 347 |
|
|
|
| 348 |
|
|
#en
|
| 349 |
|
|
Let <var title="">script</var>'s <span>script document context</span>
|
| 350 |
|
|
|
| 351 |
|
|
be <var title="">owner document</var>.
|
| 352 |
|
|
#ja
|
| 353 |
|
|
<var title="">script</var> のスクリプト文書文脈を <var title="">owner document</var>
|
| 354 |
|
|
とします。
|
| 355 |
|
|
|
| 356 |
|
|
#en
|
| 357 |
apache |
1.13 |
Invoke the <a href="#success" title="worker creation
|
| 358 |
|
|
succeeded">success steps</a> defined by the algorithm that called this
|
| 359 |
|
|
one. (This will add an event to the <a href="#queue">queue of
|
| 360 |
|
|
events</a>.)
|
| 361 |
apache |
1.11 |
#ja
|
| 362 |
apache |
1.13 |
この段階を呼び出す算法が定義する<a href="#success" title="worker creation
|
| 363 |
|
|
succeeded">成功段階</a>を呼び出します。
|
| 364 |
apache |
1.11 |
(これは、<a href="#queue">事象の待ち行列</a>)
|
| 365 |
|
|
に事象を追加します。)
|
| 366 |
|
|
|
| 367 |
|
|
#en
|
| 368 |
|
|
Start monitoring <var title="">worker</var>, such that whenever the
|
| 369 |
|
|
<var title="">window</var> object's <code
|
| 370 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 371 |
apache |
1.11 |
attribute is false and all <a href="#the-workers0">the worker's
|
| 372 |
|
|
ports</a> have their <code title=dom-MessagePort-active>active</code>
|
| 373 |
|
|
attributes set to false, the user agent suspends execution of script in
|
| 374 |
|
|
that worker until such time as either the <code
|
| 375 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 376 |
apache |
1.11 |
attribute switches to true or one of the <code>MessagePort</code>
|
| 377 |
|
|
objects in the list of <a href="#the-workers0">the worker's ports</a>
|
| 378 |
|
|
has an <code title=dom-MessagePort-active>active</code> attribute with
|
| 379 |
|
|
the value true.
|
| 380 |
|
|
#ja
|
| 381 |
|
|
<var title="">worker</var> の監視を開始し、
|
| 382 |
|
|
<var title="">window</var> オブジェクトの <code
|
| 383 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 384 |
apache |
1.11 |
属性が偽で<a href="#the-workers0">労働者のポート</a>のすべてが
|
| 385 |
|
|
<code title=dom-MessagePort-active>active</code>
|
| 386 |
|
|
属性が偽に設定されているという時には常に、利用者エージェントがスクリプトの実行を、 <code
|
| 387 |
apache |
1.13 |
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 388 |
apache |
1.11 |
属性が真に切り替わるまでか または<a href="#the-workers0">労働者のポート</a>の並びのいずれか1つの
|
| 389 |
|
|
<code>MessagePort</code> オブジェクトの <code title=dom-MessagePort-active>active</code>
|
| 390 |
|
|
属性が値として真を持つようになるまでのいずれかの間、
|
| 391 |
|
|
一時停止するようにします。
|
| 392 |
apache |
1.13 |
|
| 393 |
|
|
#en
|
| 394 |
|
|
Start monitoring <var title="">worker</var>, such that as soon as the
|
| 395 |
|
|
list of <a href="#the-workers0">the worker's ports</a> becomes empty,
|
| 396 |
|
|
the <var title="">window</var> object's <code
|
| 397 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 398 |
|
|
attribute is set to true.
|
| 399 |
|
|
#ja
|
| 400 |
|
|
<var title="">worker</var> の監視を開始し、<a href="#the-workers0">労働者のポート</a>の並びが空になると即座に
|
| 401 |
|
|
<var title="">window</var> オブジェクトの <code
|
| 402 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 403 |
|
|
属性が真に設定されるようにします。
|
| 404 |
|
|
|
| 405 |
|
|
#en
|
| 406 |
|
|
Run <var title="">script</var> until it either returns, fails to catch
|
| 407 |
|
|
an exception, or gets prematurely aborted by the "<a href="#kill-a">kill
|
| 408 |
|
|
a worker</a>" algorithm below.
|
| 409 |
|
|
#ja
|
| 410 |
apache |
1.14 |
<var title="">script</var> を、返るか、例外の捕獲に失敗するか、後述の「<a href="#kill-a">労働者を殺す</a>」算法により早々に停止させられるかのいずれかまで走らせます。
|
| 411 |
apache |
1.11 |
|
| 412 |
apache |
1.15 |
#en
|
| 413 |
|
|
If the script gets aborted by the "<a href="#kill-a">kill a
|
| 414 |
|
|
worker</a>" algorithm, then that same algorithm will cause there to only
|
| 415 |
|
|
be a single event in the <a href="#queue">queue of events</a> at the
|
| 416 |
|
|
next step, namely the <code title=message-unload>unload</code> event.
|
| 417 |
|
|
However, if the event is ignored then it will become true as soon as
|
| 418 |
|
|
that port is garbage collected.
|
| 419 |
|
|
#ja
|
| 420 |
|
|
スクリプトが「<a href="#kill-a">労働者を殺す</a>」算法で停止させられる場合には、
|
| 421 |
|
|
その同じ算法が、次の段階で、<a href="#queue">事象の待ち行列</a>には唯一
|
| 422 |
|
|
<code title=message-unload>unload</code> 事象だけが含まれるようにします。
|
| 423 |
|
|
しかし、この事象が無視された場合には、これは、ポートがごみ収集される際に真となります。
|
| 424 |
|
|
|
| 425 |
|
|
#en
|
| 426 |
|
|
<i>Event loop</i>: Wait until either there is an event in the <a
|
| 427 |
|
|
href="#queue">queue of events</a> associated with <var
|
| 428 |
|
|
title="">window</var> or the <var title="">window</var> object's <code
|
| 429 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 430 |
|
|
attribute is set to true.
|
| 431 |
|
|
#ja
|
| 432 |
|
|
<i>事象ループ</i>: <var
|
| 433 |
|
|
title="">window</var> に関連付けられた<a
|
| 434 |
|
|
href="#queue">事象の待ち行列</a>に事象が存在するようになるか、または
|
| 435 |
|
|
<var title="">window</var> オブジェクトの <code
|
| 436 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 437 |
|
|
属性が真に設定されるまで待ちます。
|
| 438 |
|
|
|
| 439 |
|
|
#en
|
| 440 |
|
|
Dispatch the oldest event or callback in the <a href="#queue">queue of
|
| 441 |
|
|
events</a>, if any. The handling of this event or the execution of this
|
| 442 |
|
|
callback might get prematurely aborted by the "<a href="#kill-a">kill a
|
| 443 |
|
|
worker</a>" algorithm below.
|
| 444 |
|
|
#ja
|
| 445 |
|
|
<a href="#queue">事象の待ち行列</a>中で最古の事象か呼び戻しがあれば、
|
| 446 |
|
|
これを発送します。この事象の取扱いや呼び戻しの実行は、後述の「<a href="#kill-a">労働者を殺す</a>」
|
| 447 |
|
|
算法により、早々に停止させられるかもしれません。
|
| 448 |
|
|
|
| 449 |
|
|
#en
|
| 450 |
|
|
If there are any more events in the <a href="#queue">queue of
|
| 451 |
|
|
events</a> or if the <var title="">window</var> object's <code
|
| 452 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 453 |
|
|
attribute is set to false, then jump back to the step above labeled
|
| 454 |
|
|
<i>event loop</i>.
|
| 455 |
|
|
#ja
|
| 456 |
|
|
<a href="#queue">事象の待ち行列</a>中に更に事象が存在する場合、
|
| 457 |
|
|
または <var title="">window</var> オブジェクトの <code
|
| 458 |
|
|
title=dom-WindowWorker-closing><a href="#closing">closing</a></code>
|
| 459 |
|
|
属性が偽に設定されている場合、前述の<i>事象ループ</i>との名札のある段階に飛んで戻ります。
|
| 460 |
|
|
|
| 461 |
|
|
#en
|
| 462 |
|
|
timers, intervals, XMLHttpRequests, database
|
| 463 |
|
|
transactions, etc, must be killed; ports must be deactivated and
|
| 464 |
|
|
unentangled (do not send unload)
|
| 465 |
|
|
#ja
|
| 466 |
|
|
タイマー、休憩、 XMLHttpRequest、データベース取引、その他を殺さなければ[[MUST:なりません]]。
|
| 467 |
|
|
ポートを非活性化し、ほどかなければ[[MUST:なりません]] (unload を送りません)。
|
| 468 |
|
|
|
| 469 |
|
|
#en
|
| 470 |
|
|
When a user agent is to <dfn id=kill-a>kill a worker</dfn>, it must run
|
| 471 |
|
|
the following steps in parallel with the worker's main loop (the "<a
|
| 472 |
|
|
href="#run-a">run a worker</a>" processing model defined above):
|
| 473 |
|
|
#ja
|
| 474 |
|
|
利用者エージェントが<dfn id=kill-a>労働者を殺す</dfn>という時には、
|
| 475 |
|
|
利用者エージェントは、次の段階を労働者の主たるループ (先に定義した「<a
|
| 476 |
|
|
href="#run-a">労働者を走らせる</a>」処理モデル) と並列に走らせなければ[[MUST:なりません]]。
|
| 477 |
|
|
|
| 478 |
|
|
#en
|
| 479 |
|
|
Create an <code>Event</code> object with the event name <code
|
| 480 |
|
|
title=event-unload>unload</code>, which does not bubble and is not
|
| 481 |
|
|
cancelable, and add it to the worker's <code><a
|
| 482 |
|
|
href="#windowworker">WindowWorker</a></code> object's <a
|
| 483 |
|
|
href="#queue">queue of events</a>, targetted at the <code><a
|
| 484 |
|
|
href="#windowworker">WindowWorker</a></code> object itself.
|
| 485 |
|
|
#ja
|
| 486 |
|
|
事象名が <code
|
| 487 |
|
|
title=event-unload>unload</code> であり、
|
| 488 |
|
|
泡立たず、取消可能ではない
|
| 489 |
|
|
<code>Event</code> オブジェクトを作成し、労働者の <code><a
|
| 490 |
|
|
href="#windowworker">WindowWorker</a></code>
|
| 491 |
|
|
オブジェクトの<a
|
| 492 |
|
|
href="#queue">事象の待ち行列</a>に追加し、 <code><a
|
| 493 |
|
|
href="#windowworker">WindowWorker</a></code>
|
| 494 |
|
|
オブジェクト自体を対象とします。
|
| 495 |
|
|
|
| 496 |
|
|
#en
|
| 497 |
|
|
Set the worker's <code><a href="#windowworker">WindowWorker</a></code>
|
| 498 |
|
|
object's <code title=dom-WindowWorker-closing><a
|
| 499 |
|
|
href="#closing">closing</a></code> attribute to true.
|
| 500 |
|
|
#ja
|
| 501 |
|
|
労働者の <code><a href="#windowworker">WindowWorker</a></code>
|
| 502 |
|
|
オブジェクトの
|
| 503 |
|
|
<code title=dom-WindowWorker-closing><a
|
| 504 |
|
|
href="#closing">closing</a></code>
|
| 505 |
|
|
属性を真に設定します。
|
| 506 |
|
|
|
| 507 |
|
|
#en
|
| 508 |
|
|
Wait a user-agent-defined amount of time. If the "<a href="#run-a">run
|
| 509 |
|
|
a worker</a>" processing model defined above immediately starts running
|
| 510 |
|
|
event listeners registered for <code title=event-unload>unload</code>
|
| 511 |
|
|
event, this time should not be zero — the idea is that the <code
|
| 512 |
|
|
title=event-unload>unload</code> event can be used to clean up when
|
| 513 |
|
|
shutting down unexpectedly.
|
| 514 |
|
|
#ja
|
| 515 |
|
|
利用者エージェント定義の時間、待ちます。先に定義した「<a href="#run-a">労働者を走らせる</a>」
|
| 516 |
|
|
処理モデルが <code title=event-unload>unload</code>
|
| 517 |
|
|
事象に登録された事象聴取器を即座に走らせ始める場合には、この時間は零である[[SHOULD NOT:べきではありません]]。
|
| 518 |
|
|
というのは、予期せず停止させる時に浄化するために <code
|
| 519 |
|
|
title=event-unload>unload</code> 事象を使えるようにするのが目的だからです。
|
| 520 |
|
|
|
| 521 |
|
|
#en
|
| 522 |
|
|
If there are any events in the <a href="#queue">queue of events</a>
|
| 523 |
|
|
other than the <code title=event-unload>unload</code> event that this
|
| 524 |
|
|
algorithm just added, discard them without dispatching them.
|
| 525 |
|
|
#ja
|
| 526 |
|
|
<a href="#queue">事象の待ち行列</a>中にこの算法が追加した
|
| 527 |
|
|
<code title=event-unload>unload</code>
|
| 528 |
|
|
事象以外の事象が存在する場合には、それらを発送せずに捨てます。
|
| 529 |
|
|
|
| 530 |
|
|
#en
|
| 531 |
|
|
If the <code title=event-unload>unload</code> event that this
|
| 532 |
|
|
algorithm just added hasn't yet been dispatched, then abort the script
|
| 533 |
|
|
currently running in the worker.
|
| 534 |
|
|
#ja
|
| 535 |
|
|
この算法が追加した <code title=event-unload>unload</code>
|
| 536 |
|
|
事象がまだ発送されていなければ、現在労働者中で走っているスクリプトを停止します。
|
| 537 |
|
|
|
| 538 |
|
|
#en
|
| 539 |
|
|
Wait a user-agent-defined amount of time.
|
| 540 |
|
|
#ja
|
| 541 |
|
|
利用者エージェント定義の時間、待ちます。
|
| 542 |
|
|
|
| 543 |
|
|
#en
|
| 544 |
|
|
Abort the script currently running in the worker (if any script is
|
| 545 |
|
|
running, then it will be a handler for the <code
|
| 546 |
|
|
title=event-unload>unload</code> event).
|
| 547 |
|
|
#ja
|
| 548 |
|
|
現在労働者中で走っているスクリプト (スクリプトが走っているとすると、
|
| 549 |
|
|
これは <code
|
| 550 |
|
|
title=event-unload>unload</code>
|
| 551 |
|
|
事象の取扱器です。) を停止します。
|
| 552 |
|
|
|
| 553 |
|
|
#en
|
| 554 |
|
|
When a script invokes the <dfn id=close
|
| 555 |
|
|
title=dom-WindowWorker-close><code>close()</code></dfn> method on a
|
| 556 |
|
|
<code><a href="#windowworker">WindowWorker</a></code> object, the user
|
| 557 |
|
|
agent must run the following steps:
|
| 558 |
|
|
#ja
|
| 559 |
|
|
スクリプトが <code><a href="#windowworker">WindowWorker</a></code>
|
| 560 |
|
|
オブジェクトで <dfn id=close
|
| 561 |
|
|
title=dom-WindowWorker-close><code>close()</code></dfn>
|
| 562 |
|
|
メソッドを呼び出した場合、利用者エージェントは、次の段階を走らせなければ[[MUST:なりません]]。
|
| 563 |
|
|
|