tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CustomEvent.h (1666B)


      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/. */
      6 
      7 #ifndef CustomEvent_h__
      8 #define CustomEvent_h__
      9 
     10 #include "js/Value.h"
     11 #include "mozilla/dom/Event.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 struct CustomEventInit;
     16 
     17 class CustomEvent final : public Event {
     18 private:
     19  virtual ~CustomEvent();
     20 
     21  JS::Heap<JS::Value> mDetail;
     22 
     23 public:
     24  explicit CustomEvent(mozilla::dom::EventTarget* aOwner,
     25                       nsPresContext* aPresContext = nullptr,
     26                       mozilla::WidgetEvent* aEvent = nullptr);
     27 
     28  NS_DECL_ISUPPORTS_INHERITED
     29  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent, Event)
     30 
     31  static already_AddRefed<CustomEvent> Constructor(
     32      const GlobalObject& aGlobal, const nsAString& aType,
     33      const CustomEventInit& aParam);
     34 
     35  virtual JSObject* WrapObjectInternal(
     36      JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     37 
     38  CustomEvent* AsCustomEvent() override { return this; }
     39 
     40  void GetDetail(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval);
     41 
     42  void InitCustomEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
     43                       bool aCancelable, JS::Handle<JS::Value> aDetail);
     44 };
     45 
     46 }  // namespace mozilla::dom
     47 
     48 already_AddRefed<mozilla::dom::CustomEvent> NS_NewDOMCustomEvent(
     49    mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
     50    mozilla::WidgetEvent* aEvent);
     51 
     52 #endif  // CustomEvent_h__