aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/abstractworker/onerror/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/abstractworker/onerror/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/abstractworker/onerror/index.html')
-rw-r--r--files/ja/web/api/abstractworker/onerror/index.html59
1 files changed, 59 insertions, 0 deletions
diff --git a/files/ja/web/api/abstractworker/onerror/index.html b/files/ja/web/api/abstractworker/onerror/index.html
new file mode 100644
index 0000000000..0f164b482e
--- /dev/null
+++ b/files/ja/web/api/abstractworker/onerror/index.html
@@ -0,0 +1,59 @@
+---
+title: AbstractWorker.onerror
+slug: Web/API/AbstractWorker/onerror
+translation_of: Web/API/AbstractWorker/onerror
+---
+<p>{{ APIRef("Web Workers API") }}</p>
+
+<h2 id="概要">概要</h2>
+
+<p>{{domxref("AbstractWorker")}} の <code><strong>AbstractWorker</strong></code><strong><code>.onerror</code></strong> 属性は {{domxref("EventHandler")}} の一種で、 {{domxref("Worker")}}  から {{event("error")}} イベントが送出された時に呼ばれます。</p>
+
+<h2 id="記法">記法</h2>
+
+<pre class="syntaxbox">myWorker.onerror = function() { ... };</pre>
+
+<h2 id="利用例">利用例</h2>
+
+<p>以下の例では <a href="https://developer.mozilla.org/en-US/docs/Web/API/Worker.Worker" title="The Worker() constructor creates a Worker that executes the script at the specified URL. This script must obey the same-origin policy."><code>Worker()</code></a> コンストラクタを利用して作成した <a href="https://developer.mozilla.org/en-US/docs/Web/API/Worker" title="The Worker interface represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread."><code>Worker</code></a> オブジェクトに、<code>onerror</code> ハンドラを設定しています。</p>
+
+<pre class="brush: js">var myWorker = new Worker('worker.js');
+
+myWorker.onerror = function() {
+ console.log('There is an error with your worker!');
+}</pre>
+
+<h2 id="仕様">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "#handler-abstractworker-onerror", "AbstractWorker.onerror")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="ブラウザ互換性">ブラウザ互換性</h2>
+
+<div>
+
+
+<p>{{Compat("api.AbstractWorker.onerror")}}</p>
+</div>
+
+<h3 id="クロスオリジンに関するエラー">クロスオリジンに関するエラー</h3>
+
+<p>過去のブラウザには、ワーカ用のスクリプトを異なるオリジンから読み込もうとすると、<code>SecurityError</code> を送出するものがあります。最近のブラウザは{{event("error")}} イベントを送出します。これは仕様の変更によるものです。この件の詳細と対処方法については、こちらの文書を参照してください: <a href="https://www.fxsitecompat.com/en-CA/docs/2016/loading-cross-origin-worker-now-fires-error-event-instead-of-throwing-worker-in-sandboxed-iframe-no-longer-allowed/">Loading cross-origin worker now fires error event instead of throwing; worker in sandboxed iframe no longer allowed</a>.</p>
+
+<h2 id="関連情報">関連情報</h2>
+
+<ul>
+ <li>{{domxref("AbstractWorker")}} このハンドラを持つインタフェース</li>
+</ul>