/[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.57 - (hide annotations) (download)
Thu Mar 26 06:19:09 2009 UTC (17 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.56: +24 -21 lines
make

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24