diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index dec4ced43269..7c21a5bb9ce9 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -9400,9 +9400,7 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler, nsRefPtr copy = timeout; - rv = timeout->mTimer->InitWithFuncCallback(TimerCallback, timeout, - realInterval, - nsITimer::TYPE_ONE_SHOT); + rv = timeout->InitTimer(TimerCallback, realInterval); if (NS_FAILED(rv)) { return rv; } @@ -9637,10 +9635,7 @@ nsGlobalWindow::RescheduleTimeout(nsTimeout* aTimeout, const TimeStamp& now, // platforms whether delay is positive or negative (which we // know is always positive here, but cast anyways for // consistency). - nsresult rv = aTimeout->mTimer-> - InitWithFuncCallback(TimerCallback, aTimeout, - delay.ToMilliseconds(), - nsITimer::TYPE_ONE_SHOT); + nsresult rv = aTimeout->InitTimer(TimerCallback, delay.ToMilliseconds()); if (NS_FAILED(rv)) { NS_ERROR("Error initializing timer for DOM timeout!"); @@ -9982,11 +9977,7 @@ nsresult nsGlobalWindow::ResetTimersForNonBackgroundWindow() timeout->mFiringDepth = firingDepth; timeout->Release(); - nsresult rv = - timeout->mTimer->InitWithFuncCallback(TimerCallback, - timeout, - delay.ToMilliseconds(), - nsITimer::TYPE_ONE_SHOT); + nsresult rv = timeout->InitTimer(TimerCallback, delay.ToMilliseconds()); if (NS_FAILED(rv)) { NS_WARNING("Error resetting non background timer for DOM timeout!"); @@ -10499,8 +10490,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren) t->mTimer = do_CreateInstance("@mozilla.org/timer;1"); NS_ENSURE_TRUE(t->mTimer, NS_ERROR_OUT_OF_MEMORY); - rv = t->mTimer->InitWithFuncCallback(TimerCallback, t, delay, - nsITimer::TYPE_ONE_SHOT); + rv = t->InitTimer(TimerCallback, delay); if (NS_FAILED(rv)) { t->mTimer = nsnull; return rv; diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index b9187df6db9e..8583a780feb7 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -153,6 +153,11 @@ struct nsTimeout : PRCList return static_cast(PR_PREV_LINK(this)); } + nsresult InitTimer(nsTimerCallbackFunc aFunc, PRUint64 delay) { + return mTimer->InitWithFuncCallback(aFunc, this, delay, + nsITimer::TYPE_ONE_SHOT); + } + // Window for which this timeout fires nsRefPtr mWindow;