Skip to content

Commit 97a1e58

Browse files
annevkdomenic
andauthored
Add self.reportError()
This allows libraries to emulate the behavior of an exception thrown in an event listener callback. Additional context: whatwg/console#50. Tests: web-platform-tests/wpt#29738. Co-authored-by: Domenic Denicola <[email protected]>
1 parent 3650a12 commit 97a1e58

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91936,6 +91936,12 @@ document.querySelector("button").addEventListener("click", bound);
9193691936

9193791937
<h5 id="runtime-script-errors">Runtime script errors</h5>
9193891938

91939+
<dl class="domintro">
91940+
<dt>self . <code subdfn data-x="dom-reportError">reportError</code>( <var>e</var> )</dt>
91941+
<dd><p>Dispatches an <code data-x="event-error">error</code> event at the global object for the
91942+
given value <var>e</var>, in the same fashion as an unhandled exception.</p></dd>
91943+
</dl>
91944+
9193991945
<p w-dev>In various scenarios, the user agent can report an exception by firing an <code
9194091946
data-x="event-error">error</code> event at the <code>Window</code>. If this event is not canceled,
9194191947
then the error is considered not handled, and can be reported to the developer console.</p>
@@ -92031,6 +92037,10 @@ document.querySelector("button").addEventListener("click", bound);
9203192037
have known problems. You can track future cleanup in this area in <a
9203292038
href="https://github.com/whatwg/html/issues/958">issue #958</a>.</p>
9203392039

92040+
<p>The <dfn method for="WindowOrWorkerGlobalScope"
92041+
data-x="dom-reportError"><code>reportError(<var>e</var>)</code></dfn> method steps are to
92042+
<span>report the exception</span> <var>e</var>.</p>
92043+
9203492044
<p id="the-errorevent-interface">The <code>ErrorEvent</code> interface is defined as follows:</p>
9203592045

9203692046
<pre><code class="idl">[Exposed=(Window,Worker)]
@@ -95034,6 +95044,8 @@ interface mixin <dfn interface>WindowOrWorkerGlobalScope</dfn> {
9503495044
readonly attribute boolean <span data-x="dom-isSecureContext">isSecureContext</span>;
9503595045
readonly attribute boolean <span data-x="dom-crossOriginIsolated">crossOriginIsolated</span>;
9503695046

95047+
undefined <span data-x="dom-reportError">reportError</span>(any e);
95048+
9503795049
// base64 utility methods
9503895050
DOMString <span data-x="dom-btoa">btoa</span>(DOMString data);
9503995051
ByteString <span data-x="dom-atob">atob</span>(DOMString data);

0 commit comments

Comments
 (0)