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"
16 class BeforeUnloadEvent
: public Event
{
18 BeforeUnloadEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
20 : Event(aOwner
, aPresContext
, aEvent
) {}
22 virtual BeforeUnloadEvent
* AsBeforeUnloadEvent() override
{ return this; }
24 virtual JSObject
* WrapObjectInternal(
25 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
26 return BeforeUnloadEvent_Binding::Wrap(aCx
, this, aGivenProto
);
29 NS_INLINE_DECL_REFCOUNTING_INHERITED(BeforeUnloadEvent
, Event
)
31 void GetReturnValue(nsAString
& aReturnValue
);
32 void SetReturnValue(const nsAString
& aReturnValue
);
35 ~BeforeUnloadEvent() = default;
41 } // namespace mozilla
43 already_AddRefed
<mozilla::dom::BeforeUnloadEvent
> NS_NewDOMBeforeUnloadEvent(
44 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
45 mozilla::WidgetEvent
* aEvent
);
47 #endif // mozilla_dom_BeforeUnloadEvent_h_