Bug 1817393 - Fix missing null check in RecvGetSystemIcon. r=nika

Depends on D170184

Differential Revision: https://phabricator.services.mozilla.com/D170185
This commit is contained in:
Christian Holler (:decoder) 2023-02-20 13:56:53 +00:00
parent 843be769fb
commit 93336d3327

View File

@ -8225,17 +8225,23 @@ void ContentParent::DidLaunchSubprocess() {
IPCResult ContentParent::RecvGetSystemIcon(nsIURI* aURI,
GetSystemIconResolver&& aResolver) {
using ResolverArgs = Tuple<const nsresult&, mozilla::Maybe<ByteBuf>&&>;
if (!aURI) {
Maybe<ByteBuf> bytebuf = Nothing();
aResolver(ResolverArgs(NS_ERROR_NULL_POINTER, std::move(bytebuf)));
return IPC_OK();
}
#if defined(MOZ_WIDGET_GTK)
Maybe<ByteBuf> bytebuf = Some(ByteBuf{});
nsresult rv = nsIconChannel::GetIcon(aURI, bytebuf.ptr());
if (NS_WARN_IF(NS_FAILED(rv))) {
bytebuf = Nothing();
}
using ResolverArgs = Tuple<const nsresult&, mozilla::Maybe<ByteBuf>&&>;
aResolver(ResolverArgs(rv, std::move(bytebuf)));
return IPC_OK();
#elif defined(XP_WIN)
using ResolverArgs = Tuple<const nsresult&, mozilla::Maybe<ByteBuf>&&>;
nsIconChannel::GetIconAsync(aURI)->Then(
GetCurrentSerialEventTarget(), __func__,
[aResolver](ByteBuf&& aByteBuf) {