Bug 436990. Make sure to remove already-fired timers from our refresh URI list. r+sr=jst

This commit is contained in:
Boris Zbarsky 2008-09-08 09:19:49 -04:00
parent 8b42832c23
commit 1fef9d25da
5 changed files with 65 additions and 4 deletions

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0">
<script language="javascript">
location.hash += "+++";
function done()
{
parent.document.documentElement.removeAttribute("class");
}
</script>
</head>
<body onload="setTimeout(done, 10)">
</body>
</html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
</head>
<body>
<iframe src="436900-1-inner.html#foo"></iframe>
</body>
</html>

View File

@ -1,2 +1,3 @@
load 369126-1.html
load 403574-1.xhtml
load 436900-1.html

View File

@ -4435,6 +4435,31 @@ nsDocShell::RefreshURI(nsIURI * aURI, PRInt32 aDelay, PRBool aRepeat,
return NS_OK;
}
nsresult
nsDocShell::ForceRefreshURIFromTimer(nsIURI * aURI,
PRInt32 aDelay,
PRBool aMetaRefresh,
nsITimer* aTimer)
{
NS_PRECONDITION(aTimer, "Must have a timer here");
// Remove aTimer from mRefreshURIList if needed
if (mRefreshURIList) {
PRUint32 n = 0;
mRefreshURIList->Count(&n);
for (PRUint32 i = 0; i < n; ++i) {
nsCOMPtr<nsITimer> timer = do_QueryElementAt(mRefreshURIList, i);
if (timer == aTimer) {
mRefreshURIList->RemoveElementAt(i);
break;
}
}
}
return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
}
NS_IMETHODIMP
nsDocShell::ForceRefreshURI(nsIURI * aURI,
PRInt32 aDelay,
@ -9303,9 +9328,7 @@ nsRefreshTimer::Notify(nsITimer * aTimer)
// Get the delay count to determine load type
PRUint32 delay = 0;
aTimer->GetDelay(&delay);
nsCOMPtr<nsIRefreshURI> refreshURI = do_QueryInterface(mDocShell);
if (refreshURI)
refreshURI->ForceRefreshURI(mURI, delay, mMetaRefresh);
mDocShell->ForceRefreshURIFromTimer(mURI, delay, mMetaRefresh, aTimer);
}
return NS_OK;
}

View File

@ -109,6 +109,7 @@
#include "nsIChannelClassifier.h"
class nsIScrollableView;
class nsDocShell;
/* load commands were moved to nsIDocShell.h */
/* load types were moved to nsDocShellLoadTypes.h */
@ -133,7 +134,7 @@ public:
PRInt32 GetDelay() { return mDelay ;}
nsCOMPtr<nsIDocShell> mDocShell;
nsRefPtr<nsDocShell> mDocShell;
nsCOMPtr<nsIURI> mURI;
PRInt32 mDelay;
PRPackedBool mRepeat;
@ -235,6 +236,13 @@ public:
// subframes. It then simulates the completion of the toplevel load.
nsresult RestoreFromHistory();
// Perform a URI load from a refresh timer. This is just like the
// ForceRefreshURI method on nsIRefreshURI, but makes sure to take
// the timer involved out of mRefreshURIList if it's there.
// aTimer must not be null.
nsresult ForceRefreshURIFromTimer(nsIURI * aURI, PRInt32 aDelay,
PRBool aMetaRefresh, nsITimer* aTimer);
protected:
// Object Management
virtual ~nsDocShell();