1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et tw=79: */
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/. */
9 #include "mozilla/Attributes.h"
10 #include "mozilla/ErrorResult.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsIDOMHistory.h"
14 #include "nsPIDOMWindow.h" // for GetParentObject
15 #include "nsStringFwd.h"
16 #include "nsWrapperCache.h"
20 class nsIWeakReference
;
23 // Script "History" object
24 class nsHistory MOZ_FINAL
: public nsIDOMHistory
, // Empty, needed for extension
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory
)
33 explicit nsHistory(nsPIDOMWindow
* aInnerWindow
);
35 nsPIDOMWindow
* GetParentObject() const;
36 virtual JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
38 uint32_t GetLength(mozilla::ErrorResult
& aRv
) const;
39 void GetState(JSContext
* aCx
, JS::MutableHandle
<JS::Value
> aResult
,
40 mozilla::ErrorResult
& aRv
) const;
41 void Go(int32_t aDelta
, mozilla::ErrorResult
& aRv
);
42 void Back(mozilla::ErrorResult
& aRv
);
43 void Forward(mozilla::ErrorResult
& aRv
);
44 void PushState(JSContext
* aCx
, JS::Handle
<JS::Value
> aData
,
45 const nsAString
& aTitle
, const nsAString
& aUrl
,
46 mozilla::ErrorResult
& aRv
);
47 void ReplaceState(JSContext
* aCx
, JS::Handle
<JS::Value
> aData
,
48 const nsAString
& aTitle
, const nsAString
& aUrl
,
49 mozilla::ErrorResult
& aRv
);
54 nsIDocShell
* GetDocShell() const;
56 void PushOrReplaceState(JSContext
* aCx
, JS::Handle
<JS::Value
> aData
,
57 const nsAString
& aTitle
, const nsAString
& aUrl
,
58 mozilla::ErrorResult
& aRv
, bool aReplace
);
60 already_AddRefed
<nsISHistory
> GetSessionHistory() const;
62 nsCOMPtr
<nsIWeakReference
> mInnerWindow
;
65 #endif /* nsHistory_h___ */