Line data Source code
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 : #include "mozilla/dom/BeforeUnloadEvent.h"
8 :
9 : namespace mozilla {
10 : namespace dom {
11 :
12 5 : NS_IMPL_ADDREF_INHERITED(BeforeUnloadEvent, Event)
13 5 : NS_IMPL_RELEASE_INHERITED(BeforeUnloadEvent, Event)
14 :
15 23 : NS_INTERFACE_MAP_BEGIN(BeforeUnloadEvent)
16 23 : NS_INTERFACE_MAP_ENTRY(nsIDOMBeforeUnloadEvent)
17 23 : NS_INTERFACE_MAP_END_INHERITING(Event)
18 :
19 : NS_IMETHODIMP
20 0 : BeforeUnloadEvent::SetReturnValue(const nsAString& aReturnValue)
21 : {
22 0 : mText = aReturnValue;
23 0 : return NS_OK; // Don't throw an exception
24 : }
25 :
26 : NS_IMETHODIMP
27 5 : BeforeUnloadEvent::GetReturnValue(nsAString& aReturnValue)
28 : {
29 5 : aReturnValue = mText;
30 5 : return NS_OK; // Don't throw an exception
31 : }
32 :
33 : } // namespace dom
34 : } // namespace mozilla
35 :
36 : using namespace mozilla;
37 : using namespace mozilla::dom;
38 :
39 : already_AddRefed<BeforeUnloadEvent>
40 0 : NS_NewDOMBeforeUnloadEvent(EventTarget* aOwner,
41 : nsPresContext* aPresContext,
42 : WidgetEvent* aEvent)
43 : {
44 : RefPtr<BeforeUnloadEvent> it =
45 0 : new BeforeUnloadEvent(aOwner, aPresContext, aEvent);
46 0 : return it.forget();
47 : }
|