2015-05-08 14:37:00 +03: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 15:12:37 +04: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-12-23 01:35:31 +03:00
|
|
|
|
2005-08-18 15:15:33 +04:00
|
|
|
#include "nsSHEntry.h"
|
2017-04-27 13:16:46 +03:00
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
2020-05-04 17:53:34 +03:00
|
|
|
#include "nsDocShell.h"
|
2017-04-27 13:16:46 +03:00
|
|
|
#include "nsDocShellEditorData.h"
|
2020-05-20 12:09:06 +03:00
|
|
|
#include "nsDocShellLoadState.h"
|
2018-10-30 03:13:29 +03:00
|
|
|
#include "nsDocShellLoadTypes.h"
|
2020-05-04 17:53:34 +03:00
|
|
|
#include "nsIContentSecurityPolicy.h"
|
2017-04-27 13:16:46 +03:00
|
|
|
#include "nsIContentViewer.h"
|
2005-08-18 15:17:00 +04:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
2017-04-27 13:16:46 +03:00
|
|
|
#include "nsIInputStream.h"
|
2011-10-21 19:26:34 +04:00
|
|
|
#include "nsILayoutHistoryState.h"
|
2020-05-04 17:53:34 +03:00
|
|
|
#include "nsIMutableArray.h"
|
2012-07-02 03:45:59 +04:00
|
|
|
#include "nsIStructuredCloneContainer.h"
|
2013-09-04 19:26:20 +04:00
|
|
|
#include "nsIURI.h"
|
2017-04-27 13:16:46 +03:00
|
|
|
#include "nsSHEntryShared.h"
|
|
|
|
#include "nsSHistory.h"
|
|
|
|
|
2019-03-02 00:53:54 +03:00
|
|
|
#include "mozilla/Logging.h"
|
2019-02-12 22:35:32 +03:00
|
|
|
#include "nsIReferrerInfo.h"
|
2007-09-21 13:19:59 +04:00
|
|
|
|
2019-03-02 00:53:54 +03:00
|
|
|
extern mozilla::LazyLogModule gPageCacheLog;
|
|
|
|
|
2010-08-24 11:05:56 +04:00
|
|
|
namespace dom = mozilla::dom;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t gEntryID = 0;
|
2007-09-21 13:19:59 +04:00
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::nsSHEntry(nsISHistory* aSHistory)
|
|
|
|
: mShared(new nsSHEntryShared(aSHistory)),
|
2014-11-18 16:46:29 +03:00
|
|
|
mLoadType(0),
|
2005-08-18 15:16:54 +04:00
|
|
|
mID(gEntryID++),
|
|
|
|
mScrollPositionX(0),
|
|
|
|
mScrollPositionY(0),
|
2012-07-30 18:20:58 +04:00
|
|
|
mParent(nullptr),
|
2017-04-27 13:16:46 +03:00
|
|
|
mLoadReplace(false),
|
2011-10-17 18:59:28 +04:00
|
|
|
mURIWasModified(false),
|
2013-06-29 07:13:22 +04:00
|
|
|
mIsSrcdocEntry(false),
|
2015-12-26 13:59:09 +03:00
|
|
|
mScrollRestorationIsManual(false),
|
2017-05-18 14:08:56 +03:00
|
|
|
mLoadedInThisProcess(false),
|
2020-06-09 17:48:38 +03:00
|
|
|
mPersist(true),
|
|
|
|
mHasUserInteraction(false) {}
|
2005-08-18 15:16:54 +04:00
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::nsSHEntry(const nsSHEntry& aOther)
|
|
|
|
: mShared(aOther.mShared),
|
|
|
|
mURI(aOther.mURI),
|
2015-09-30 09:54:39 +03:00
|
|
|
mOriginalURI(aOther.mOriginalURI),
|
2017-07-29 20:04:39 +03:00
|
|
|
mResultPrincipalURI(aOther.mResultPrincipalURI),
|
2019-02-12 22:35:32 +03:00
|
|
|
mReferrerInfo(aOther.mReferrerInfo),
|
2015-05-06 20:57:23 +03:00
|
|
|
mTitle(aOther.mTitle),
|
|
|
|
mPostData(aOther.mPostData),
|
2005-08-18 15:16:54 +04:00
|
|
|
mLoadType(0) // XXX why not copy?
|
|
|
|
,
|
2015-05-06 20:57:23 +03:00
|
|
|
mID(aOther.mID),
|
2005-08-18 15:16:54 +04:00
|
|
|
mScrollPositionX(0) // XXX why not copy?
|
|
|
|
,
|
|
|
|
mScrollPositionY(0) // XXX why not copy?
|
2015-05-06 20:57:23 +03:00
|
|
|
,
|
|
|
|
mParent(aOther.mParent),
|
|
|
|
mStateData(aOther.mStateData),
|
|
|
|
mSrcdocData(aOther.mSrcdocData),
|
|
|
|
mBaseURI(aOther.mBaseURI),
|
2017-04-27 13:16:46 +03:00
|
|
|
mLoadReplace(aOther.mLoadReplace),
|
|
|
|
mURIWasModified(aOther.mURIWasModified),
|
|
|
|
mIsSrcdocEntry(aOther.mIsSrcdocEntry),
|
|
|
|
mScrollRestorationIsManual(false),
|
2017-05-18 14:08:56 +03:00
|
|
|
mLoadedInThisProcess(aOther.mLoadedInThisProcess),
|
2020-06-09 17:48:38 +03:00
|
|
|
mPersist(aOther.mPersist),
|
|
|
|
mHasUserInteraction(false) {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2005-08-18 15:17:00 +04:00
|
|
|
nsSHEntry::~nsSHEntry() {
|
2011-10-21 19:26:34 +04:00
|
|
|
// Null out the mParent pointers on all our kids.
|
2017-02-24 13:32:20 +03:00
|
|
|
for (nsISHEntry* entry : mChildren) {
|
|
|
|
if (entry) {
|
|
|
|
entry->SetParent(nullptr);
|
|
|
|
}
|
|
|
|
}
|
2005-08-18 15:17:00 +04:00
|
|
|
}
|
|
|
|
|
2018-08-22 12:20:56 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHEntry)
|
1999-12-23 01:35:31 +03:00
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetScrollPosition(int32_t aX, int32_t aY) {
|
|
|
|
mScrollPositionX = aX;
|
|
|
|
mScrollPositionY = aY;
|
2005-08-18 15:16:37 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetScrollPosition(int32_t* aX, int32_t* aY) {
|
|
|
|
*aX = mScrollPositionX;
|
|
|
|
*aY = mScrollPositionY;
|
2005-08-18 15:16:37 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-12-23 01:35:31 +03:00
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetURIWasModified(bool* aOut) {
|
2011-07-07 17:12:14 +04:00
|
|
|
*aOut = mURIWasModified;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetURIWasModified(bool aIn) {
|
2011-07-07 17:12:14 +04:00
|
|
|
mURIWasModified = aIn;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetURI(nsIURI** aURI) {
|
2005-08-18 15:16:54 +04:00
|
|
|
*aURI = mURI;
|
|
|
|
NS_IF_ADDREF(*aURI);
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:31 +04:00
|
|
|
}
|
1999-12-23 01:35:31 +03:00
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetURI(nsIURI* aURI) {
|
2005-08-18 15:16:54 +04:00
|
|
|
mURI = aURI;
|
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-09-30 09:54:39 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetOriginalURI(nsIURI** aOriginalURI) {
|
|
|
|
*aOriginalURI = mOriginalURI;
|
|
|
|
NS_IF_ADDREF(*aOriginalURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetOriginalURI(nsIURI* aOriginalURI) {
|
|
|
|
mOriginalURI = aOriginalURI;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-30 19:07:59 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetResultPrincipalURI(nsIURI** aResultPrincipalURI) {
|
|
|
|
*aResultPrincipalURI = mResultPrincipalURI;
|
|
|
|
NS_IF_ADDREF(*aResultPrincipalURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetResultPrincipalURI(nsIURI* aResultPrincipalURI) {
|
|
|
|
mResultPrincipalURI = aResultPrincipalURI;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-06-28 11:03:25 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetLoadReplace(bool* aLoadReplace) {
|
|
|
|
*aLoadReplace = mLoadReplace;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetLoadReplace(bool aLoadReplace) {
|
|
|
|
mLoadReplace = aLoadReplace;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2019-02-12 22:35:32 +03:00
|
|
|
nsSHEntry::GetReferrerInfo(nsIReferrerInfo** aReferrerInfo) {
|
|
|
|
*aReferrerInfo = mReferrerInfo;
|
|
|
|
NS_IF_ADDREF(*aReferrerInfo);
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:10 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2019-02-12 22:35:32 +03:00
|
|
|
nsSHEntry::SetReferrerInfo(nsIReferrerInfo* aReferrerInfo) {
|
|
|
|
mReferrerInfo = aReferrerInfo;
|
2014-11-18 16:46:29 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-18 15:17:00 +04:00
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsSHEntry::SetSticky(bool aSticky) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mSticky = aSticky;
|
2005-08-18 15:17:00 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetSticky(bool* aSticky) {
|
2011-10-21 19:26:34 +04:00
|
|
|
*aSticky = mShared->mSticky;
|
2005-08-18 15:17:00 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2018-09-05 04:29:36 +03:00
|
|
|
nsSHEntry::GetTitle(nsAString& aTitle) {
|
2005-08-18 15:16:54 +04:00
|
|
|
// Check for empty title...
|
|
|
|
if (mTitle.IsEmpty() && mURI) {
|
|
|
|
// Default title is the URL.
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString spec;
|
2015-05-06 20:57:23 +03:00
|
|
|
if (NS_SUCCEEDED(mURI->GetSpec(spec))) {
|
2005-08-18 15:16:54 +04:00
|
|
|
AppendUTF8toUTF16(spec, mTitle);
|
2015-05-06 20:57:23 +03:00
|
|
|
}
|
2005-08-18 15:16:54 +04:00
|
|
|
}
|
2005-08-18 15:15:49 +04:00
|
|
|
|
2018-09-05 04:29:36 +03:00
|
|
|
aTitle = mTitle;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetTitle(const nsAString& aTitle) {
|
2005-08-18 15:16:54 +04:00
|
|
|
mTitle = aTitle;
|
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetPostData(nsIInputStream** aResult) {
|
2005-08-18 15:16:54 +04:00
|
|
|
*aResult = mPostData;
|
|
|
|
NS_IF_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetPostData(nsIInputStream* aPostData) {
|
2005-08-18 15:16:54 +04:00
|
|
|
mPostData = aPostData;
|
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult) {
|
2019-12-05 23:30:45 +03:00
|
|
|
*aResult = mShared->mLayoutHistoryState;
|
|
|
|
NS_IF_ADDREF(*aResult);
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetLayoutHistoryState(nsILayoutHistoryState* aState) {
|
2019-12-05 23:30:45 +03:00
|
|
|
mShared->mLayoutHistoryState = aState;
|
|
|
|
if (mShared->mLayoutHistoryState) {
|
|
|
|
mShared->mLayoutHistoryState->SetScrollPositionOnly(
|
|
|
|
!mShared->mSaveLayoutState);
|
|
|
|
}
|
|
|
|
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
1999-12-23 01:35:31 +03:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2017-03-25 16:01:29 +03:00
|
|
|
nsSHEntry::InitLayoutHistoryState(nsILayoutHistoryState** aState) {
|
2019-12-05 23:30:45 +03:00
|
|
|
if (!mShared->mLayoutHistoryState) {
|
|
|
|
nsCOMPtr<nsILayoutHistoryState> historyState;
|
|
|
|
historyState = NS_NewLayoutHistoryState();
|
|
|
|
SetLayoutHistoryState(historyState);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsILayoutHistoryState> state = GetLayoutHistoryState();
|
|
|
|
state.forget(aState);
|
2018-09-07 04:56:23 +03:00
|
|
|
return NS_OK;
|
2017-03-25 16:01:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetLoadType(uint32_t* aResult) {
|
2005-08-18 15:16:54 +04:00
|
|
|
*aResult = mLoadType;
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:52 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetLoadType(uint32_t aLoadType) {
|
2005-08-18 15:16:54 +04:00
|
|
|
mLoadType = aLoadType;
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:52 +04:00
|
|
|
}
|
2005-08-18 15:15:34 +04:00
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetID(uint32_t* aResult) {
|
2005-08-18 15:16:54 +04:00
|
|
|
*aResult = mID;
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:58 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetID(uint32_t aID) {
|
2005-08-18 15:16:54 +04:00
|
|
|
mID = aID;
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:58 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetIsSubFrame(bool* aFlag) {
|
2011-10-21 19:26:34 +04:00
|
|
|
*aFlag = mShared->mIsFrameNavigation;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:01 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetIsSubFrame(bool aFlag) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mIsFrameNavigation = aFlag;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:01 +04:00
|
|
|
}
|
2005-08-18 15:16:09 +04:00
|
|
|
|
2020-06-09 17:48:38 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetHasUserInteraction(bool* aFlag) {
|
|
|
|
// We can't assert that this getter isn't accessed only on root
|
|
|
|
// entries because there's JS code that will iterate over entries
|
|
|
|
// for serialization etc., so let's assert the next best thing.
|
|
|
|
MOZ_ASSERT(!mParent || !mHasUserInteraction,
|
|
|
|
"User interaction can only be set on root entries");
|
|
|
|
|
|
|
|
*aFlag = mHasUserInteraction;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetHasUserInteraction(bool aFlag) {
|
|
|
|
// The back button and menulist deal with root/top-level
|
|
|
|
// session history entries, thus we annotate only the root entry.
|
|
|
|
if (!mParent) {
|
|
|
|
mHasUserInteraction = aFlag;
|
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsISHEntry> root = nsSHistory::GetRootSHEntry(this);
|
|
|
|
root->SetHasUserInteraction(aFlag);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2018-03-06 06:19:42 +03:00
|
|
|
nsSHEntry::GetCacheKey(uint32_t* aResult) {
|
2011-10-21 19:26:34 +04:00
|
|
|
*aResult = mShared->mCacheKey;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:09 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
2018-03-06 06:19:42 +03:00
|
|
|
nsSHEntry::SetCacheKey(uint32_t aCacheKey) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mCacheKey = aCacheKey;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:09 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetExpirationStatus(bool* aFlag) {
|
2011-10-21 19:26:34 +04:00
|
|
|
*aFlag = mShared->mExpired;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:14 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetExpirationStatus(bool aFlag) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mExpired = aFlag;
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:14 +04:00
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetContentType(nsACString& aContentType) {
|
2011-10-21 19:26:34 +04:00
|
|
|
aContentType = mShared->mContentType;
|
2005-08-18 15:16:43 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetContentType(const nsACString& aContentType) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mContentType = aContentType;
|
2005-08-18 15:16:43 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-18 15:16:36 +04:00
|
|
|
NS_IMETHODIMP
|
2020-06-03 09:09:52 +03:00
|
|
|
nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
|
|
|
|
nsIInputStream* aInputStream, uint32_t aCacheKey,
|
|
|
|
const nsACString& aContentType,
|
|
|
|
nsIPrincipal* aTriggeringPrincipal,
|
|
|
|
nsIPrincipal* aPrincipalToInherit,
|
|
|
|
nsIPrincipal* aPartitionedPrincipalToInherit,
|
|
|
|
nsIContentSecurityPolicy* aCsp, const nsID& aDocShellID,
|
|
|
|
bool aDynamicCreation, nsIURI* aOriginalURI,
|
|
|
|
nsIURI* aResultPrincipalURI, bool aLoadReplace,
|
|
|
|
nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdocData,
|
|
|
|
bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState,
|
|
|
|
bool aExpired) {
|
2017-01-27 13:19:13 +03:00
|
|
|
MOZ_ASSERT(
|
|
|
|
aTriggeringPrincipal,
|
|
|
|
"need a valid triggeringPrincipal to create a session history entry");
|
|
|
|
|
2005-08-18 15:16:54 +04:00
|
|
|
mURI = aURI;
|
|
|
|
mTitle = aTitle;
|
|
|
|
mPostData = aInputStream;
|
2009-09-01 20:45:05 +04:00
|
|
|
|
2005-08-18 15:16:09 +04:00
|
|
|
// Set the LoadType by default to loadHistory during creation
|
2018-07-03 02:32:47 +03:00
|
|
|
mLoadType = LOAD_HISTORY;
|
2005-08-18 15:16:01 +04:00
|
|
|
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mCacheKey = aCacheKey;
|
|
|
|
mShared->mContentType = aContentType;
|
2016-07-28 10:20:41 +03:00
|
|
|
mShared->mTriggeringPrincipal = aTriggeringPrincipal;
|
2016-09-20 09:36:25 +03:00
|
|
|
mShared->mPrincipalToInherit = aPrincipalToInherit;
|
2020-06-03 09:09:52 +03:00
|
|
|
mShared->mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
|
2019-02-21 18:00:32 +03:00
|
|
|
mShared->mCsp = aCsp;
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mDocShellID = aDocShellID;
|
|
|
|
mShared->mDynamicallyCreated = aDynamicCreation;
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
// By default all entries are set false for subframe flag.
|
2005-08-18 15:16:09 +04:00
|
|
|
// nsDocShell::CloneAndReplace() which creates entries for
|
|
|
|
// all subframe navigations, sets the flag to true.
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mIsFrameNavigation = false;
|
2005-08-18 15:16:01 +04:00
|
|
|
|
2020-06-09 17:48:38 +03:00
|
|
|
mHasUserInteraction = false;
|
|
|
|
|
2019-03-26 22:46:36 +03:00
|
|
|
mShared->mExpired = aExpired;
|
2005-08-18 15:16:14 +04:00
|
|
|
|
2019-03-26 22:46:36 +03:00
|
|
|
mIsSrcdocEntry = aSrcdocEntry;
|
|
|
|
mSrcdocData = aSrcdocData;
|
|
|
|
|
|
|
|
mBaseURI = aBaseURI;
|
2013-07-16 18:32:39 +04:00
|
|
|
|
2017-05-18 14:08:56 +03:00
|
|
|
mLoadedInThisProcess = true;
|
|
|
|
|
2019-03-26 22:46:36 +03:00
|
|
|
mOriginalURI = aOriginalURI;
|
|
|
|
mResultPrincipalURI = aResultPrincipalURI;
|
|
|
|
mLoadReplace = aLoadReplace;
|
|
|
|
mReferrerInfo = aReferrerInfo;
|
2005-08-18 15:15:34 +04:00
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
mShared->mLayoutHistoryState = nullptr;
|
|
|
|
|
|
|
|
mShared->mSaveLayoutState = aSaveLayoutState;
|
|
|
|
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:16:36 +04:00
|
|
|
}
|
|
|
|
|
2005-08-18 15:15:34 +04:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetParent(nsISHEntry** aResult) {
|
2011-11-01 06:33:24 +04:00
|
|
|
*aResult = mParent;
|
2005-08-18 15:15:34 +04:00
|
|
|
NS_IF_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SetParent(nsISHEntry* aParent) {
|
2005-08-18 15:16:54 +04:00
|
|
|
/* parent not Addrefed on purpose to avoid cyclic reference
|
|
|
|
* Null parent is OK
|
|
|
|
*
|
|
|
|
* XXX this method should not be scriptable if this is the case!!
|
|
|
|
*/
|
2011-11-01 06:33:24 +04:00
|
|
|
mParent = aParent;
|
2005-08-18 15:15:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-09-07 04:56:23 +03:00
|
|
|
NS_IMETHODIMP_(void)
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SetViewerBounds(const nsIntRect& aBounds) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mViewerBounds = aBounds;
|
2005-08-18 15:17:00 +04:00
|
|
|
}
|
|
|
|
|
2018-09-07 04:56:23 +03:00
|
|
|
NS_IMETHODIMP_(void)
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetViewerBounds(nsIntRect& aBounds) {
|
2011-10-21 19:26:34 +04:00
|
|
|
aBounds = mShared->mViewerBounds;
|
2006-06-20 01:08:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2016-07-28 10:20:41 +03:00
|
|
|
nsSHEntry::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal) {
|
|
|
|
NS_IF_ADDREF(*aTriggeringPrincipal = mShared->mTriggeringPrincipal);
|
2005-08-18 15:17:00 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-09-18 02:27:17 +04:00
|
|
|
NS_IMETHODIMP
|
2016-07-28 10:20:41 +03:00
|
|
|
nsSHEntry::SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal) {
|
|
|
|
mShared->mTriggeringPrincipal = aTriggeringPrincipal;
|
2011-10-21 19:26:34 +04:00
|
|
|
return NS_OK;
|
2016-09-20 09:36:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetPrincipalToInherit(nsIPrincipal** aPrincipalToInherit) {
|
|
|
|
NS_IF_ADDREF(*aPrincipalToInherit = mShared->mPrincipalToInherit);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit) {
|
|
|
|
mShared->mPrincipalToInherit = aPrincipalToInherit;
|
|
|
|
return NS_OK;
|
2011-10-21 19:26:34 +04:00
|
|
|
}
|
|
|
|
|
2019-06-13 02:01:56 +03:00
|
|
|
NS_IMETHODIMP
|
2020-06-03 09:09:52 +03:00
|
|
|
nsSHEntry::GetPartitionedPrincipalToInherit(
|
|
|
|
nsIPrincipal** aPartitionedPrincipalToInherit) {
|
|
|
|
NS_IF_ADDREF(*aPartitionedPrincipalToInherit =
|
|
|
|
mShared->mPartitionedPrincipalToInherit);
|
2019-06-13 02:01:56 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-06-03 09:09:52 +03:00
|
|
|
nsSHEntry::SetPartitionedPrincipalToInherit(
|
|
|
|
nsIPrincipal* aPartitionedPrincipalToInherit) {
|
|
|
|
mShared->mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
|
2019-06-13 02:01:56 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-02-21 18:00:32 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetCsp(nsIContentSecurityPolicy** aCsp) {
|
|
|
|
NS_IF_ADDREF(*aCsp = mShared->mCsp);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetCsp(nsIContentSecurityPolicy* aCsp) {
|
|
|
|
mShared->mCsp = aCsp;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-10-21 19:26:34 +04:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::AdoptBFCacheEntry(nsISHEntry* aEntry) {
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntryShared* shared = static_cast<nsSHEntry*>(aEntry)->mShared;
|
2011-10-21 19:26:34 +04:00
|
|
|
NS_ENSURE_STATE(shared);
|
|
|
|
|
|
|
|
mShared = shared;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SharesDocumentWith(nsISHEntry* aEntry, bool* aOut) {
|
2011-10-21 19:26:34 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aOut);
|
|
|
|
|
2019-03-05 17:46:10 +03:00
|
|
|
*aOut = mShared == static_cast<nsSHEntry*>(aEntry)->mShared;
|
2011-10-21 19:26:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-06-29 07:13:22 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetIsSrcdocEntry(bool* aIsSrcdocEntry) {
|
|
|
|
*aIsSrcdocEntry = mIsSrcdocEntry;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetSrcdocData(nsAString& aSrcdocData) {
|
2013-06-29 07:13:22 +04:00
|
|
|
aSrcdocData = mSrcdocData;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SetSrcdocData(const nsAString& aSrcdocData) {
|
2013-06-29 07:13:22 +04:00
|
|
|
mSrcdocData = aSrcdocData;
|
|
|
|
mIsSrcdocEntry = true;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-02-06 18:46:29 +04:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetBaseURI(nsIURI** aBaseURI) {
|
2014-02-06 18:46:29 +04:00
|
|
|
*aBaseURI = mBaseURI;
|
|
|
|
NS_IF_ADDREF(*aBaseURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-06-29 07:13:22 +04:00
|
|
|
|
2014-02-06 18:46:29 +04:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SetBaseURI(nsIURI* aBaseURI) {
|
2014-02-06 18:46:29 +04:00
|
|
|
mBaseURI = aBaseURI;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-06-29 07:13:22 +04:00
|
|
|
|
2015-12-26 13:59:09 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetScrollRestorationIsManual(bool* aIsManual) {
|
|
|
|
*aIsManual = mScrollRestorationIsManual;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetScrollRestorationIsManual(bool aIsManual) {
|
|
|
|
mScrollRestorationIsManual = aIsManual;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-05-18 14:08:56 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetLoadedInThisProcess(bool* aLoadedInThisProcess) {
|
|
|
|
*aLoadedInThisProcess = mLoadedInThisProcess;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetChildCount(int32_t* aCount) {
|
2005-08-18 15:16:54 +04:00
|
|
|
*aCount = mChildren.Count();
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
Bug 1586911: Silence SHEntry assertion after local->remote->local iframe navigation. r=peterv
When we have a parser-created iframe which starts out in-process, transitions
to remote, and then transitions back to in-process, we create separate
DocShells for the first and last in-process loads. Since both are
network-created, and have the same child index, they both try to add
themselves as children to their parent's SHistory at the same index. And since
the entry for the first DocShell already exists at that index when we try to
add the second, that triggers an assertion.
This isn't really ideal, but it is expected given the current state of session
history under Fission. It should hopefully be solved more gracefully when the
Fission-aware session history rewrite is done, but in the mean time, I think
we should just ignore the conflict, since it's expected.
Differential Revision: https://phabricator.services.mozilla.com/D48437
--HG--
extra : moz-landing-system : lando
2019-10-11 22:32:02 +03:00
|
|
|
nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset,
|
|
|
|
bool aUseRemoteSubframes) {
|
2010-08-17 18:13:55 +04:00
|
|
|
if (aChild) {
|
|
|
|
NS_ENSURE_SUCCESS(aChild->SetParent(this), NS_ERROR_FAILURE);
|
|
|
|
}
|
2005-08-18 15:15:34 +04:00
|
|
|
|
2010-08-17 18:13:55 +04:00
|
|
|
if (aOffset < 0) {
|
|
|
|
mChildren.AppendObject(aChild);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-08-18 15:16:42 +04:00
|
|
|
|
2005-08-18 15:16:54 +04:00
|
|
|
//
|
|
|
|
// Bug 52670: Ensure children are added in order.
|
|
|
|
//
|
|
|
|
// Later frames in the child list may load faster and get appended
|
|
|
|
// before earlier frames, causing session history to be scrambled.
|
|
|
|
// By growing the list here, they are added to the right position.
|
|
|
|
//
|
|
|
|
// Assert that aOffset will not be so high as to grow us a lot.
|
|
|
|
//
|
2015-05-06 20:57:23 +03:00
|
|
|
NS_ASSERTION(aOffset < (mChildren.Count() + 1023), "Large frames array!\n");
|
2005-08-18 15:16:13 +04:00
|
|
|
|
2018-09-12 04:59:06 +03:00
|
|
|
bool newChildIsDyn = aChild ? aChild->IsDynamicallyAdded() : false;
|
2010-08-17 18:13:55 +04:00
|
|
|
|
2011-03-24 15:23:36 +03:00
|
|
|
// If the new child is dynamically added, try to add it to aOffset, but if
|
|
|
|
// there are non-dynamically added children, the child must be after those.
|
|
|
|
if (newChildIsDyn) {
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t lastNonDyn = aOffset - 1;
|
|
|
|
for (int32_t i = aOffset; i < mChildren.Count(); ++i) {
|
2011-03-24 15:23:36 +03:00
|
|
|
nsISHEntry* entry = mChildren[i];
|
|
|
|
if (entry) {
|
2018-09-12 04:59:06 +03:00
|
|
|
if (entry->IsDynamicallyAdded()) {
|
2011-03-24 15:23:36 +03:00
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
lastNonDyn = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// InsertObjectAt allows only appending one object.
|
|
|
|
// If aOffset is larger than Count(), we must first manually
|
|
|
|
// set the capacity.
|
|
|
|
if (aOffset > mChildren.Count()) {
|
|
|
|
mChildren.SetCount(aOffset);
|
|
|
|
}
|
|
|
|
if (!mChildren.InsertObjectAt(aChild, lastNonDyn + 1)) {
|
|
|
|
NS_WARNING("Adding a child failed!");
|
2012-07-30 18:20:58 +04:00
|
|
|
aChild->SetParent(nullptr);
|
2011-03-24 15:23:36 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// If the new child isn't dynamically added, it should be set to aOffset.
|
|
|
|
// If there are dynamically added children before that, those must be
|
|
|
|
// moved to be after aOffset.
|
|
|
|
if (mChildren.Count() > 0) {
|
2013-01-15 16:22:03 +04:00
|
|
|
int32_t start = std::min(mChildren.Count() - 1, aOffset);
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t dynEntryIndex = -1;
|
2012-07-30 18:20:58 +04:00
|
|
|
nsISHEntry* dynEntry = nullptr;
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t i = start; i >= 0; --i) {
|
2011-03-24 15:23:36 +03:00
|
|
|
nsISHEntry* entry = mChildren[i];
|
|
|
|
if (entry) {
|
2018-09-12 04:59:06 +03:00
|
|
|
if (entry->IsDynamicallyAdded()) {
|
2011-03-24 15:23:36 +03:00
|
|
|
dynEntryIndex = i;
|
|
|
|
dynEntry = entry;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-05-06 20:57:23 +03:00
|
|
|
|
2011-03-24 15:23:36 +03:00
|
|
|
if (dynEntry) {
|
|
|
|
nsCOMArray<nsISHEntry> tmp;
|
|
|
|
tmp.SetCount(aOffset - dynEntryIndex + 1);
|
|
|
|
mChildren.InsertObjectsAt(tmp, dynEntryIndex);
|
|
|
|
NS_ASSERTION(mChildren[aOffset + 1] == dynEntry, "Whaat?");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure there isn't anything at aOffset.
|
|
|
|
if (aOffset < mChildren.Count()) {
|
|
|
|
nsISHEntry* oldChild = mChildren[aOffset];
|
|
|
|
if (oldChild && oldChild != aChild) {
|
Bug 1586911: Silence SHEntry assertion after local->remote->local iframe navigation. r=peterv
When we have a parser-created iframe which starts out in-process, transitions
to remote, and then transitions back to in-process, we create separate
DocShells for the first and last in-process loads. Since both are
network-created, and have the same child index, they both try to add
themselves as children to their parent's SHistory at the same index. And since
the entry for the first DocShell already exists at that index when we try to
add the second, that triggers an assertion.
This isn't really ideal, but it is expected given the current state of session
history under Fission. It should hopefully be solved more gracefully when the
Fission-aware session history rewrite is done, but in the mean time, I think
we should just ignore the conflict, since it's expected.
Differential Revision: https://phabricator.services.mozilla.com/D48437
--HG--
extra : moz-landing-system : lando
2019-10-11 22:32:02 +03:00
|
|
|
// Under Fission, this can happen when a network-created iframe starts
|
|
|
|
// out in-process, moves out-of-process, and then switches back. At that
|
|
|
|
// point, we'll create a new network-created DocShell at the same index
|
|
|
|
// where we already have an entry for the original network-created
|
|
|
|
// DocShell.
|
|
|
|
//
|
|
|
|
// This should ideally stop being an issue once the Fission-aware
|
|
|
|
// session history rewrite is complete.
|
|
|
|
NS_ASSERTION(
|
|
|
|
aUseRemoteSubframes,
|
2011-03-24 15:23:36 +03:00
|
|
|
"Adding a child where we already have a child? This may misbehave");
|
2012-07-30 18:20:58 +04:00
|
|
|
oldChild->SetParent(nullptr);
|
2011-03-24 15:23:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 17:20:00 +03:00
|
|
|
mChildren.ReplaceObjectAt(aChild, aOffset);
|
2010-08-21 01:26:52 +04:00
|
|
|
}
|
2005-08-18 15:15:34 +04:00
|
|
|
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:15:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::RemoveChild(nsISHEntry* aChild) {
|
2005-08-18 15:16:54 +04:00
|
|
|
NS_ENSURE_TRUE(aChild, NS_ERROR_FAILURE);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool childRemoved = false;
|
2018-09-12 04:59:06 +03:00
|
|
|
if (aChild->IsDynamicallyAdded()) {
|
2010-08-17 18:13:55 +04:00
|
|
|
childRemoved = mChildren.RemoveObject(aChild);
|
|
|
|
} else {
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t index = mChildren.IndexOfObject(aChild);
|
2010-08-17 18:13:55 +04:00
|
|
|
if (index >= 0) {
|
2017-01-24 09:56:37 +03:00
|
|
|
// Other alive non-dynamic child docshells still keep mChildOffset,
|
|
|
|
// so we don't want to change the indices here.
|
2016-08-02 17:20:00 +03:00
|
|
|
mChildren.ReplaceObjectAt(nullptr, index);
|
|
|
|
childRemoved = true;
|
2010-08-17 18:13:55 +04:00
|
|
|
}
|
|
|
|
}
|
2012-02-01 14:45:53 +04:00
|
|
|
if (childRemoved) {
|
2012-07-30 18:20:58 +04:00
|
|
|
aChild->SetParent(nullptr);
|
2012-02-01 14:45:53 +04:00
|
|
|
|
|
|
|
// reduce the child count, i.e. remove empty children at the end
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t i = mChildren.Count() - 1; i >= 0 && !mChildren[i]; --i) {
|
2012-02-01 14:45:53 +04:00
|
|
|
if (!mChildren.RemoveObjectAt(i)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-18 15:16:54 +04:00
|
|
|
return NS_OK;
|
2005-08-18 15:15:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetChildAt(int32_t aIndex, nsISHEntry** aResult) {
|
2005-08-18 15:16:54 +04:00
|
|
|
if (aIndex >= 0 && aIndex < mChildren.Count()) {
|
|
|
|
*aResult = mChildren[aIndex];
|
2005-08-18 15:16:55 +04:00
|
|
|
// yes, mChildren can have holes in it. AddChild's offset parameter makes
|
|
|
|
// that possible.
|
|
|
|
NS_IF_ADDREF(*aResult);
|
2005-08-18 15:16:54 +04:00
|
|
|
} else {
|
2012-07-30 18:20:58 +04:00
|
|
|
*aResult = nullptr;
|
2005-08-18 15:16:54 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
2005-08-18 15:15:34 +04:00
|
|
|
}
|
2005-08-18 15:17:00 +04:00
|
|
|
|
2019-04-15 21:27:44 +03:00
|
|
|
NS_IMETHODIMP_(void)
|
|
|
|
nsSHEntry::GetChildSHEntryIfHasNoDynamicallyAddedChild(int32_t aChildOffset,
|
|
|
|
nsISHEntry** aChild) {
|
|
|
|
*aChild = nullptr;
|
|
|
|
|
|
|
|
bool dynamicallyAddedChild = false;
|
|
|
|
HasDynamicallyAddedChild(&dynamicallyAddedChild);
|
|
|
|
if (dynamicallyAddedChild) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the user did a shift-reload on this frameset page,
|
|
|
|
// we don't want to load the subframes from history.
|
|
|
|
if (IsForceReloadType(mLoadType) || mLoadType == LOAD_REFRESH) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Before looking for the subframe's url, check
|
|
|
|
* the expiration status of the parent. If the parent
|
|
|
|
* has expired from cache, then subframes will not be
|
|
|
|
* loaded from history in certain situations.
|
|
|
|
* If the user pressed reload and the parent frame has expired
|
|
|
|
* from cache, we do not want to load the child frame from history.
|
|
|
|
*/
|
|
|
|
if (mShared->mExpired && (mLoadType == LOAD_RELOAD_NORMAL)) {
|
|
|
|
// The parent has expired. Return null.
|
|
|
|
*aChild = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Get the child subframe from session history.
|
|
|
|
GetChildAt(aChildOffset, aChild);
|
|
|
|
if (*aChild) {
|
|
|
|
// Set the parent's Load Type on the child
|
|
|
|
(*aChild)->SetLoadType(mLoadType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-13 21:19:20 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::ReplaceChild(nsISHEntry* aNewEntry) {
|
|
|
|
NS_ENSURE_STATE(aNewEntry);
|
|
|
|
|
2019-03-05 17:46:10 +03:00
|
|
|
nsID docshellID;
|
|
|
|
aNewEntry->GetDocshellID(docshellID);
|
2014-11-13 21:19:20 +03:00
|
|
|
|
|
|
|
for (int32_t i = 0; i < mChildren.Count(); ++i) {
|
2019-03-05 17:46:10 +03:00
|
|
|
if (mChildren[i]) {
|
|
|
|
nsID childDocshellID;
|
|
|
|
nsresult rv = mChildren[i]->GetDocshellID(childDocshellID);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (docshellID == childDocshellID) {
|
|
|
|
mChildren[i]->SetParent(nullptr);
|
|
|
|
mChildren.ReplaceObjectAt(aNewEntry, i);
|
|
|
|
return aNewEntry->SetParent(this);
|
|
|
|
}
|
2014-11-13 21:19:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2019-03-26 21:24:33 +03:00
|
|
|
NS_IMETHODIMP_(void) nsSHEntry::ClearEntry() {
|
|
|
|
int32_t childCount = GetChildCount();
|
|
|
|
// Remove all children of this entry
|
|
|
|
for (int32_t i = childCount - 1; i >= 0; i--) {
|
|
|
|
nsCOMPtr<nsISHEntry> child;
|
|
|
|
GetChildAt(i, getter_AddRefs(child));
|
|
|
|
RemoveChild(child);
|
|
|
|
}
|
2020-05-20 12:09:06 +03:00
|
|
|
AbandonBFCacheEntry();
|
2019-03-05 17:46:10 +03:00
|
|
|
}
|
2008-04-24 01:36:17 +04:00
|
|
|
|
2009-09-01 20:45:05 +04:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetStateData(nsIStructuredCloneContainer** aContainer) {
|
2011-04-25 06:30:54 +04:00
|
|
|
NS_IF_ADDREF(*aContainer = mStateData);
|
2009-09-01 20:45:05 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::SetStateData(nsIStructuredCloneContainer* aContainer) {
|
2011-04-25 06:30:54 +04:00
|
|
|
mStateData = aContainer;
|
2009-09-01 20:45:05 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-09-12 04:59:06 +03:00
|
|
|
NS_IMETHODIMP_(bool)
|
|
|
|
nsSHEntry::IsDynamicallyAdded() { return mShared->mDynamicallyCreated; }
|
2010-08-17 18:13:55 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsSHEntry::HasDynamicallyAddedChild(bool* aAdded) {
|
2011-10-17 18:59:28 +04:00
|
|
|
*aAdded = false;
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t i = 0; i < mChildren.Count(); ++i) {
|
2010-08-17 18:13:55 +04:00
|
|
|
nsISHEntry* entry = mChildren[i];
|
|
|
|
if (entry) {
|
2018-09-12 04:59:06 +03:00
|
|
|
*aAdded = entry->IsDynamicallyAdded();
|
2010-08-17 18:13:55 +04:00
|
|
|
if (*aAdded) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-03-05 17:46:10 +03:00
|
|
|
nsSHEntry::GetDocshellID(nsID& aID) {
|
|
|
|
aID = mShared->mDocShellID;
|
2010-08-17 18:13:55 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-03-05 17:46:10 +03:00
|
|
|
nsSHEntry::SetDocshellID(const nsID& aID) {
|
|
|
|
mShared->mDocShellID = aID;
|
2010-08-17 18:13:55 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-01-19 22:57:36 +03:00
|
|
|
NS_IMETHODIMP
|
2015-05-06 20:57:23 +03:00
|
|
|
nsSHEntry::GetLastTouched(uint32_t* aLastTouched) {
|
2011-10-21 19:26:34 +04:00
|
|
|
*aLastTouched = mShared->mLastTouched;
|
2011-01-19 22:57:36 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSHEntry::SetLastTouched(uint32_t aLastTouched) {
|
2011-10-21 19:26:34 +04:00
|
|
|
mShared->mLastTouched = aLastTouched;
|
2011-01-19 22:57:36 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2017-04-27 13:59:11 +03:00
|
|
|
|
2017-05-22 10:36:06 +03:00
|
|
|
NS_IMETHODIMP
|
2019-10-17 21:03:49 +03:00
|
|
|
nsSHEntry::GetShistory(nsISHistory** aSHistory) {
|
2017-05-22 10:36:06 +03:00
|
|
|
nsCOMPtr<nsISHistory> shistory(do_QueryReferent(mShared->mSHistory));
|
|
|
|
shistory.forget(aSHistory);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-07-03 02:32:47 +03:00
|
|
|
NS_IMETHODIMP
|
2018-09-12 05:54:11 +03:00
|
|
|
nsSHEntry::SetLoadTypeAsHistory() {
|
2018-07-03 02:32:47 +03:00
|
|
|
// Set the LoadType by default to loadHistory during creation
|
|
|
|
mLoadType = LOAD_HISTORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2018-09-05 02:02:37 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::GetPersist(bool* aPersist) {
|
|
|
|
*aPersist = mPersist;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SetPersist(bool aPersist) {
|
|
|
|
mPersist = aPersist;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2019-03-05 17:46:10 +03:00
|
|
|
|
2019-03-29 22:48:59 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::CreateLoadInfo(nsDocShellLoadState** aLoadState) {
|
|
|
|
nsCOMPtr<nsIURI> uri = GetURI();
|
|
|
|
RefPtr<nsDocShellLoadState> loadState(new nsDocShellLoadState(uri));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> originalURI = GetOriginalURI();
|
|
|
|
loadState->SetOriginalURI(originalURI);
|
|
|
|
|
|
|
|
mozilla::Maybe<nsCOMPtr<nsIURI>> emplacedResultPrincipalURI;
|
|
|
|
nsCOMPtr<nsIURI> resultPrincipalURI = GetResultPrincipalURI();
|
|
|
|
emplacedResultPrincipalURI.emplace(std::move(resultPrincipalURI));
|
|
|
|
loadState->SetMaybeResultPrincipalURI(emplacedResultPrincipalURI);
|
|
|
|
|
|
|
|
loadState->SetLoadReplace(GetLoadReplace());
|
|
|
|
nsCOMPtr<nsIInputStream> postData = GetPostData();
|
|
|
|
loadState->SetPostDataStream(postData);
|
|
|
|
|
|
|
|
nsAutoCString contentType;
|
|
|
|
GetContentType(contentType);
|
|
|
|
loadState->SetTypeHint(contentType);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrincipal> triggeringPrincipal = GetTriggeringPrincipal();
|
|
|
|
loadState->SetTriggeringPrincipal(triggeringPrincipal);
|
|
|
|
nsCOMPtr<nsIPrincipal> principalToInherit = GetPrincipalToInherit();
|
|
|
|
loadState->SetPrincipalToInherit(principalToInherit);
|
2020-06-03 09:09:52 +03:00
|
|
|
nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit =
|
|
|
|
GetPartitionedPrincipalToInherit();
|
|
|
|
loadState->SetPartitionedPrincipalToInherit(partitionedPrincipalToInherit);
|
2019-03-29 22:48:59 +03:00
|
|
|
nsCOMPtr<nsIContentSecurityPolicy> csp = GetCsp();
|
|
|
|
loadState->SetCsp(csp);
|
|
|
|
nsCOMPtr<nsIReferrerInfo> referrerInfo = GetReferrerInfo();
|
|
|
|
loadState->SetReferrerInfo(referrerInfo);
|
|
|
|
|
|
|
|
// Do not inherit principal from document (security-critical!);
|
|
|
|
uint32_t flags = nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_NONE;
|
|
|
|
|
|
|
|
// Passing nullptr as aSourceDocShell gives the same behaviour as before
|
|
|
|
// aSourceDocShell was introduced. According to spec we should be passing
|
|
|
|
// the source browsing context that was used when the history entry was
|
|
|
|
// first created. bug 947716 has been created to address this issue.
|
|
|
|
nsAutoString srcdoc;
|
|
|
|
nsCOMPtr<nsIURI> baseURI;
|
|
|
|
if (GetIsSrcdocEntry()) {
|
|
|
|
GetSrcdocData(srcdoc);
|
|
|
|
baseURI = GetBaseURI();
|
|
|
|
flags |= nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_IS_SRCDOC;
|
|
|
|
} else {
|
|
|
|
srcdoc = VoidString();
|
|
|
|
}
|
|
|
|
loadState->SetSrcdocData(srcdoc);
|
|
|
|
loadState->SetBaseURI(baseURI);
|
|
|
|
loadState->SetLoadFlags(flags);
|
|
|
|
|
|
|
|
loadState->SetFirstParty(true);
|
2019-12-02 19:29:22 +03:00
|
|
|
loadState->SetSHEntry(this);
|
2019-03-29 22:48:59 +03:00
|
|
|
|
|
|
|
loadState.forget(aLoadState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
NS_IMETHODIMP_(void)
|
|
|
|
nsSHEntry::SyncTreesForSubframeNavigation(
|
|
|
|
nsISHEntry* aEntry, mozilla::dom::BrowsingContext* aTopBC,
|
|
|
|
mozilla::dom::BrowsingContext* aIgnoreBC) {
|
2020-03-10 17:28:22 +03:00
|
|
|
// We need to sync up the browsing context and session history trees for
|
|
|
|
// subframe navigation. If the load was in a subframe, we forward up to
|
|
|
|
// the top browsing context, which will then recursively sync up all browsing
|
|
|
|
// contexts to their corresponding entries in the new session history tree. If
|
|
|
|
// we don't do this, then we can cache a content viewer on the wrong cloned
|
|
|
|
// entry, and subsequently restore it at the wrong time.
|
|
|
|
nsCOMPtr<nsISHEntry> newRootEntry = nsSHistory::GetRootSHEntry(aEntry);
|
|
|
|
if (newRootEntry) {
|
|
|
|
// newRootEntry is now the new root entry.
|
|
|
|
// Find the old root entry as well.
|
|
|
|
|
|
|
|
// Need a strong ref. on |oldRootEntry| so it isn't destroyed when
|
|
|
|
// SetChildHistoryEntry() does SwapHistoryEntries() (bug 304639).
|
|
|
|
nsCOMPtr<nsISHEntry> oldRootEntry = nsSHistory::GetRootSHEntry(this);
|
|
|
|
|
|
|
|
if (oldRootEntry) {
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHistory::SwapEntriesData data = {aIgnoreBC, newRootEntry, nullptr};
|
2020-03-10 17:28:22 +03:00
|
|
|
nsSHistory::SetChildHistoryEntry(oldRootEntry, aTopBC, 0, &data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-05 17:46:10 +03:00
|
|
|
void nsSHEntry::EvictContentViewer() {
|
|
|
|
nsCOMPtr<nsIContentViewer> viewer = GetContentViewer();
|
|
|
|
if (viewer) {
|
2019-05-22 23:19:19 +03:00
|
|
|
mShared->NotifyListenersContentViewerEvicted();
|
2019-03-05 17:46:10 +03:00
|
|
|
// Drop the presentation state before destroying the viewer, so that
|
|
|
|
// document teardown is able to correctly persist the state.
|
|
|
|
SetContentViewer(nullptr);
|
|
|
|
SyncPresentationState();
|
|
|
|
viewer->Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-05 23:30:45 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSHEntry::SynchronizeLayoutHistoryState() {
|
|
|
|
// No-op on purpose. See nsISHEntry.idl
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-03-05 17:46:10 +03:00
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::SetContentViewer(nsIContentViewer* aViewer) {
|
2019-03-05 17:46:10 +03:00
|
|
|
return GetState()->SetContentViewer(aViewer);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::GetContentViewer(nsIContentViewer** aResult) {
|
2019-03-05 17:46:10 +03:00
|
|
|
*aResult = GetState()->mContentViewer;
|
|
|
|
NS_IF_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::Clone(nsISHEntry** aResult) {
|
|
|
|
nsCOMPtr<nsISHEntry> entry = new nsSHEntry(*this);
|
2019-03-05 17:46:10 +03:00
|
|
|
entry.forget(aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::GetSaveLayoutStateFlag(bool* aFlag) {
|
2019-12-05 23:30:45 +03:00
|
|
|
*aFlag = mShared->mSaveLayoutState;
|
2019-03-05 17:46:10 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::SetSaveLayoutStateFlag(bool aFlag) {
|
2019-12-05 23:30:45 +03:00
|
|
|
mShared->mSaveLayoutState = aFlag;
|
|
|
|
if (mShared->mLayoutHistoryState) {
|
|
|
|
mShared->mLayoutHistoryState->SetScrollPositionOnly(!aFlag);
|
2019-03-05 17:46:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::SetWindowState(nsISupports* aState) {
|
2019-03-05 17:46:10 +03:00
|
|
|
GetState()->mWindowState = aState;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::GetWindowState(nsISupports** aState) {
|
2019-03-05 17:46:10 +03:00
|
|
|
NS_IF_ADDREF(*aState = GetState()->mWindowState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::GetRefreshURIList(nsIMutableArray** aList) {
|
2019-03-05 17:46:10 +03:00
|
|
|
NS_IF_ADDREF(*aList = GetState()->mRefreshURIList);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::SetRefreshURIList(nsIMutableArray* aList) {
|
2019-03-05 17:46:10 +03:00
|
|
|
GetState()->mRefreshURIList = aList;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(void)
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::AddChildShell(nsIDocShellTreeItem* aShell) {
|
2019-03-05 17:46:10 +03:00
|
|
|
MOZ_ASSERT(aShell, "Null child shell added to history entry");
|
|
|
|
GetState()->mChildShells.AppendObject(aShell);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem** aShell) {
|
2019-03-05 17:46:10 +03:00
|
|
|
NS_IF_ADDREF(*aShell = GetState()->mChildShells.SafeObjectAt(aIndex));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(void)
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::ClearChildShells() { GetState()->mChildShells.Clear(); }
|
2019-03-05 17:46:10 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP_(void)
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::SyncPresentationState() { GetState()->SyncPresentationState(); }
|
2019-03-05 17:46:10 +03:00
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
nsDocShellEditorData* nsSHEntry::ForgetEditorData() {
|
2019-03-05 17:46:10 +03:00
|
|
|
// XXX jlebar Check how this is used.
|
2020-01-22 01:29:00 +03:00
|
|
|
return GetState()->mEditorData.release();
|
2019-03-05 17:46:10 +03:00
|
|
|
}
|
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
void nsSHEntry::SetEditorData(nsDocShellEditorData* aData) {
|
2019-03-05 17:46:10 +03:00
|
|
|
NS_ASSERTION(!(aData && GetState()->mEditorData),
|
|
|
|
"We're going to overwrite an owning ref!");
|
|
|
|
if (GetState()->mEditorData != aData) {
|
2020-01-22 01:29:00 +03:00
|
|
|
GetState()->mEditorData = mozilla::WrapUnique(aData);
|
2019-03-05 17:46:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
bool nsSHEntry::HasDetachedEditor() {
|
2019-03-05 17:46:10 +03:00
|
|
|
return GetState()->mEditorData != nullptr;
|
|
|
|
}
|
|
|
|
|
2020-05-20 12:09:06 +03:00
|
|
|
bool nsSHEntry::HasBFCacheEntry(nsIBFCacheEntry* aEntry) {
|
2019-03-05 17:46:10 +03:00
|
|
|
return static_cast<nsIBFCacheEntry*>(GetState()) == aEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::AbandonBFCacheEntry() {
|
|
|
|
mShared = GetState()->Duplicate();
|
2019-03-05 17:46:10 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-09-23 18:42:35 +03:00
|
|
|
NS_IMETHODIMP
|
2020-05-20 12:09:06 +03:00
|
|
|
nsSHEntry::GetBfcacheID(uint64_t* aBFCacheID) {
|
2019-09-23 18:42:35 +03:00
|
|
|
*aBFCacheID = mShared->GetID();
|
|
|
|
return NS_OK;
|
|
|
|
}
|