int32_t WorkerGlobalScope::SetTimeout(JSContext* aCx, const nsAString& aHandler, const int32_t aTimeout, const Sequence<JS::Value>& /* unused */, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); nsCOMPtr<nsIScriptTimeoutHandler> handler = NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler); return mWorkerPrivate->SetTimeout(aCx, handler, aTimeout, false, aRv); }
int32_t WorkerGlobalScope::SetInterval(JSContext* aCx, Function& aHandler, const int32_t aTimeout, const Sequence<JS::Value>& aArguments, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); nsCOMPtr<nsIScriptTimeoutHandler> handler = NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler, aArguments, aRv); if (NS_WARN_IF(aRv.Failed())) { return 0; } return mWorkerPrivate->SetTimeout(aCx, handler, aTimeout, true, aRv); }
int32_t WorkerGlobalScope::SetInterval(JSContext* aCx, const nsAString& aHandler, const Optional<int32_t>& aTimeout, const Sequence<JS::Value>& /* unused */, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); Sequence<JS::Value> dummy; bool isInterval = aTimeout.WasPassed(); int32_t timeout = aTimeout.WasPassed() ? aTimeout.Value() : 0; nsCOMPtr<nsIScriptTimeoutHandler> handler = NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler); return mWorkerPrivate->SetTimeout(aCx, handler, timeout, isInterval, aRv); }
int32_t WorkerGlobalScope::SetInterval(JSContext* aCx, Function& aHandler, const Optional<int32_t>& aTimeout, const Sequence<JS::Value>& aArguments, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); bool isInterval = aTimeout.WasPassed(); int32_t timeout = aTimeout.WasPassed() ? aTimeout.Value() : 0; nsCOMPtr<nsIScriptTimeoutHandler> handler = NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler, aArguments, aRv); if (NS_WARN_IF(aRv.Failed())) { return 0; } return mWorkerPrivate->SetTimeout(aCx, handler, timeout, isInterval, aRv); }