Bug 1110928, part 1 - Hoist the LOAD_END PokeGC out of nsJSContext::LoadEnd. r=smaug
nsDocumentViewer knows which document is involved which will help us later.
Also, fix a typo in the comment.
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1845,19 +1845,17 @@ nsJSContext::LoadEnd()
// sPendingLoadCount is not a well managed load counter (and doesn't
// need to be), so make sure we don't make it wrap backwards here.
if (sPendingLoadCount > 0) {
--sPendingLoadCount;
return;
}
- // Its probably a good idea to GC soon since we have finished loading.
sLoadingInProgress = false;
- PokeGC(JS::gcreason::LOAD_END);
}
// Only trigger expensive timers when they have been checked a number of times.
static bool
ReadyToTriggerExpensiveCollectorTimer()
{
bool ready = kPokesBetweenExpensiveCollectorTriggers < ++sExpensiveCollectorPokes;
if (ready) {
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1080,16 +1080,19 @@ nsDocumentViewer::LoadComplete(nsresult
if (mPresShell) {
mPresShell->LoadComplete();
}
}
}
nsJSContext::LoadEnd();
+ // It's probably a good idea to GC soon since we have finished loading.
+ PokeGC(JS::gcreason::LOAD_END);
+
#ifdef NS_PRINTING
// Check to see if someone tried to print during the load
if (mPrintIsPending) {
mPrintIsPending = false;
mPrintDocIsFullyLoaded = true;
Print(mCachedPrintSettings, mCachedPrintWebProgressListner);
mCachedPrintSettings = nullptr;
mCachedPrintWebProgressListner = nullptr;