Bug 1686668 [wpt PR 27185] - Update wpt metadata, a=testonly
[gecko.git] / dom / events / BeforeUnloadEvent.h
blob907e3f954afb733dd28a5dc7d3eea6e66908cbcc
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 {
14 namespace dom {
16 class BeforeUnloadEvent : public Event {
17 public:
18 BeforeUnloadEvent(EventTarget* aOwner, nsPresContext* aPresContext,
19 WidgetEvent* aEvent)
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);
34 protected:
35 ~BeforeUnloadEvent() = default;
37 nsString mText;
40 } // namespace dom
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_