Bug 1979113: Reject AsyncEncodeAndWriteIcon promise if task dispatch fails on Windows r=daisuke,win-reviewers,gstoll, a=dsmith

Reject the promise at destruction unless it has already been resolved/rejected.
Also return an error (that is ignored).

Differential Revision: https://phabricator.services.mozilla.com/D258614
This commit is contained in:
David P
2025-07-25 23:26:06 +00:00
committed by dsmith@mozilla.com
parent 6d1ac1135e
commit c68862e175

View File

@@ -826,9 +826,7 @@ static nsresult CacheFavicon(
nsCOMPtr<nsIRunnable> event = new AsyncEncodeAndWriteIcon(
path, std::move(data), stride, size.width, size.height,
aRunnable.forget(), std::move(aPromiseHolder));
aIOThread->Dispatch(event, NS_DISPATCH_NORMAL);
return NS_OK;
return aIOThread->Dispatch(event, NS_DISPATCH_NORMAL);
}
#endif
@@ -895,7 +893,11 @@ NS_IMETHODIMP AsyncEncodeAndWriteIcon::Run() {
return rv;
}
AsyncEncodeAndWriteIcon::~AsyncEncodeAndWriteIcon() {}
AsyncEncodeAndWriteIcon::~AsyncEncodeAndWriteIcon() {
if (mPromiseHolder) {
mPromiseHolder->RejectIfExists(NS_ERROR_FAILURE, __func__);
}
}
AsyncDeleteAllFaviconsFromDisk::AsyncDeleteAllFaviconsFromDisk(
bool aIgnoreRecent)