diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 43fb36429db3..366db5a86e6f 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -220,11 +220,14 @@ void OnSetCookie(util::Promise promise, break; } if (errmsg.empty()) { - RunCallbackInUI( + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(util::Promise::ResolveEmptyPromise, std::move(promise))); } else { - RunCallbackInUI( - base::BindOnce(util::Promise::RejectPromise, std::move(promise), errmsg)); + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, + base::BindOnce(util::Promise::RejectPromise, std::move(promise), + std::move(errmsg))); } }