From 511a9376e32fdb992487c9512f52ee8846f39d5a Mon Sep 17 00:00:00 2001 From: Martok Date: Tue, 2 Jan 2024 01:56:12 +0100 Subject: [PATCH] Issue #2435 - Declare PromiseRejectionEvent WebIDL Based-on: m-c 1338059 --- dom/bindings/Codegen.py | 2 +- dom/webidl/PromiseRejectionEvent.webidl | 22 ++++++++++++++++++++++ dom/webidl/moz.build | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 dom/webidl/PromiseRejectionEvent.webidl diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index b7caaad7bb..3094a98c41 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -80,7 +80,7 @@ def idlTypeNeedsCycleCollection(type): type.isObject() or type.isSpiderMonkeyInterface()): return False - elif type.isCallback() or type.isGeckoInterface(): + elif type.isCallback() or type.isPromise() or type.isGeckoInterface(): return True elif type.isUnion(): return any(idlTypeNeedsCycleCollection(t) for t in type.flatMemberTypes) diff --git a/dom/webidl/PromiseRejectionEvent.webidl b/dom/webidl/PromiseRejectionEvent.webidl new file mode 100644 index 0000000000..3c489f3db4 --- /dev/null +++ b/dom/webidl/PromiseRejectionEvent.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/webappapis.html#the-promiserejectionevent-interface + */ + +[Constructor(DOMString type, PromiseRejectionEventInit eventInitDict), + Exposed=(Window,Worker)] +interface PromiseRejectionEvent : Event +{ + [BinaryName="rejectedPromise"] + readonly attribute Promise promise; + readonly attribute any reason; +}; + +dictionary PromiseRejectionEventInit : EventInit { + required Promise promise; + any reason; +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 0f47aabae4..c1f5ad1b76 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -695,6 +695,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [ 'PopStateEvent.webidl', 'PopupBlockedEvent.webidl', 'ProgressEvent.webidl', + 'PromiseRejectionEvent.webidl', 'RecordErrorEvent.webidl', 'ScrollViewChangeEvent.webidl', 'ServiceWorkerMessageEvent.webidl',