Bug 1382079 - Backed out changeset 5fc778386eb1 (
Bug 1379762 part 3). r?bz
Revert "
Bug 1379762 part 3. Don't mess about with load blockers if our document is already in the COMPLETE readyState. r=smaug"
This reverts commit 942614f701b47b4a650a0ec3d206d6c5921aba84.
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -8805,21 +8805,18 @@ void
nsDocument::BlockOnload()
{
if (mDisplayDocument) {
mDisplayDocument->BlockOnload();
return;
}
// If mScriptGlobalObject is null, we shouldn't be messing with the loadgroup
- // -- it's not ours. Also, if we're already in the COMPLETE state, that means
- // we already had our load event, conceptually, so there's no more need to
- // mess about with the load blocker.
- if (mOnloadBlockCount == 0 && mScriptGlobalObject &&
- GetReadyStateEnum() != READYSTATE_COMPLETE) {
+ // -- it's not ours.
+ if (mOnloadBlockCount == 0 && mScriptGlobalObject) {
if (!nsContentUtils::IsSafeToRunScript()) {
// Because AddRequest may lead to OnStateChange calls in chrome,
// block onload only when there are no script blockers.
++mAsyncOnloadBlockCount;
if (mAsyncOnloadBlockCount == 1) {
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"nsDocument::AsyncBlockOnload", this, &nsDocument::AsyncBlockOnload));
}