Bug 1903098 - updated libwebrtc patch stack
[gecko.git] / dom / base / nsHistory.h
blob157052fe44cef99b12a8d773435d9a885bc38c1f
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 #ifndef nsHistory_h___
7 #define nsHistory_h___
9 #include "mozilla/Attributes.h"
10 #include "mozilla/dom/HistoryBinding.h"
11 #include "mozilla/dom/ChildSHistory.h"
12 #include "nsCOMPtr.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsIWeakReferenceUtils.h" // for nsWeakPtr
15 #include "nsPIDOMWindow.h" // for GetParentObject
16 #include "nsStringFwd.h"
17 #include "nsWrapperCache.h"
19 class nsIDocShell;
20 class nsISHistory;
21 class nsIWeakReference;
22 class nsPIDOMWindowInner;
24 namespace mozilla {
25 class ErrorResult;
28 // Script "History" object
29 class nsHistory final : public nsISupports, public nsWrapperCache {
30 public:
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
32 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(nsHistory)
34 public:
35 explicit nsHistory(nsPIDOMWindowInner* aInnerWindow);
37 nsPIDOMWindowInner* GetParentObject() const;
38 virtual JSObject* WrapObject(JSContext* aCx,
39 JS::Handle<JSObject*> aGivenProto) override;
41 uint32_t GetLength(mozilla::ErrorResult& aRv) const;
42 mozilla::dom::ScrollRestoration GetScrollRestoration(
43 mozilla::ErrorResult& aRv);
44 void SetScrollRestoration(mozilla::dom::ScrollRestoration aMode,
45 mozilla::ErrorResult& aRv);
46 void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
47 mozilla::ErrorResult& aRv) const;
48 void Go(int32_t aDelta, nsIPrincipal& aSubjectPrincipal,
49 mozilla::ErrorResult& aRv);
50 void Back(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
51 void Forward(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
52 void PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
53 const nsAString& aTitle, const nsAString& aUrl,
54 mozilla::dom::CallerType aCallerType,
55 mozilla::ErrorResult& aRv);
56 void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
57 const nsAString& aTitle, const nsAString& aUrl,
58 mozilla::dom::CallerType aCallerType,
59 mozilla::ErrorResult& aRv);
61 protected:
62 virtual ~nsHistory();
64 void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
65 const nsAString& aTitle, const nsAString& aUrl,
66 mozilla::dom::CallerType aCallerType,
67 mozilla::ErrorResult& aRv, bool aReplace);
69 already_AddRefed<mozilla::dom::ChildSHistory> GetSessionHistory() const;
71 nsWeakPtr mInnerWindow;
74 #endif /* nsHistory_h___ */