Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : /* THIS FILE IS AUTOGENERATED FROM PromiseRejectionEvent.webidl BY Codegen.py - DO NOT EDIT */
8 :
9 : #include "EventBinding.h"
10 : #include "PromiseRejectionEvent.h"
11 : #include "PromiseRejectionEventBinding.h"
12 : #include "js/GCAPI.h"
13 : #include "mozilla/dom/Nullable.h"
14 : #include "mozilla/dom/PrimitiveConversions.h"
15 : #include "mozilla/dom/Promise.h"
16 : #include "mozilla/dom/PromiseRejectionEvent.h"
17 : #include "mozilla/dom/ToJSValue.h"
18 : #include "nsContentUtils.h"
19 :
20 : namespace mozilla {
21 : namespace dom {
22 :
23 :
24 : NS_IMPL_CYCLE_COLLECTION_CLASS(PromiseRejectionEvent)
25 :
26 0 : NS_IMPL_ADDREF_INHERITED(PromiseRejectionEvent, Event)
27 0 : NS_IMPL_RELEASE_INHERITED(PromiseRejectionEvent, Event)
28 :
29 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PromiseRejectionEvent, Event)
30 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPromise)
31 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
32 :
33 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(PromiseRejectionEvent, Event)
34 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mReason)
35 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_END
36 :
37 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PromiseRejectionEvent, Event)
38 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK(mPromise)
39 0 : tmp->mReason.setUndefined();
40 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
41 :
42 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PromiseRejectionEvent)
43 0 : NS_INTERFACE_MAP_END_INHERITING(Event)
44 :
45 0 : PromiseRejectionEvent::PromiseRejectionEvent(mozilla::dom::EventTarget* aOwner)
46 0 : : Event(aOwner, nullptr, nullptr)
47 : {
48 0 : }
49 :
50 0 : PromiseRejectionEvent::~PromiseRejectionEvent()
51 : {
52 0 : mReason = JS::UndefinedValue();
53 0 : mozilla::DropJSObjects(this);
54 0 : }
55 :
56 : void
57 0 : PromiseRejectionEvent::GetReason(JS::MutableHandle<JS::Value> aRetVal) const
58 : {
59 0 : JS::ExposeValueToActiveJS(mReason);
60 0 : aRetVal.set(mReason);
61 0 : }
62 :
63 : PromiseRejectionEvent*
64 0 : PromiseRejectionEvent::AsPromiseRejectionEvent()
65 : {
66 0 : return this;
67 : }
68 :
69 : JSObject*
70 0 : PromiseRejectionEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
71 : {
72 0 : return PromiseRejectionEventBinding::Wrap(aCx, this, aGivenProto);
73 : }
74 :
75 : already_AddRefed<PromiseRejectionEvent>
76 0 : PromiseRejectionEvent::Constructor(mozilla::dom::EventTarget* aOwner, const nsAString& aType, const PromiseRejectionEventInit& aEventInitDict)
77 : {
78 0 : RefPtr<PromiseRejectionEvent> e = new PromiseRejectionEvent(aOwner);
79 0 : bool trusted = e->Init(aOwner);
80 0 : e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
81 0 : e->mPromise = aEventInitDict.mPromise;
82 0 : e->mReason = aEventInitDict.mReason;
83 0 : e->SetTrusted(trusted);
84 0 : e->SetComposed(aEventInitDict.mComposed);
85 0 : mozilla::HoldJSObjects(e.get());
86 0 : return e.forget();
87 : }
88 :
89 : already_AddRefed<PromiseRejectionEvent>
90 0 : PromiseRejectionEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType, const PromiseRejectionEventInit& aEventInitDict, ErrorResult& aRv)
91 : {
92 0 : nsCOMPtr<mozilla::dom::EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
93 0 : return Constructor(owner, aType, aEventInitDict);
94 : }
95 :
96 : Promise*
97 0 : PromiseRejectionEvent::RejectedPromise() const
98 : {
99 0 : return mPromise;
100 : }
101 :
102 : void
103 0 : PromiseRejectionEvent::GetReason(JSContext* cx, JS::MutableHandle<JS::Value> aRetVal) const
104 : {
105 0 : GetReason(aRetVal);
106 0 : }
107 :
108 :
109 : } // namespace dom
110 : } // namespace mozilla
|