Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / dom / payments / PaymentRequestUpdateEvent.h
blob5ed0dd295ab339bbac276ad432b6c9f5447b25ee
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_PaymentRequestUpdateEvent_h
8 #define mozilla_dom_PaymentRequestUpdateEvent_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/Event.h"
12 #include "mozilla/dom/PaymentRequestUpdateEventBinding.h"
13 #include "mozilla/dom/PromiseNativeHandler.h"
15 namespace mozilla {
16 class ErrorResult;
18 namespace dom {
20 class Promise;
21 class PaymentRequest;
22 class PaymentRequestUpdateEvent : public Event, public PromiseNativeHandler {
23 public:
24 NS_DECL_ISUPPORTS_INHERITED
25 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
26 PaymentRequestUpdateEvent, Event)
28 explicit PaymentRequestUpdateEvent(EventTarget* aOwner);
30 virtual JSObject* WrapObjectInternal(
31 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
33 virtual void ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue,
34 ErrorResult& aRv) override;
35 virtual void RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue,
36 ErrorResult& aRv) override;
38 static already_AddRefed<PaymentRequestUpdateEvent> Constructor(
39 EventTarget* aOwner, const nsAString& aType,
40 const PaymentRequestUpdateEventInit& aEventInitDict);
42 // Called by WebIDL constructor
43 static already_AddRefed<PaymentRequestUpdateEvent> Constructor(
44 const GlobalObject& aGlobal, const nsAString& aType,
45 const PaymentRequestUpdateEventInit& aEventInitDict);
47 void UpdateWith(Promise& aPromise, ErrorResult& aRv);
49 void SetRequest(PaymentRequest* aRequest);
51 protected:
52 ~PaymentRequestUpdateEvent();
53 // Indicating whether an updateWith()-initiated update is currently in
54 // progress.
55 bool mWaitForUpdate;
56 RefPtr<PaymentRequest> mRequest;
59 } // namespace dom
60 } // namespace mozilla
62 #endif // mozilla_dom_PaymentRequestUpdateEvent_h