Backed out changeset b09d48d2b473 (bug 1655101) for causing mochitest webgl failures...
[gecko.git] / dom / payments / PaymentMethodChangeEvent.h
blob558c19530afa2c0b025906e090b081f459f5a6f7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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/. */
7 #ifndef mozilla_dom_PaymentMethodChangeEvent_h
8 #define mozilla_dom_PaymentMethodChangeEvent_h
10 #include "mozilla/dom/PaymentMethodChangeEventBinding.h"
11 #include "mozilla/dom/PaymentRequestUpdateEvent.h"
12 #include "mozilla/dom/PaymentRequest.h"
14 namespace mozilla::dom {
15 class PaymentRequestUpdateEvent;
16 struct PaymentMethodChangeEventInit;
17 class PaymentMethodChangeEvent final : public PaymentRequestUpdateEvent {
18 public:
19 NS_DECL_ISUPPORTS_INHERITED
20 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
21 PaymentMethodChangeEvent, PaymentRequestUpdateEvent)
23 explicit PaymentMethodChangeEvent(EventTarget* aOwner);
25 virtual JSObject* WrapObjectInternal(
26 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
28 static already_AddRefed<PaymentMethodChangeEvent> Constructor(
29 EventTarget* aOwner, const nsAString& aType,
30 const PaymentRequestUpdateEventInit& aEventInitDict,
31 const nsAString& aMethodName, const ChangeDetails& aMethodDetails);
33 // Called by WebIDL constructor
34 static already_AddRefed<PaymentMethodChangeEvent> Constructor(
35 const GlobalObject& aGlobal, const nsAString& aType,
36 const PaymentMethodChangeEventInit& aEventInitDict);
38 void GetMethodName(nsAString& aMethodName);
39 void SetMethodName(const nsAString& aMethodName);
41 void GetMethodDetails(JSContext* cx, JS::MutableHandle<JSObject*> retval);
42 void SetMethodDetails(const ChangeDetails& aMethodDetails);
44 protected:
45 void init(const PaymentMethodChangeEventInit& aEventInitDict);
46 ~PaymentMethodChangeEvent();
48 private:
49 JS::Heap<JSObject*> mMethodDetails;
50 ChangeDetails mInternalDetails;
51 nsString mMethodName;
54 } // namespace mozilla::dom
56 #endif // mozilla_dom_PaymentMethodChangeEvent_h