Bug 1911817 - PromiseRejectionEvent should store promise as object. r=webidl,smaug

Differential Revision: https://phabricator.services.mozilla.com/D218754
This commit is contained in:
Peter Van der Beken 2024-08-07 16:57:27 +00:00
Родитель 0bda1b9013
Коммит 09adc58eb7
4 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -13,11 +13,11 @@ interface PromiseRejectionEvent : Event
constructor(DOMString type, PromiseRejectionEventInit eventInitDict);
[BinaryName="rejectedPromise"]
readonly attribute Promise<any> promise;
readonly attribute object promise;
readonly attribute any reason;
};
dictionary PromiseRejectionEventInit : EventInit {
required Promise<any> promise;
required object promise;
any reason;
};

Просмотреть файл

@ -739,9 +739,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[PageRevealEvent interface: attribute viewTransition]
expected: FAIL
[PromiseRejectionEvent interface: attribute promise]
expected: FAIL
[SVGSVGElement interface: attribute onpagereveal]
expected: FAIL

Просмотреть файл

@ -5,8 +5,5 @@
[ImageData interface: attribute colorSpace]
expected: FAIL
[PromiseRejectionEvent interface: attribute promise]
expected: FAIL
[MessagePort interface: attribute onclose]
expected: FAIL

Просмотреть файл

@ -387,7 +387,10 @@ void CycleCollectedJSContext::PromiseRejectionTrackerCallback(
nsIGlobalObject* global = xpc::NativeGlobal(aPromise);
if (nsCOMPtr<EventTarget> owner = do_QueryInterface(global)) {
RootedDictionary<PromiseRejectionEventInit> init(aCx);
init.mPromise = Promise::CreateFromExisting(global, aPromise);
if (RefPtr<Promise> newPromise =
Promise::CreateFromExisting(global, aPromise)) {
init.mPromise = newPromise->PromiseObj();
}
init.mReason = JS::GetPromiseResult(aPromise);
RefPtr<PromiseRejectionEvent> event =
@ -779,7 +782,7 @@ NS_IMETHODIMP CycleCollectedJSContext::NotifyUnhandledRejections::Run() {
if (nsCOMPtr<EventTarget> target =
do_QueryInterface(promise->GetParentObject())) {
RootedDictionary<PromiseRejectionEventInit> init(cx);
init.mPromise = promise;
init.mPromise = promiseObj;
init.mReason = JS::GetPromiseResult(promiseObj);
init.mCancelable = true;