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_BeforeUnloadEvent_h_
8 #define mozilla_dom_BeforeUnloadEvent_h_
10 #include "mozilla/dom/BeforeUnloadEventBinding.h"
11 #include "mozilla/dom/Event.h"
13 namespace mozilla::dom
{
15 class BeforeUnloadEvent
: public Event
{
17 BeforeUnloadEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
19 : Event(aOwner
, aPresContext
, aEvent
) {}
21 virtual BeforeUnloadEvent
* AsBeforeUnloadEvent() override
{ return this; }
23 virtual JSObject
* WrapObjectInternal(
24 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
25 return BeforeUnloadEvent_Binding::Wrap(aCx
, this, aGivenProto
);
28 NS_INLINE_DECL_REFCOUNTING_INHERITED(BeforeUnloadEvent
, Event
)
30 void GetReturnValue(nsAString
& aReturnValue
);
31 void SetReturnValue(const nsAString
& aReturnValue
);
34 ~BeforeUnloadEvent() = default;
39 } // namespace mozilla::dom
41 already_AddRefed
<mozilla::dom::BeforeUnloadEvent
> NS_NewDOMBeforeUnloadEvent(
42 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
43 mozilla::WidgetEvent
* aEvent
);
45 #endif // mozilla_dom_BeforeUnloadEvent_h_