From 97a1e587bb4f0421a90bbb9d016cef3bb6479d16 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 27 Jul 2021 08:15:02 +0200 Subject: [PATCH] Add self.reportError() This allows libraries to emulate the behavior of an exception thrown in an event listener callback. Additional context: https://github.com/whatwg/console/issues/50. Tests: https://github.com/web-platform-tests/wpt/pull/29738. Co-authored-by: Domenic Denicola --- source | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source b/source index 493a6e8efc0..3cc7013f662 100644 --- a/source +++ b/source @@ -91936,6 +91936,12 @@ document.querySelector("button").addEventListener("click", bound);
Runtime script errors
+
+
self . reportError( e )
+

Dispatches an error event at the global object for the + given value e, in the same fashion as an unhandled exception.

+
+

In various scenarios, the user agent can report an exception by firing an error event at the Window. If this event is not canceled, then the error is considered not handled, and can be reported to the developer console.

@@ -92031,6 +92037,10 @@ document.querySelector("button").addEventListener("click", bound); have known problems. You can track future cleanup in this area in issue #958.

+

The reportError(e) method steps are to + report the exception e.

+

The ErrorEvent interface is defined as follows:

[Exposed=(Window,Worker)]
@@ -95034,6 +95044,8 @@ interface mixin WindowOrWorkerGlobalScope {
   readonly attribute boolean isSecureContext;
   readonly attribute boolean crossOriginIsolated;
 
+  undefined reportError(any e);
+
   // base64 utility methods
   DOMString btoa(DOMString data);
   ByteString atob(DOMString data);