mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1476238 - Use nsresult/promise rejection in initListBuild r=Gijs
I mistranslated the boolean success value of the old initListBuild method. Simplifying it to just use a promise rejection should be equivalent and simpler, since this is only run from the update method of WindowsJumpLists, and the call sites for that don't do anything afterwards. Differential Revision: https://phabricator.services.mozilla.com/D2244 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
765503a54d
commit
04f1e1bc1e
@ -214,8 +214,7 @@ var WinTaskbarJumpList =
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await this._startBuild())
|
||||
return;
|
||||
await this._startBuild();
|
||||
|
||||
if (this._showTasks)
|
||||
this._buildTasks();
|
||||
@ -240,9 +239,7 @@ var WinTaskbarJumpList =
|
||||
if (URIsToRemove.length > 0) {
|
||||
// Prior to building, delete removed items from history.
|
||||
this._clearHistory(URIsToRemove);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_commitBuild: function WTBJL__commitBuild() {
|
||||
|
@ -229,16 +229,21 @@ void JumpListBuilder::DoInitListBuild(RefPtr<Promise>&& aPromise)
|
||||
// The returned objArray of removed items are for manually removed items.
|
||||
// This does not return items which are removed because they were previously
|
||||
// part of the jump list but are no longer part of the jump list.
|
||||
if (SUCCEEDED(hr) && objArray) {
|
||||
if (SUCCEEDED(hr)) {
|
||||
sBuildingList = true;
|
||||
RemoveIconCacheAndGetJumplistShortcutURIs(objArray, urisToRemove);
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction("InitListBuildResolve",
|
||||
[urisToRemove = std::move(urisToRemove),
|
||||
promise = std::move(aPromise)]() {
|
||||
promise->MaybeResolve(urisToRemove);
|
||||
}));
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction("InitListBuildResolve",
|
||||
[urisToRemove = std::move(urisToRemove),
|
||||
promise = std::move(aPromise)]() {
|
||||
promise->MaybeResolve(urisToRemove);
|
||||
}));
|
||||
} else {
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction("InitListBuildReject",
|
||||
[promise = std::move(aPromise)]() {
|
||||
promise->MaybeReject(NS_ERROR_FAILURE);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// Ensures that we have no old ICO files left in the jump list cache
|
||||
@ -528,6 +533,11 @@ void JumpListBuilder::RemoveIconCacheAndGetJumplistShortcutURIs(IObjectArray *aO
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
// Early return here just in case some versions of Windows don't populate this
|
||||
if (!aObjArray) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t count = 0;
|
||||
aObjArray->GetCount(&count);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user