Bug 1341452 - MediaResult::Description() also describes successes - r?jya
Also show whether the nsresult is a failure or success code.
MozReview-Commit-ID: BJfSSrCEHEd
--- a/dom/media/MediaResult.h
+++ b/dom/media/MediaResult.h
@@ -45,23 +45,21 @@ public:
// Interoperations with nsresult.
bool operator==(nsresult aResult) const { return aResult == mCode; }
bool operator!=(nsresult aResult) const { return aResult != mCode; }
operator nsresult () const { return mCode; }
nsCString Description() const
{
- if (NS_SUCCEEDED(mCode)) {
- return nsCString();
- }
nsCString name;
GetErrorName(mCode, static_cast<nsACString&>(name));
- return nsPrintfCString("%s (0x%08" PRIx32 ")%s%s",
+ return nsPrintfCString("%s (%s 0x%08" PRIx32 ")%s%s",
name.get(),
+ NS_FAILED(mCode) ? "Failure " : "Success ",
static_cast<uint32_t>(mCode),
mMessage.IsEmpty() ? "" : " - ",
mMessage.get());
}
private:
nsresult mCode;
nsCString mMessage;