diff options
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsGlobalWindow.cpp | 27 | ||||
-rw-r--r-- | dom/base/nsGlobalWindow.h | 4 |
2 files changed, 6 insertions, 25 deletions
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index dd6d190591..ae84de3a19 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -12685,41 +12685,22 @@ nsGlobalWindow::SetTimeout(JSContext* aCx, const nsAString& aHandler, return SetTimeoutOrInterval(aCx, aHandler, aTimeout, false, aError); } -static bool -IsInterval(const Optional<int32_t>& aTimeout, int32_t& aResultTimeout) -{ - if (aTimeout.WasPassed()) { - aResultTimeout = aTimeout.Value(); - return true; - } - - // If no interval was specified, treat this like a timeout, to avoid setting - // an interval of 0 milliseconds. - aResultTimeout = 0; - return false; -} - int32_t nsGlobalWindow::SetInterval(JSContext* aCx, Function& aFunction, - const Optional<int32_t>& aTimeout, + const int32_t aTimeout, const Sequence<JS::Value>& aArguments, ErrorResult& aError) { - int32_t timeout; - bool isInterval = IsInterval(aTimeout, timeout); - return SetTimeoutOrInterval(aCx, aFunction, timeout, aArguments, isInterval, - aError); + return SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments, true, aError); } int32_t nsGlobalWindow::SetInterval(JSContext* aCx, const nsAString& aHandler, - const Optional<int32_t>& aTimeout, + const int32_t aTimeout, const Sequence<JS::Value>& /* unused */, ErrorResult& aError) { - int32_t timeout; - bool isInterval = IsInterval(aTimeout, timeout); - return SetTimeoutOrInterval(aCx, aHandler, timeout, isInterval, aError); + return SetTimeoutOrInterval(aCx, aHandler, aTimeout, true, aError); } nsresult diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 63bb574dd4..c59baee648 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -953,11 +953,11 @@ public: mozilla::ErrorResult& aError); void ClearTimeout(int32_t aHandle); int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction, - const mozilla::dom::Optional<int32_t>& aTimeout, + const int32_t aTimeout, const mozilla::dom::Sequence<JS::Value>& aArguments, mozilla::ErrorResult& aError); int32_t SetInterval(JSContext* aCx, const nsAString& aHandler, - const mozilla::dom::Optional<int32_t>& aTimeout, + const int32_t aTimeout, const mozilla::dom::Sequence<JS::Value>& /* unused */, mozilla::ErrorResult& aError); void ClearInterval(int32_t aHandle); |