Bug 1485279 - Merge nsISHContainer into nsISHEntry. r=qdot

nsSHEntry is the only class that instantiates those two interfaces, so the
separation is not useful. This lets us remove numerous pointless QIs.

--HG--
extra : rebase_source : 570b7ade669fb89a789184198bec9da186c5f1d3
This commit is contained in:
Nicholas Nethercote 2018-08-22 19:20:56 +10:00
Родитель d596237589
Коммит 8cb0711355
15 изменённых файлов: 99 добавлений и 188 удалений

Просмотреть файл

@ -30,13 +30,8 @@ add_task(async function test() {
await promiseTabState(tab, state);
await ContentTask.spawn(tab.linkedBrowser, null, function() {
function compareEntries(i, j, history) {
let e1 = history.getEntryAtIndex(i, false)
.QueryInterface(Ci.nsISHEntry)
.QueryInterface(Ci.nsISHContainer);
let e2 = history.getEntryAtIndex(j, false)
.QueryInterface(Ci.nsISHEntry)
.QueryInterface(Ci.nsISHContainer);
let e1 = history.getEntryAtIndex(i, false);
let e2 = history.getEntryAtIndex(j, false);
ok(e1.sharesDocumentWith(e2),
`${i} should share doc with ${j}`);

Просмотреть файл

@ -25,7 +25,6 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {
whenChildCount(entry, 2, function() {

Просмотреть файл

@ -25,7 +25,6 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {
whenChildCount(entry, 2, function() {

Просмотреть файл

@ -117,7 +117,6 @@
#include "nsISecurityUITelemetry.h"
#include "nsISeekableStream.h"
#include "nsISelectionDisplay.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
@ -1069,10 +1068,9 @@ nsDocShell::FirePageHideNotificationInternal(bool aIsUnload,
// If the document is unloading, remove all dynamic subframe entries.
if (aIsUnload && !aSkipCheckingDynEntries) {
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mOSHE));
if (rootSH && container) {
if (rootSH && mOSHE) {
int32_t index = rootSH->Index();
rootSH->LegacySHistoryInternal()->RemoveDynEntries(index, container);
rootSH->LegacySHistoryInternal()->RemoveDynEntries(index, mOSHE);
}
}
@ -3729,13 +3727,10 @@ nsDocShell::GetChildSHEntry(int32_t aChildOffset, nsISHEntry** aResult)
return rv;
}
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mLSHE));
if (container) {
// Get the child subframe from session history.
rv = container->GetChildAt(aChildOffset, aResult);
if (*aResult) {
(*aResult)->SetLoadType(loadType);
}
// Get the child subframe from session history.
rv = mLSHE->GetChildAt(aChildOffset, aResult);
if (*aResult) {
(*aResult)->SetLoadType(loadType);
}
}
return rv;
@ -3752,17 +3747,13 @@ nsDocShell::AddChildSHEntry(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
/* You get here if you are currently building a
* hierarchy ie.,you just visited a frameset page
*/
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mLSHE, &rv));
if (container) {
if (NS_FAILED(container->ReplaceChild(aNewEntry))) {
rv = container->AddChild(aNewEntry, aChildOffset);
}
if (NS_FAILED(mLSHE->ReplaceChild(aNewEntry))) {
rv = mLSHE->AddChild(aNewEntry, aChildOffset);
}
} else if (!aCloneRef) {
/* This is an initial load in some subframe. Just append it if we can */
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mOSHE, &rv));
if (container) {
rv = container->AddChild(aNewEntry, aChildOffset);
if (mOSHE) {
rv = mOSHE->AddChild(aNewEntry, aChildOffset);
}
} else {
rv = AddChildSHEntryInternal(aCloneRef, aNewEntry, aChildOffset,
@ -3997,18 +3988,17 @@ nsDocShell::GetDeviceSizeIsPageSize(bool* aValue)
void
nsDocShell::ClearFrameHistory(nsISHEntry* aEntry)
{
nsCOMPtr<nsISHContainer> shcontainer = do_QueryInterface(aEntry);
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (!rootSH || !shcontainer) {
if (!rootSH || !aEntry) {
return;
}
int32_t count = 0;
shcontainer->GetChildCount(&count);
aEntry->GetChildCount(&count);
AutoTArray<nsID, 16> ids;
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child;
shcontainer->GetChildAt(i, getter_AddRefs(child));
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
ids.AppendElement(child->DocshellID());
}
@ -12044,15 +12034,14 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
root != static_cast<nsIDocShellTreeItem*>(this)) {
// This is a subframe
entry = mOSHE;
nsCOMPtr<nsISHContainer> shContainer(do_QueryInterface(entry));
if (shContainer) {
if (entry) {
int32_t childCount = 0;
shContainer->GetChildCount(&childCount);
entry->GetChildCount(&childCount);
// Remove all children of this entry
for (int32_t i = childCount - 1; i >= 0; i--) {
nsCOMPtr<nsISHEntry> child;
shContainer->GetChildAt(i, getter_AddRefs(child));
shContainer->RemoveChild(child);
entry->GetChildAt(i, getter_AddRefs(child));
entry->RemoveChild(child);
}
entry->AbandonBFCacheEntry();
}

Просмотреть файл

@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsIBFCacheEntry.idl',
'nsISHContainer.idl',
'nsISHEntry.idl',
'nsISHistory.idl',
'nsISHistoryInternal.idl',

Просмотреть файл

@ -1,49 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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/. */
#include "nsISupports.idl"
interface nsISHEntry;
/**
* The nsISHEntryContainer. The interface to access child entries
* of an nsISHEntry.
*
*/
[scriptable, uuid(67dd0357-8372-4122-bff6-217435e8b7e4)]
interface nsISHContainer : nsISupports
{
/**
* The current number of nsISHEntries which are immediate children of the
* current SHEntry
*/
readonly attribute long childCount;
/**
* Add a new child SHEntry. If offset is -1 adds to the end of the list.
*/
void AddChild(in nsISHEntry child, in long offset);
/**
* Removes a child SHEntry
*/
void RemoveChild(in nsISHEntry child);
/**
* Get child at an index
*/
nsISHEntry GetChildAt(in long index);
/**
* Replaces a child which is for the same docshell as aNewChild
* with aNewChild.
* @throw if nothing was replaced.
*/
void ReplaceChild(in nsISHEntry aNewChild);
};

Просмотреть файл

@ -4,10 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* The interface to nsISHentry. Each document or subframe in
* The interface to nsISHentry. Each document or subframe in
* Session History will have a nsISHEntry associated with it which will
* hold all information required to recreate the document from history
*
*/
#include "nsISupports.idl"
@ -180,7 +179,7 @@ interface nsISHEntry : nsISupports
* attribute to indicate the content-type of the document that this
* is a session history entry for
*/
attribute ACString contentType;
attribute ACString contentType;
/**
* If we created this SHEntry via history.pushState or modified it via
@ -194,7 +193,7 @@ interface nsISHEntry : nsISupports
*
*/
attribute boolean URIWasModified;
/** Set/Get scrollers' positon in anchored pages */
void setScrollPosition(in long x, in long y);
void getScrollPosition(out long x, out long y);
@ -373,6 +372,34 @@ interface nsISHEntry : nsISupports
*/
[noscript, notxpcom]
nsSHEntryShared getSharedState();
/**
* The current number of nsISHEntries which are immediate children of this
* SHEntry.
*/
readonly attribute long childCount;
/**
* Add a new child SHEntry. If offset is -1 adds to the end of the list.
*/
void AddChild(in nsISHEntry aChild, in long aOffset);
/**
* Remove a child SHEntry.
*/
void RemoveChild(in nsISHEntry aChild);
/**
* Get child at an index.
*/
nsISHEntry GetChildAt(in long aIndex);
/**
* Replaces a child which is for the same docshell as aNewChild
* with aNewChild.
* @throw if nothing was replaced.
*/
void ReplaceChild(in nsISHEntry aNewChild);
};
%{ C++
@ -382,6 +409,5 @@ interface nsISHEntry : nsISupports
#define NS_SHENTRY_CONTRACTID \
"@mozilla.org/browser/session-history-entry;1"
%}

Просмотреть файл

@ -6,7 +6,6 @@
#include "nsISupports.idl"
interface nsIBFCacheEntry;
interface nsISHContainer;
interface nsISHEntry;
interface nsISHistoryListener;
interface nsISHTransaction;
@ -106,13 +105,13 @@ interface nsISHistoryInternal: nsISupports
* @param aIndex
* Index to remove dynamic entries from. It will be passed to
* RemoveEntries as aStartIndex.
* @param aContainer (optional)
* The container to start looking for dynamic entries. Only the
* dynamic descendants of the container will be removed. If not given,
* @param aEntry (optional)
* The entry to start looking in for dynamic entries. Only the
* dynamic descendants of the entry will be removed. If not given,
* all dynamic entries at the index will be removed.
*/
[noscript, notxpcom] void RemoveDynEntries(in long aIndex,
in nsISHContainer aContainer);
in nsISHEntry aEntry);
/**
* Similar to RemoveDynEntries, but instead of specifying an index, use the

Просмотреть файл

@ -76,7 +76,7 @@ nsSHEntry::~nsSHEntry()
}
}
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHContainer, nsISHEntry)
NS_IMPL_ISUPPORTS(nsSHEntry, nsISHEntry)
NS_IMETHODIMP
nsSHEntry::SetScrollPosition(int32_t aX, int32_t aY)

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsString.h"
@ -19,8 +18,7 @@ class nsSHEntryShared;
class nsIInputStream;
class nsIURI;
class nsSHEntry final : public nsISHEntry,
public nsISHContainer
class nsSHEntry final : public nsISHEntry
{
public:
nsSHEntry();
@ -28,7 +26,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISHENTRY
NS_DECL_NSISHCONTAINER
void DropPresentationState();

Просмотреть файл

@ -17,7 +17,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsILayoutHistoryState.h"
#include "nsIObserverService.h"
#include "nsISHContainer.h"
#include "nsISHEntry.h"
#include "nsISHistoryListener.h"
#include "nsISHTransaction.h"
@ -233,8 +232,7 @@ nsSHistory::EvictContentViewerForTransaction(nsISHTransaction* aTrans)
int32_t index = -1;
GetIndexOfEntry(entry, &index);
if (index != -1) {
nsCOMPtr<nsISHContainer> container(do_QueryInterface(entry));
RemoveDynEntries(index, container);
RemoveDynEntries(index, entry);
}
}
@ -419,16 +417,11 @@ nsSHistory::WalkHistoryEntries(nsISHEntry* aRootEntry,
{
NS_ENSURE_TRUE(aRootEntry, NS_ERROR_FAILURE);
nsCOMPtr<nsISHContainer> container(do_QueryInterface(aRootEntry));
if (!container) {
return NS_ERROR_FAILURE;
}
int32_t childCount;
container->GetChildCount(&childCount);
aRootEntry->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; i++) {
nsCOMPtr<nsISHEntry> childEntry;
container->GetChildAt(i, getter_AddRefs(childEntry));
aRootEntry->GetChildAt(i, getter_AddRefs(childEntry));
if (!childEntry) {
// childEntry can be null for valid reasons, for example if the
// docshell at index i never loaded anything useful.
@ -493,10 +486,9 @@ nsSHistory::CloneAndReplaceChild(nsISHEntry* aEntry,
uint32_t cloneID = data->cloneID;
nsISHEntry* replaceEntry = data->replaceEntry;
nsCOMPtr<nsISHContainer> container = do_QueryInterface(data->destTreeParent);
if (!aEntry) {
if (container) {
container->AddChild(nullptr, aEntryIndex);
if (data->destTreeParent) {
data->destTreeParent->AddChild(nullptr, aEntryIndex);
}
return NS_OK;
}
@ -528,8 +520,8 @@ nsSHistory::CloneAndReplaceChild(nsISHEntry* aEntry,
aShell->SwapHistoryEntries(aEntry, dest);
}
if (container) {
container->AddChild(dest, aEntryIndex);
if (data->destTreeParent) {
data->destTreeParent->AddChild(dest, aEntryIndex);
}
data->resultEntry = dest;
@ -570,9 +562,8 @@ nsSHistory::SetChildHistoryEntry(nsISHEntry* aEntry, nsDocShell* aShell,
nsISHEntry* destTreeRoot = data->destTreeRoot;
nsCOMPtr<nsISHEntry> destEntry;
nsCOMPtr<nsISHContainer> container = do_QueryInterface(data->destTreeParent);
if (container) {
if (data->destTreeParent) {
// aEntry is a clone of some child of destTreeParent, but since the
// trees aren't necessarily in sync, we'll have to locate it.
// Note that we could set aShell's entry to null if we don't find a
@ -583,14 +574,14 @@ nsSHistory::SetChildHistoryEntry(nsISHEntry* aEntry, nsDocShell* aShell,
// First look at the given index, since this is the common case.
nsCOMPtr<nsISHEntry> entry;
container->GetChildAt(aEntryIndex, getter_AddRefs(entry));
data->destTreeParent->GetChildAt(aEntryIndex, getter_AddRefs(entry));
if (entry && NS_SUCCEEDED(entry->GetID(&id)) && id == targetID) {
destEntry.swap(entry);
} else {
int32_t childCount;
container->GetChildCount(&childCount);
data->destTreeParent->GetChildCount(&childCount);
for (int32_t i = 0; i < childCount; ++i) {
container->GetChildAt(i, getter_AddRefs(entry));
data->destTreeParent->GetChildAt(i, getter_AddRefs(entry));
if (!entry) {
continue;
}
@ -1521,15 +1512,15 @@ nsSHistory::GloballyEvictAllContentViewers()
}
void
GetDynamicChildren(nsISHContainer* aContainer,
GetDynamicChildren(nsISHEntry* aEntry,
nsTArray<nsID>& aDocshellIDs,
bool aOnlyTopLevelDynamic)
{
int32_t count = 0;
aContainer->GetChildCount(&count);
aEntry->GetChildCount(&count);
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child;
aContainer->GetChildAt(i, getter_AddRefs(child));
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
bool dynAdded = false;
child->IsDynamicallyAdded(&dynAdded);
@ -1538,42 +1529,30 @@ GetDynamicChildren(nsISHContainer* aContainer,
aDocshellIDs.AppendElement(docshellID);
}
if (!dynAdded || !aOnlyTopLevelDynamic) {
nsCOMPtr<nsISHContainer> childAsContainer = do_QueryInterface(child);
if (childAsContainer) {
GetDynamicChildren(childAsContainer, aDocshellIDs,
aOnlyTopLevelDynamic);
}
GetDynamicChildren(child, aDocshellIDs, aOnlyTopLevelDynamic);
}
}
}
}
bool
RemoveFromSessionHistoryContainer(nsISHContainer* aContainer,
nsTArray<nsID>& aDocshellIDs)
RemoveFromSessionHistoryEntry(nsISHEntry* aRoot, nsTArray<nsID>& aDocshellIDs)
{
nsCOMPtr<nsISHEntry> root = do_QueryInterface(aContainer);
NS_ENSURE_TRUE(root, false);
bool didRemove = false;
int32_t childCount = 0;
aContainer->GetChildCount(&childCount);
aRoot->GetChildCount(&childCount);
for (int32_t i = childCount - 1; i >= 0; --i) {
nsCOMPtr<nsISHEntry> child;
aContainer->GetChildAt(i, getter_AddRefs(child));
aRoot->GetChildAt(i, getter_AddRefs(child));
if (child) {
nsID docshelldID = child->DocshellID();
if (aDocshellIDs.Contains(docshelldID)) {
didRemove = true;
aContainer->RemoveChild(child);
aRoot->RemoveChild(child);
} else {
nsCOMPtr<nsISHContainer> container = do_QueryInterface(child);
if (container) {
bool childRemoved =
RemoveFromSessionHistoryContainer(container, aDocshellIDs);
if (childRemoved) {
didRemove = true;
}
bool childRemoved = RemoveFromSessionHistoryEntry(child, aDocshellIDs);
if (childRemoved) {
didRemove = true;
}
}
}
@ -1585,10 +1564,9 @@ bool
RemoveChildEntries(nsISHistory* aHistory, int32_t aIndex,
nsTArray<nsID>& aEntryIDs)
{
nsCOMPtr<nsISHEntry> rootHE;
aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(rootHE));
nsCOMPtr<nsISHContainer> root = do_QueryInterface(rootHE);
return root ? RemoveFromSessionHistoryContainer(root, aEntryIDs) : false;
nsCOMPtr<nsISHEntry> root;
aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(root));
return root ? RemoveFromSessionHistoryEntry(root, aEntryIDs) : false;
}
bool
@ -1607,17 +1585,15 @@ IsSameTree(nsISHEntry* aEntry1, nsISHEntry* aEntry2)
return false;
}
nsCOMPtr<nsISHContainer> container1 = do_QueryInterface(aEntry1);
nsCOMPtr<nsISHContainer> container2 = do_QueryInterface(aEntry2);
int32_t count1, count2;
container1->GetChildCount(&count1);
container2->GetChildCount(&count2);
aEntry1->GetChildCount(&count1);
aEntry2->GetChildCount(&count2);
// We allow null entries in the end of the child list.
int32_t count = std::max(count1, count2);
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child1, child2;
container1->GetChildAt(i, getter_AddRefs(child1));
container2->GetChildAt(i, getter_AddRefs(child2));
aEntry1->GetChildAt(i, getter_AddRefs(child1));
aEntry2->GetChildAt(i, getter_AddRefs(child2));
if (!IsSameTree(child1, child2)) {
return false;
}
@ -1722,19 +1698,17 @@ nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex)
}
void
nsSHistory::RemoveDynEntries(int32_t aIndex, nsISHContainer* aContainer)
nsSHistory::RemoveDynEntries(int32_t aIndex, nsISHEntry* aEntry)
{
// Remove dynamic entries which are at the index and belongs to the container.
nsCOMPtr<nsISHContainer> container(aContainer);
if (!container) {
nsCOMPtr<nsISHEntry> entry;
nsCOMPtr<nsISHEntry> entry(aEntry);
if (!entry) {
GetEntryAtIndex(aIndex, false, getter_AddRefs(entry));
container = do_QueryInterface(entry);
}
if (container) {
if (entry) {
AutoTArray<nsID, 16> toBeRemovedEntries;
GetDynamicChildren(container, toBeRemovedEntries, true);
GetDynamicChildren(entry, toBeRemovedEntries, true);
if (toBeRemovedEntries.Length()) {
RemoveEntries(toBeRemovedEntries, aIndex);
}
@ -1750,8 +1724,7 @@ nsSHistory::RemoveDynEntriesForBFCacheEntry(nsIBFCacheEntry* aEntry)
if (trans) {
nsCOMPtr<nsISHEntry> entry;
trans->GetSHEntry(getter_AddRefs(entry));
nsCOMPtr<nsISHContainer> container(do_QueryInterface(entry));
RemoveDynEntries(index, container);
RemoveDynEntries(index, entry);
}
}
@ -1967,15 +1940,9 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
int32_t pcnt = 0;
int32_t ncnt = 0;
int32_t dsCount = 0;
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
if (!prevContainer || !nextContainer) {
return NS_ERROR_FAILURE;
}
prevContainer->GetChildCount(&pcnt);
nextContainer->GetChildCount(&ncnt);
aPrevEntry->GetChildCount(&pcnt);
aNextEntry->GetChildCount(&ncnt);
aParent->GetChildCount(&dsCount);
// Create an array for child docshells.
@ -1993,7 +1960,7 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
for (int32_t i = 0; i < ncnt; ++i) {
// First get an entry which may cause a new page to be loaded.
nsCOMPtr<nsISHEntry> nChild;
nextContainer->GetChildAt(i, getter_AddRefs(nChild));
aNextEntry->GetChildAt(i, getter_AddRefs(nChild));
if (!nChild) {
continue;
}
@ -2019,7 +1986,7 @@ nsSHistory::LoadDifferingEntries(nsISHEntry* aPrevEntry, nsISHEntry* aNextEntry,
nsCOMPtr<nsISHEntry> pChild;
for (int32_t k = 0; k < pcnt; ++k) {
nsCOMPtr<nsISHEntry> child;
prevContainer->GetChildAt(k, getter_AddRefs(child));
aPrevEntry->GetChildAt(k, getter_AddRefs(child));
if (child) {
nsID dID = child->DocshellID();
if (dID == docshellID) {

Просмотреть файл

@ -50,9 +50,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1375833
is(newFrameDocShellId, frameDocShellId, "check docshell ID remains after reload");
let entry = shistory.legacySHistory.getEntryAtIndex(shistory.index, false);
let frameEntry = SpecialPowers.wrap(entry)
.QueryInterface(SpecialPowers.Ci.nsISHContainer)
.GetChildAt(0);
let frameEntry = entry.GetChildAt(0);
is(String(frameEntry.docshellID), frameDocShellId, "check newly added shentry uses the same docshell ID");
webNav.goBack();

Просмотреть файл

@ -111,7 +111,6 @@ function dumpSHistory(theWindow)
for (let i = 0; i < sh.count; i++) {
let shentry = sh.legacySHistory.getEntryAtIndex(i, false);
dump(" " + i + ": " + shentry.URI.spec + '\n');
shentry.QueryInterface(SpecialPowers.Ci.nsISHContainer);
for (let j = 0; j < shentry.childCount; j++) {
let child = shentry.GetChildAt(j);
dump(" child " + j + ": " + child.URI.spec + '\n');

Просмотреть файл

@ -17,7 +17,6 @@
#include "nsIWebNavigation.h"
#include "nsISHistory.h"
#include "nsISHEntry.h"
#include "nsISHContainer.h"
#include "nsIWindowWatcher.h"
#include "mozilla/Services.h"
#include "nsIXULWindow.h"
@ -233,15 +232,13 @@ MarkSHEntry(nsISHEntry* aSHEntry, bool aCleanupJS)
MarkDocShell(child, aCleanupJS);
}
nsCOMPtr<nsISHContainer> shCont = do_QueryInterface(aSHEntry);
int32_t count;
shCont->GetChildCount(&count);
aSHEntry->GetChildCount(&count);
for (i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> childEntry;
shCont->GetChildAt(i, getter_AddRefs(childEntry));
aSHEntry->GetChildAt(i, getter_AddRefs(childEntry));
MarkSHEntry(childEntry, aCleanupJS);
}
}
void

Просмотреть файл

@ -228,10 +228,6 @@ var SessionHistoryInternal = {
entry.structuredCloneVersion = shEntry.stateData.formatVersion;
}
if (!(shEntry instanceof Ci.nsISHContainer)) {
return entry;
}
if (shEntry.childCount > 0 && !shEntry.hasDynamicallyAddedChild()) {
let children = [];
for (let i = 0; i < shEntry.childCount; i++) {
@ -457,7 +453,7 @@ var SessionHistoryInternal = {
shEntry.principalToInherit = Utils.deserializePrincipal(entry.principalToInherit_base64);
}
if (entry.children && shEntry instanceof Ci.nsISHContainer) {
if (entry.children) {
for (var i = 0; i < entry.children.length; i++) {
// XXXzpao Wallpaper patch for bug 514751
if (!entry.children[i].url)