Bug 1493225, part 3 - Cancel content JS when navigating through history to prevent hangs r=smaug

This patch adds an ID to ensure that we avoid canceling content JS if the next
page already started loading by the time we're ready to try canceling the JS.

Differential Revision: https://phabricator.services.mozilla.com/D25164
This commit is contained in:
Jim Porter
2019-04-30 23:31:46 +00:00
parent eafb9f212e
commit 03e7e5e497
9 changed files with 75 additions and 26 deletions

View File

@@ -667,6 +667,16 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink) {
return *aSink ? NS_OK : NS_NOINTERFACE;
}
NS_IMETHODIMP
nsDocShell::SetCancelContentJSEpoch(int32_t aEpoch) {
// Note: this gets called fairly early (before a pageload actually starts).
// We could probably defer this even longer.
nsCOMPtr<nsIBrowserChild> browserChild = GetBrowserChild();
static_cast<BrowserChild*>(browserChild.get())
->SetCancelContentJSEpoch(aEpoch);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
MOZ_ASSERT(aLoadState, "Must have a valid load state!");