2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2011-07-15 10:31:34 +00:00
|
|
|
#include "nsHistory.h"
|
2013-09-06 06:43:16 +00:00
|
|
|
|
|
|
|
#include "jsapi.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2004-10-20 02:19:57 +00:00
|
|
|
#include "nsPIDOMWindow.h"
|
2019-01-02 13:05:23 +00:00
|
|
|
#include "mozilla/dom/Document.h"
|
2019-03-29 15:11:04 +00:00
|
|
|
#include "mozilla/dom/DocumentInlines.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIDocShell.h"
|
2000-03-11 11:58:13 +00:00
|
|
|
#include "nsIWebNavigation.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
#include "nsReadableUtils.h"
|
2004-09-01 16:50:12 +00:00
|
|
|
#include "nsContentUtils.h"
|
2018-10-11 15:43:25 +00:00
|
|
|
#include "mozilla/dom/Location.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2019-08-14 06:38:47 +00:00
|
|
|
#include "mozilla/StaticPrefs_dom.h"
|
2011-05-25 06:31:59 +00:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2013-08-10 06:47:59 +00:00
|
|
|
using namespace mozilla::dom;
|
2009-09-01 16:45:05 +00:00
|
|
|
|
1999-01-28 22:24:29 +00:00
|
|
|
//
|
2013-08-10 06:47:59 +00:00
|
|
|
// History class implementation
|
1999-01-28 22:24:29 +00:00
|
|
|
//
|
2013-08-10 06:47:59 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsHistory)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsHistory)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHistory)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHistory)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
nsHistory::nsHistory(nsPIDOMWindowInner* aInnerWindow)
|
2011-02-01 17:19:35 +00:00
|
|
|
: mInnerWindow(do_GetWeakReference(aInnerWindow)) {}
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2004-12-10 19:48:22 +00:00
|
|
|
nsHistory::~nsHistory() {}
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
nsPIDOMWindowInner* nsHistory::GetParentObject() const {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-08-10 06:47:59 +00:00
|
|
|
return win;
|
1999-01-28 22:24:29 +00:00
|
|
|
}
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
JSObject* nsHistory::WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return History_Binding::Wrap(aCx, this, aGivenProto);
|
1999-01-28 22:24:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
uint32_t nsHistory::GetLength(ErrorResult& aRv) const {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win || !win->HasActiveDocument()) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
2011-02-01 17:19:35 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2000-11-27 23:10:09 +00:00
|
|
|
// Get session History from docshell
|
2018-02-01 22:35:47 +00:00
|
|
|
RefPtr<ChildSHistory> sHistory = GetSessionHistory();
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!sHistory) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2018-02-01 22:35:47 +00:00
|
|
|
int32_t len = sHistory->Count();
|
2018-11-30 10:46:48 +00:00
|
|
|
;
|
2013-08-10 06:47:59 +00:00
|
|
|
return len >= 0 ? len : 0;
|
1999-01-28 22:24:29 +00:00
|
|
|
}
|
|
|
|
|
2015-12-26 10:59:09 +00:00
|
|
|
ScrollRestoration nsHistory::GetScrollRestoration(mozilla::ErrorResult& aRv) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2015-12-26 10:59:09 +00:00
|
|
|
if (!win || !win->HasActiveDocument() || !win->GetDocShell()) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
|
|
return mozilla::dom::ScrollRestoration::Auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool currentScrollRestorationIsManual = false;
|
|
|
|
win->GetDocShell()->GetCurrentScrollRestorationIsManual(
|
|
|
|
¤tScrollRestorationIsManual);
|
|
|
|
return currentScrollRestorationIsManual
|
|
|
|
? mozilla::dom::ScrollRestoration::Manual
|
|
|
|
: mozilla::dom::ScrollRestoration::Auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsHistory::SetScrollRestoration(mozilla::dom::ScrollRestoration aMode,
|
|
|
|
mozilla::ErrorResult& aRv) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2015-12-26 10:59:09 +00:00
|
|
|
if (!win || !win->HasActiveDocument() || !win->GetDocShell()) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
win->GetDocShell()->SetCurrentScrollRestorationIsManual(
|
|
|
|
aMode == mozilla::dom::ScrollRestoration::Manual);
|
|
|
|
}
|
|
|
|
|
2014-06-11 20:26:52 +00:00
|
|
|
void nsHistory::GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|
|
|
ErrorResult& aRv) const {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!win) {
|
|
|
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
2014-06-11 20:26:52 +00:00
|
|
|
return;
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win->HasActiveDocument()) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
2014-06-11 20:26:52 +00:00
|
|
|
return;
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2019-01-02 13:05:23 +00:00
|
|
|
nsCOMPtr<Document> doc = win->GetExtantDoc();
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!doc) {
|
|
|
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
2014-06-11 20:26:52 +00:00
|
|
|
return;
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
nsCOMPtr<nsIVariant> variant;
|
|
|
|
doc->GetStateObject(getter_AddRefs(variant));
|
1999-01-28 22:24:29 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
if (variant) {
|
2014-06-11 20:26:52 +00:00
|
|
|
aRv = variant->GetAsJSVal(aResult);
|
2013-02-20 16:37:21 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
if (aRv.Failed()) {
|
2014-06-11 20:26:52 +00:00
|
|
|
return;
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2014-06-11 20:26:52 +00:00
|
|
|
if (!JS_WrapValue(aCx, aResult)) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
}
|
2000-03-11 11:58:13 +00:00
|
|
|
|
2014-06-11 20:26:52 +00:00
|
|
|
return;
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
|
2014-06-11 20:26:52 +00:00
|
|
|
aResult.setNull();
|
1999-01-28 22:24:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
void nsHistory::Go(int32_t aDelta, ErrorResult& aRv) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win || !win->HasActiveDocument()) {
|
2019-08-02 18:02:11 +00:00
|
|
|
return aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
2013-02-20 16:37:21 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!aDelta) {
|
2018-10-11 15:43:25 +00:00
|
|
|
// https://html.spec.whatwg.org/multipage/history.html#the-history-interface
|
|
|
|
// "When the go(delta) method is invoked, if delta is zero, the user agent
|
|
|
|
// must act as if the location.reload() method was called instead."
|
2019-08-02 16:30:49 +00:00
|
|
|
RefPtr<Location> location = win->Location();
|
2019-08-02 18:02:11 +00:00
|
|
|
return location->Reload(false, aRv);
|
2004-10-20 02:19:57 +00:00
|
|
|
}
|
|
|
|
|
2018-02-01 22:35:47 +00:00
|
|
|
RefPtr<ChildSHistory> session_history = GetSessionHistory();
|
|
|
|
if (!session_history) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-05 21:54:53 +00:00
|
|
|
|
2018-02-01 22:35:47 +00:00
|
|
|
// Ignore the return value from Go(), since returning errors from Go() can
|
|
|
|
// lead to exceptions and a possible leak of history length
|
2019-08-14 06:38:47 +00:00
|
|
|
if (StaticPrefs::dom_window_history_async()) {
|
|
|
|
session_history->AsyncGo(aDelta);
|
|
|
|
} else {
|
|
|
|
session_history->Go(aDelta, IgnoreErrors());
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
}
|
2000-08-17 05:56:44 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
void nsHistory::Back(ErrorResult& aRv) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win || !win->HasActiveDocument()) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
|
|
|
|
|
|
return;
|
2011-05-25 06:31:59 +00:00
|
|
|
}
|
2009-09-01 16:45:05 +00:00
|
|
|
|
2018-02-01 22:35:47 +00:00
|
|
|
RefPtr<ChildSHistory> sHistory = GetSessionHistory();
|
|
|
|
if (!sHistory) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-14 06:38:47 +00:00
|
|
|
if (StaticPrefs::dom_window_history_async()) {
|
|
|
|
sHistory->AsyncGo(-1);
|
|
|
|
} else {
|
|
|
|
sHistory->Go(-1, IgnoreErrors());
|
|
|
|
}
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsHistory::Forward(ErrorResult& aRv) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win || !win->HasActiveDocument()) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
2011-02-01 17:19:35 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-09-01 16:45:05 +00:00
|
|
|
|
2018-02-01 22:35:47 +00:00
|
|
|
RefPtr<ChildSHistory> sHistory = GetSessionHistory();
|
|
|
|
if (!sHistory) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
2011-02-01 17:19:35 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-09-01 16:45:05 +00:00
|
|
|
|
2019-08-14 06:38:47 +00:00
|
|
|
if (StaticPrefs::dom_window_history_async()) {
|
|
|
|
sHistory->AsyncGo(1);
|
|
|
|
} else {
|
|
|
|
sHistory->Go(1, IgnoreErrors());
|
|
|
|
}
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|
2009-09-01 16:45:05 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
void nsHistory::PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
|
|
const nsAString& aTitle, const nsAString& aUrl,
|
|
|
|
ErrorResult& aRv) {
|
|
|
|
PushOrReplaceState(aCx, aData, aTitle, aUrl, aRv, false);
|
2009-09-01 16:45:05 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
void nsHistory::ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
|
|
const nsAString& aTitle, const nsAString& aUrl,
|
|
|
|
ErrorResult& aRv) {
|
|
|
|
PushOrReplaceState(aCx, aData, aTitle, aUrl, aRv, true);
|
|
|
|
}
|
|
|
|
|
2013-08-24 00:23:37 +00:00
|
|
|
void nsHistory::PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
2013-08-10 06:47:59 +00:00
|
|
|
const nsAString& aTitle,
|
|
|
|
const nsAString& aUrl, ErrorResult& aRv,
|
|
|
|
bool aReplace) {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!win) {
|
|
|
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-27 16:16:07 +00:00
|
|
|
if (!win->HasActiveDocument()) {
|
2013-08-10 06:47:59 +00:00
|
|
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddState might run scripts, so we need to hold a strong reference to the
|
|
|
|
// docShell here to keep it from going away.
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
if (!docShell) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The "replace" argument tells the docshell to whether to add a new
|
|
|
|
// history entry or modify the current one.
|
|
|
|
|
|
|
|
aRv = docShell->AddState(aData, aTitle, aUrl, aReplace, aCx);
|
|
|
|
}
|
|
|
|
|
2013-09-06 06:43:16 +00:00
|
|
|
nsIDocShell* nsHistory::GetDocShell() const {
|
2016-01-30 17:05:36 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryReferent(mInnerWindow);
|
2013-09-06 06:43:16 +00:00
|
|
|
if (!win) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return win->GetDocShell();
|
|
|
|
}
|
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
already_AddRefed<ChildSHistory> nsHistory::GetSessionHistory() const {
|
|
|
|
nsIDocShell* docShell = GetDocShell();
|
|
|
|
NS_ENSURE_TRUE(docShell, nullptr);
|
2000-11-27 23:10:09 +00:00
|
|
|
|
|
|
|
// Get the root DocShell from it
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> root;
|
2019-07-26 16:48:31 +00:00
|
|
|
docShell->GetInProcessSameTypeRootTreeItem(getter_AddRefs(root));
|
2013-08-10 06:47:59 +00:00
|
|
|
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(root));
|
|
|
|
NS_ENSURE_TRUE(webNav, nullptr);
|
2000-11-27 23:10:09 +00:00
|
|
|
|
2013-08-10 06:47:59 +00:00
|
|
|
// Get SH from nsIWebNavigation
|
2018-02-01 22:35:47 +00:00
|
|
|
return webNav->GetSessionHistory();
|
2013-08-10 06:47:59 +00:00
|
|
|
}
|