Make STOP_CONTENT not only stop the content viewer, but also cancel all pending

timeouts and intervals. Bug 277092, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-01-31 22:49:42 +00:00
parent bd7324e29b
commit bd9d2b5403
3 changed files with 11 additions and 3 deletions

View File

@ -3115,6 +3115,10 @@ nsDocShell::Stop(PRUint32 aStopFlags)
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
if (mContentViewer)
mContentViewer->Stop();
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mScriptGlobal);
if (ourWindow) {
ourWindow->ClearAllTimeouts();
}
}
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {

View File

@ -75,8 +75,8 @@ class nsIFocusController;
struct nsTimeout;
#define NS_PIDOMWINDOW_IID \
{ 0x7e12a2d6, 0x9a2a, 0x4907, \
{ 0xab, 0x85, 0x01, 0x34, 0xe3, 0xa8, 0x1a, 0x3f } }
{ 0x91671056, 0xa8ed, 0x4ad3, \
{ 0x8f, 0x19, 0x69, 0xf5, 0x48, 0xbb, 0x9c, 0x4a } }
class nsPIDOMWindow : public nsIDOMWindowInternal
{
@ -136,6 +136,9 @@ public:
virtual PopupControlState GetPopupControlState() const = 0;
virtual OpenAllowValue GetOpenAllow(const nsAString &aName) = 0;
// Clear all pending timeouts and intervals.
virtual void ClearAllTimeouts() = 0;
protected:
nsPIDOMWindow()
: mRunningTimeout(nsnull), mMutationBits(0), mIsDocumentLoaded(PR_FALSE),

View File

@ -198,6 +198,8 @@ public:
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
virtual NS_HIDDEN_(OpenAllowValue) GetOpenAllow(const nsAString &aName);
virtual NS_HIDDEN_(void) ClearAllTimeouts();
// nsIDOMViewCSS
NS_DECL_NSIDOMVIEWCSS
@ -238,7 +240,6 @@ protected:
nsresult SetTimeoutOrInterval(PRBool aIsInterval, PRInt32* aReturn);
void RunTimeout(nsTimeout *aTimeout);
nsresult ClearTimeoutOrInterval();
void ClearAllTimeouts();
void InsertTimeoutIntoList(nsTimeout **aInsertionPoint, nsTimeout *aTimeout);
static void TimerCallback(nsITimer *aTimer, void *aClosure);