зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1420743 P1 Do a better job of clearing docshell's mInitialClientSource at the end of page load. r=baku
This commit is contained in:
Родитель
9e12def723
Коммит
e9bc23f889
|
@ -7801,6 +7801,11 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Make sure to discard the initial client if we never created the initial
|
||||
// about:blank document. Do this before possibly returning from the method
|
||||
// due to an error.
|
||||
mInitialClientSource.reset();
|
||||
|
||||
nsCOMPtr<nsIConsoleReportCollector> reporter = do_QueryInterface(aChannel);
|
||||
if (reporter) {
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
|
@ -7836,10 +7841,6 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
// Timing is picked up by the window, we don't need it anymore
|
||||
mTiming = nullptr;
|
||||
|
||||
// Make sure to discard the initial client if we never created the initial
|
||||
// about:blank document.
|
||||
mInitialClientSource.reset();
|
||||
|
||||
// clean up reload state for meta charset
|
||||
if (eCharsetReloadRequested == mCharsetReloadState) {
|
||||
mCharsetReloadState = eCharsetReloadStopOrigional;
|
||||
|
@ -11835,6 +11836,11 @@ nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
|||
openFlags |= nsIURILoader::DONT_RETARGET;
|
||||
}
|
||||
|
||||
// If anything fails here, make sure to clear our initial ClientSource.
|
||||
auto cleanupInitialClient = MakeScopeExit([&] {
|
||||
mInitialClientSource.reset();
|
||||
});
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -11860,6 +11866,9 @@ nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
|||
// collector slice
|
||||
nsJSContext::MaybeRunNextCollectorSlice(this, JS::gcreason::DOCSHELL);
|
||||
|
||||
// Success. Keep the initial ClientSource if it exists.
|
||||
cleanupInitialClient.release();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1749,6 +1749,14 @@ nsGlobalWindowInner::EnsureClientSource()
|
|||
nsCOMPtr<nsIChannel> channel = mDoc->GetChannel();
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel ? channel->GetLoadInfo() : nullptr;
|
||||
|
||||
// Take the initial client source from the docshell immediately. Even if we
|
||||
// don't end up using it here we should consume it.
|
||||
UniquePtr<ClientSource> initialClientSource;
|
||||
nsIDocShell* docshell = GetDocShell();
|
||||
if (docshell) {
|
||||
initialClientSource = docshell->TakeInitialClientSource();
|
||||
}
|
||||
|
||||
// Try to get the reserved client from the LoadInfo. A Client is
|
||||
// reserved at the start of the channel load if there is not an
|
||||
// initial about:blank document that will be reused. It is also
|
||||
|
@ -1769,12 +1777,9 @@ nsGlobalWindowInner::EnsureClientSource()
|
|||
// and it created an initial Client as a placeholder for the document.
|
||||
// In this case we want to inherit this placeholder Client here.
|
||||
if (!mClientSource) {
|
||||
nsIDocShell* docshell = GetDocShell();
|
||||
if (docshell) {
|
||||
mClientSource = docshell->TakeInitialClientSource();
|
||||
if (mClientSource) {
|
||||
newClientSource = true;
|
||||
}
|
||||
mClientSource = Move(initialClientSource);
|
||||
if (mClientSource) {
|
||||
newClientSource = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче