diff --git a/browser/components/sessionstore/test/browser_687710_2.js b/browser/components/sessionstore/test/browser_687710_2.js index fcf8cc85f28c..4e567bff0450 100644 --- a/browser/components/sessionstore/test/browser_687710_2.js +++ b/browser/components/sessionstore/test/browser_687710_2.js @@ -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}`); diff --git a/browser/components/sessionstore/test/browser_705597.js b/browser/components/sessionstore/test/browser_705597.js index 65f7b2e0951f..c6b2b1771f09 100644 --- a/browser/components/sessionstore/test/browser_705597.js +++ b/browser/components/sessionstore/test/browser_705597.js @@ -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() { diff --git a/browser/components/sessionstore/test/browser_707862.js b/browser/components/sessionstore/test/browser_707862.js index d310a043faea..47e6cb7a6dfb 100644 --- a/browser/components/sessionstore/test/browser_707862.js +++ b/browser/components/sessionstore/test/browser_707862.js @@ -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() { diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 2f26a65e4bf2..70588b46f085 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -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 rootSH = GetRootSessionHistory(); - nsCOMPtr 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 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 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 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 shcontainer = do_QueryInterface(aEntry); RefPtr rootSH = GetRootSessionHistory(); - if (!rootSH || !shcontainer) { + if (!rootSH || !aEntry) { return; } int32_t count = 0; - shcontainer->GetChildCount(&count); + aEntry->GetChildCount(&count); AutoTArray ids; for (int32_t i = 0; i < count; ++i) { nsCOMPtr 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(this)) { // This is a subframe entry = mOSHE; - nsCOMPtr 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 child; - shContainer->GetChildAt(i, getter_AddRefs(child)); - shContainer->RemoveChild(child); + entry->GetChildAt(i, getter_AddRefs(child)); + entry->RemoveChild(child); } entry->AbandonBFCacheEntry(); } diff --git a/docshell/shistory/moz.build b/docshell/shistory/moz.build index f69e47fd04de..91fcc918a80b 100644 --- a/docshell/shistory/moz.build +++ b/docshell/shistory/moz.build @@ -6,7 +6,6 @@ XPIDL_SOURCES += [ 'nsIBFCacheEntry.idl', - 'nsISHContainer.idl', 'nsISHEntry.idl', 'nsISHistory.idl', 'nsISHistoryInternal.idl', diff --git a/docshell/shistory/nsISHContainer.idl b/docshell/shistory/nsISHContainer.idl deleted file mode 100644 index 942603d87991..000000000000 --- a/docshell/shistory/nsISHContainer.idl +++ /dev/null @@ -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); - -}; - diff --git a/docshell/shistory/nsISHEntry.idl b/docshell/shistory/nsISHEntry.idl index 6d090f64907c..6cb6e2626721 100644 --- a/docshell/shistory/nsISHEntry.idl +++ b/docshell/shistory/nsISHEntry.idl @@ -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" - %} diff --git a/docshell/shistory/nsISHistoryInternal.idl b/docshell/shistory/nsISHistoryInternal.idl index 59ed1cb35cbd..4e4ad0b391a4 100644 --- a/docshell/shistory/nsISHistoryInternal.idl +++ b/docshell/shistory/nsISHistoryInternal.idl @@ -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 diff --git a/docshell/shistory/nsSHEntry.cpp b/docshell/shistory/nsSHEntry.cpp index f0dbe1591338..b00a676bc187 100644 --- a/docshell/shistory/nsSHEntry.cpp +++ b/docshell/shistory/nsSHEntry.cpp @@ -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) diff --git a/docshell/shistory/nsSHEntry.h b/docshell/shistory/nsSHEntry.h index a40ae3ecd06d..5e0a6c360764 100644 --- a/docshell/shistory/nsSHEntry.h +++ b/docshell/shistory/nsSHEntry.h @@ -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(); diff --git a/docshell/shistory/nsSHistory.cpp b/docshell/shistory/nsSHistory.cpp index 9c0dbcfdba15..0cdbfc288021 100644 --- a/docshell/shistory/nsSHistory.cpp +++ b/docshell/shistory/nsSHistory.cpp @@ -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 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 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 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 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 destEntry; - nsCOMPtr 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 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& aDocshellIDs, bool aOnlyTopLevelDynamic) { int32_t count = 0; - aContainer->GetChildCount(&count); + aEntry->GetChildCount(&count); for (int32_t i = 0; i < count; ++i) { nsCOMPtr 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 childAsContainer = do_QueryInterface(child); - if (childAsContainer) { - GetDynamicChildren(childAsContainer, aDocshellIDs, - aOnlyTopLevelDynamic); - } + GetDynamicChildren(child, aDocshellIDs, aOnlyTopLevelDynamic); } } } } bool -RemoveFromSessionHistoryContainer(nsISHContainer* aContainer, - nsTArray& aDocshellIDs) +RemoveFromSessionHistoryEntry(nsISHEntry* aRoot, nsTArray& aDocshellIDs) { - nsCOMPtr 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 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 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& aEntryIDs) { - nsCOMPtr rootHE; - aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(rootHE)); - nsCOMPtr root = do_QueryInterface(rootHE); - return root ? RemoveFromSessionHistoryContainer(root, aEntryIDs) : false; + nsCOMPtr 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 container1 = do_QueryInterface(aEntry1); - nsCOMPtr 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 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& 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 container(aContainer); - if (!container) { - nsCOMPtr entry; + nsCOMPtr entry(aEntry); + if (!entry) { GetEntryAtIndex(aIndex, false, getter_AddRefs(entry)); - container = do_QueryInterface(entry); } - if (container) { + if (entry) { AutoTArray 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 entry; trans->GetSHEntry(getter_AddRefs(entry)); - nsCOMPtr 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 prevContainer(do_QueryInterface(aPrevEntry)); - nsCOMPtr 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 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 pChild; for (int32_t k = 0; k < pcnt; ++k) { nsCOMPtr child; - prevContainer->GetChildAt(k, getter_AddRefs(child)); + aPrevEntry->GetChildAt(k, getter_AddRefs(child)); if (child) { nsID dID = child->DocshellID(); if (dID == docshellID) { diff --git a/docshell/test/navigation/test_bug1375833.html b/docshell/test/navigation/test_bug1375833.html index 69e362451636..9e7b13a71313 100644 --- a/docshell/test/navigation/test_bug1375833.html +++ b/docshell/test/navigation/test_bug1375833.html @@ -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(); diff --git a/docshell/test/test_bug590573.html b/docshell/test/test_bug590573.html index ee93fc28c6e1..20a122ee3379 100644 --- a/docshell/test/test_bug590573.html +++ b/docshell/test/test_bug590573.html @@ -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'); diff --git a/dom/base/nsCCUncollectableMarker.cpp b/dom/base/nsCCUncollectableMarker.cpp index 120a534224fa..e936b341a074 100644 --- a/dom/base/nsCCUncollectableMarker.cpp +++ b/dom/base/nsCCUncollectableMarker.cpp @@ -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 shCont = do_QueryInterface(aSHEntry); int32_t count; - shCont->GetChildCount(&count); + aSHEntry->GetChildCount(&count); for (i = 0; i < count; ++i) { nsCOMPtr childEntry; - shCont->GetChildAt(i, getter_AddRefs(childEntry)); + aSHEntry->GetChildAt(i, getter_AddRefs(childEntry)); MarkSHEntry(childEntry, aCleanupJS); } - } void diff --git a/toolkit/modules/sessionstore/SessionHistory.jsm b/toolkit/modules/sessionstore/SessionHistory.jsm index 696ab1d43644..7254bbde6379 100644 --- a/toolkit/modules/sessionstore/SessionHistory.jsm +++ b/toolkit/modules/sessionstore/SessionHistory.jsm @@ -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)