Bug 1580565 - Part 4: Use WindowContext to manage BrowsingContext cached status, r=farre
The existing infrastructure which stored cached BrowsingContexts on the BrowsingContextGroup was added before WindowContexts were added, and can cause racing issues with partially discarded trees during process switches. Differential Revision: https://phabricator.services.mozilla.com/D71238
This commit is contained in:
@@ -7132,12 +7132,6 @@ nsresult nsDocShell::RestoreFromHistory() {
|
||||
// Order the mContentViewer setup just like Embed does.
|
||||
mContentViewer = nullptr;
|
||||
|
||||
if (!mWillChangeProcess) {
|
||||
// Move the browsing context's children to the cache. If we're
|
||||
// detaching them, we'll detach them from there.
|
||||
mBrowsingContext->CacheChildren();
|
||||
}
|
||||
|
||||
// Now that we're about to switch documents, forget all of our children.
|
||||
// Note that we cached them as needed up in CaptureState above.
|
||||
DestroyChildren();
|
||||
@@ -7256,7 +7250,6 @@ nsresult nsDocShell::RestoreFromHistory() {
|
||||
// <head> is parsed.
|
||||
document->NotifyPossibleTitleChange(false);
|
||||
|
||||
BrowsingContext::Children contexts(childShells.Count());
|
||||
// Now we simulate appending child docshells for subframes.
|
||||
for (i = 0; i < childShells.Count(); ++i) {
|
||||
nsIDocShellTreeItem* childItem = childShells.ObjectAt(i);
|
||||
@@ -7293,8 +7286,6 @@ nsresult nsDocShell::RestoreFromHistory() {
|
||||
// child inherits our mPrivateBrowsingId, which is what we want.
|
||||
AddChild(childItem);
|
||||
|
||||
contexts.AppendElement(childShell->GetBrowsingContext());
|
||||
|
||||
childShell->SetAllowJavascript(allowJavascript);
|
||||
childShell->SetAllowMetaRedirects(allowRedirects);
|
||||
childShell->SetAllowSubframes(allowSubframes);
|
||||
@@ -7310,10 +7301,6 @@ nsresult nsDocShell::RestoreFromHistory() {
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (!contexts.IsEmpty()) {
|
||||
mBrowsingContext->RestoreChildren(std::move(contexts));
|
||||
}
|
||||
|
||||
// Make sure to restore the window state after adding the child shells back
|
||||
// to the tree. This is necessary for Thaw() and Resume() to propagate
|
||||
// properly.
|
||||
@@ -7866,10 +7853,6 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer,
|
||||
|
||||
mContentViewer = nullptr;
|
||||
|
||||
// Move the browsing ontext's children to the cache. If we're
|
||||
// detaching them, we'll detach them from there.
|
||||
mBrowsingContext->CacheChildren();
|
||||
|
||||
// Now that we're about to switch documents, forget all of our children.
|
||||
// Note that we cached them as needed up in CaptureState above.
|
||||
DestroyChildren();
|
||||
|
||||
Reference in New Issue
Block a user