Bug 1665614 - Make mozilla::Result work with non-copyable/non-param error types. r=emilio,jandem

Among other things, there were some misuses of std::forward, and
GenericErrorResult was (presumably accidentally) instatiated with
references as the template argument type, e.g. const nsresult&,
which circumvented the check for not calling it with NS_OK in
ResultExtensions.h

Differential Revision: https://phabricator.services.mozilla.com/D90561
This commit is contained in:
Simon Giesecke
2020-09-21 13:12:48 +00:00
parent 2e313a5bdb
commit 53f9160b76
9 changed files with 71 additions and 19 deletions

View File

@@ -891,7 +891,7 @@ void ExtensionProtocolHandler::NewSimpleChannel(nsIURI* aURI,
nsresult rv = origChannel->AsyncOpen(listener);
if (NS_FAILED(rv)) {
simpleChannel->Cancel(NS_BINDING_ABORTED);
return RequestOrReason(rv);
return Err(rv);
}
return RequestOrReason(origChannel);
});