Bug 635844 part 1: Back out bug 615501 since we'll no longer fire the "initial popstate" event, and thus don't need a way to differentiate it. r=jlebar a=beltzner

This commit is contained in:
Jonas Sicking
2011-02-28 23:08:56 -08:00
parent fd15686c30
commit 96ca0dec0a
19 changed files with 21 additions and 356 deletions

View File

@@ -6077,27 +6077,7 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
SetDocCurrentStateObj(mLSHE);
mIsExecutingOnLoadHandler = PR_TRUE;
rv = mContentViewer->LoadComplete(aStatus);
// If the load wasn't stopped during LoadComplete, fire the popstate
// event, if we're not suppressing it.
if (NS_SUCCEEDED(rv) && rv != NS_SUCCESS_LOAD_STOPPED &&
!mSuppressPopstate) {
// XXX should I get the window via mScriptGlobal? This is tricky
// since we're near onload and things might be changing. But I
// think mContentViewer has the right view of the world.
nsCOMPtr<nsIDocument> document = mContentViewer->GetDocument();
if (document) {
nsCOMPtr<nsPIDOMWindow> window = document->GetWindow();
if (window) {
// Dispatch the popstate event , passing PR_TRUE to indicate
// that this is an "initial" (i.e. after-onload) popstate.
window->DispatchSyncPopState(PR_TRUE);
}
}
}
mContentViewer->LoadComplete(aStatus);
mIsExecutingOnLoadHandler = PR_FALSE;
mEODForCurrentDocument = PR_TRUE;
@@ -8249,11 +8229,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
mAllowKeywordFixup =
(aFlags & INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) != 0;
mURIResultedInDocument = PR_FALSE; // reset the clock...
// If we've gotten this far, reset our "don't fire a popState" flag. This
// will get set to true the next time someone calls push/replaceState.
mSuppressPopstate = PR_FALSE;
//
// First:
// Check to see if the new URI is an anchor in the existing document.
@@ -8453,12 +8429,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// Dispatch the popstate and hashchange events, as appropriate.
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mScriptGlobal);
if (window) {
NS_ASSERTION(!mSuppressPopstate,
"Popstate shouldn't be suppressed here.");
// Pass PR_FALSE to indicate that this is not an "initial" (i.e.
// after-onload) popstate.
window->DispatchSyncPopState(PR_FALSE);
window->DispatchSyncPopState();
if (doHashchange)
window->DispatchAsyncHashchange();
@@ -9858,10 +9829,6 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
FireDummyOnLocationChange();
}
// A call to push/replaceState prevents popstate events from firing until
// the next time we call InternalLoad.
mSuppressPopstate = PR_TRUE;
return NS_OK;
}