Bug 1826136 [wpt PR 39338] - Update wpt metadata, a=testonly
[gecko.git] / dom / events / BeforeUnloadEvent.h
blob2ffc34cfeadfa77cda1536f0e692f54507514dd0
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 {
16 public:
17 BeforeUnloadEvent(EventTarget* aOwner, nsPresContext* aPresContext,
18 WidgetEvent* aEvent)
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);
33 protected:
34 ~BeforeUnloadEvent() = default;
36 nsString mText;
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_