bug 842078 - fix iteration of mChildrenList r=smaug
This commit is contained in:
@@ -872,9 +872,9 @@ void
|
||||
nsDocShell::DestroyChildren()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> shell;
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
shell = do_QueryObject(iter.GetNext());
|
||||
NS_ASSERTION(shell, "docshell has null child");
|
||||
|
||||
if (shell) {
|
||||
@@ -2080,9 +2080,9 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t count = mChildList.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsILoadContext> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsILoadContext> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell) {
|
||||
shell->SetPrivateBrowsing(aUsePrivateBrowsing);
|
||||
}
|
||||
@@ -2116,9 +2116,9 @@ nsDocShell::SetAffectPrivateSessionLifetime(bool aAffectLifetime)
|
||||
}
|
||||
mAffectPrivateSessionLifetime = aAffectLifetime;
|
||||
|
||||
uint32_t count = mChildList.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell) {
|
||||
shell->SetAffectPrivateSessionLifetime(aAffectLifetime);
|
||||
}
|
||||
@@ -2488,9 +2488,9 @@ nsDocShell::HistoryPurged(int32_t aNumEntries)
|
||||
mPreviousTransIndex = std::max(-1, mPreviousTransIndex - aNumEntries);
|
||||
mLoadedTransIndex = std::max(0, mLoadedTransIndex - aNumEntries);
|
||||
|
||||
uint32_t count = mChildList.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell) {
|
||||
shell->HistoryPurged(aNumEntries);
|
||||
}
|
||||
@@ -2518,9 +2518,9 @@ nsDocShell::HistoryTransactionRemoved(int32_t aIndex)
|
||||
--mLoadedTransIndex;
|
||||
}
|
||||
|
||||
uint32_t count = mChildList.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell) {
|
||||
static_cast<nsDocShell*>(shell.get())->
|
||||
HistoryTransactionRemoved(aIndex);
|
||||
@@ -3403,9 +3403,9 @@ nsDocShell::SetTreeOwner(nsIDocShellTreeOwner * aTreeOwner)
|
||||
|
||||
mTreeOwner = aTreeOwner; // Weak reference per API
|
||||
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||
int32_t childType = ~mItemType; // Set it to not us in case the get fails
|
||||
child->GetItemType(&childType); // We don't care if this fails, if it does we won't set the owner
|
||||
@@ -3602,7 +3602,7 @@ nsDocShell::GetChildAt(int32_t aIndex, nsIDocShellTreeItem ** aChild)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIDocumentLoader* child = SafeChildAt(aIndex);
|
||||
nsIDocumentLoader* child = ChildAt(aIndex);
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_UNEXPECTED);
|
||||
|
||||
return CallQueryInterface(child, aChild);
|
||||
@@ -3624,9 +3624,9 @@ nsDocShell::FindChildWithName(const PRUnichar * aName,
|
||||
return NS_OK;
|
||||
|
||||
nsXPIDLString childName;
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||
int32_t childType;
|
||||
child->GetItemType(&childType);
|
||||
@@ -4676,9 +4676,9 @@ nsDocShell::Stop(uint32_t aStopFlags)
|
||||
Stop();
|
||||
}
|
||||
|
||||
uint32_t count = mChildList.Length();
|
||||
for (uint32_t n = 0; n < count; n++) {
|
||||
nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryInterface(ChildAt(n)));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIWebNavigation> shellAsNav(do_QueryObject(iter.GetNext()));
|
||||
if (shellAsNav)
|
||||
shellAsNav->Stop(aStopFlags);
|
||||
}
|
||||
@@ -5290,9 +5290,9 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||
|
||||
// Recursively tell all of our children, but don't tell <iframe mozbrowser>
|
||||
// children; they handle their state separately.
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> docshell = do_QueryObject(iter.GetNext());
|
||||
if (!docshell) {
|
||||
continue;
|
||||
}
|
||||
@@ -6213,9 +6213,9 @@ nsDocShell::SuspendRefreshURIs()
|
||||
}
|
||||
|
||||
// Suspend refresh URIs for our child shells as well.
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell)
|
||||
shell->SuspendRefreshURIs();
|
||||
}
|
||||
@@ -6229,9 +6229,9 @@ nsDocShell::ResumeRefreshURIs()
|
||||
RefreshURIFromQueue();
|
||||
|
||||
// Resume refresh URIs for our child shells as well.
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryObject(iter.GetNext());
|
||||
if (shell)
|
||||
shell->ResumeRefreshURIs();
|
||||
}
|
||||
@@ -7276,9 +7276,9 @@ nsDocShell::BeginRestore(nsIContentViewer *aContentViewer, bool aTop)
|
||||
nsresult
|
||||
nsDocShell::BeginRestoreChildren()
|
||||
{
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
|
||||
if (child) {
|
||||
nsresult rv = child->BeginRestore(nullptr, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -7293,9 +7293,9 @@ nsDocShell::FinishRestore()
|
||||
// First we call finishRestore() on our children. In the simulated load,
|
||||
// all of the child frames finish loading before the main document.
|
||||
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
|
||||
if (child) {
|
||||
child->FinishRestore();
|
||||
}
|
||||
@@ -7798,9 +7798,9 @@ nsDocShell::RestoreFromHistory()
|
||||
|
||||
// Meta-refresh timers have been restarted for this shell, but not
|
||||
// for our children. Walk the child shells and restart their timers.
|
||||
uint32_t n = mChildList.Length();
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIDocShell> child = do_QueryObject(iter.GetNext());
|
||||
if (child)
|
||||
child->ResumeRefreshURIs();
|
||||
}
|
||||
@@ -10811,10 +10811,9 @@ nsDocShell::WalkHistoryEntries(nsISHEntry *aRootEntry,
|
||||
// Walk the children of aRootShell and see if one of them
|
||||
// has srcChild as a SHEntry.
|
||||
|
||||
uint32_t childCount = aRootShell->mChildList.Length();
|
||||
for (uint32_t j = 0; j < childCount; ++j) {
|
||||
nsDocShell *child =
|
||||
static_cast<nsDocShell*>(aRootShell->ChildAt(j));
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(aRootShell->mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsDocShell *child = static_cast<nsDocShell*>(iter.GetNext());
|
||||
|
||||
if (child->HasHistoryEntry(childEntry)) {
|
||||
childShell = child;
|
||||
|
||||
Reference in New Issue
Block a user