1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is the Mozilla Foundation.
18 : * Portions created by the Initial Developer are Copyright (C) 2011
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Alternatively, the contents of this file may be used under the terms of
22 : * either of the GNU General Public License Version 2 or later (the "GPL"),
23 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
24 : * in which case the provisions of the GPL or the LGPL are applicable instead
25 : * of those above. If you wish to allow use of your version of this file only
26 : * under the terms of either the GPL or the LGPL, and not to allow others to
27 : * use your version of this file under the terms of the MPL, indicate your
28 : * decision by deleting the provisions above and replace them with the notice
29 : * and other provisions required by the GPL or the LGPL. If you do not delete
30 : * the provisions above, a recipient may use your version of this file under
31 : * the terms of any one of the MPL, the GPL or the LGPL.
32 : *
33 : * ***** END LICENSE BLOCK ***** */
34 :
35 : #include "nsDOMHashChangeEvent.h"
36 : #include "nsContentUtils.h"
37 : #include "DictionaryHelpers.h"
38 :
39 0 : NS_IMPL_ADDREF_INHERITED(nsDOMHashChangeEvent, nsDOMEvent)
40 0 : NS_IMPL_RELEASE_INHERITED(nsDOMHashChangeEvent, nsDOMEvent)
41 :
42 : DOMCI_DATA(HashChangeEvent, nsDOMHashChangeEvent)
43 :
44 0 : NS_INTERFACE_MAP_BEGIN(nsDOMHashChangeEvent)
45 0 : NS_INTERFACE_MAP_ENTRY(nsIDOMHashChangeEvent)
46 0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HashChangeEvent)
47 0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
48 :
49 0 : nsDOMHashChangeEvent::~nsDOMHashChangeEvent()
50 : {
51 0 : }
52 :
53 : NS_IMETHODIMP
54 0 : nsDOMHashChangeEvent::GetOldURL(nsAString &aURL)
55 : {
56 0 : aURL.Assign(mOldURL);
57 0 : return NS_OK;
58 : }
59 :
60 : NS_IMETHODIMP
61 0 : nsDOMHashChangeEvent::GetNewURL(nsAString &aURL)
62 : {
63 0 : aURL.Assign(mNewURL);
64 0 : return NS_OK;
65 : }
66 :
67 : NS_IMETHODIMP
68 0 : nsDOMHashChangeEvent::InitHashChangeEvent(const nsAString &aTypeArg,
69 : bool aCanBubbleArg,
70 : bool aCancelableArg,
71 : const nsAString &aOldURL,
72 : const nsAString &aNewURL)
73 : {
74 0 : nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
75 0 : NS_ENSURE_SUCCESS(rv, rv);
76 :
77 0 : mOldURL.Assign(aOldURL);
78 0 : mNewURL.Assign(aNewURL);
79 0 : return NS_OK;
80 : }
81 :
82 : nsresult
83 0 : nsDOMHashChangeEvent::InitFromCtor(const nsAString& aType,
84 : JSContext* aCx, jsval* aVal)
85 : {
86 0 : mozilla::dom::HashChangeEventInit d;
87 0 : nsresult rv = d.Init(aCx, aVal);
88 0 : NS_ENSURE_SUCCESS(rv, rv);
89 0 : return InitHashChangeEvent(aType, d.bubbles, d.cancelable, d.oldURL, d.newURL);
90 : }
91 :
92 0 : nsresult NS_NewDOMHashChangeEvent(nsIDOMEvent** aInstancePtrResult,
93 : nsPresContext* aPresContext,
94 : nsEvent* aEvent)
95 : {
96 : nsDOMHashChangeEvent* event =
97 0 : new nsDOMHashChangeEvent(aPresContext, aEvent);
98 :
99 0 : return CallQueryInterface(event, aInstancePtrResult);
100 : }
|