Bug 1302632: P2. Only have Description return a non-empty string in case of error. r=jwwang
☠☠ backed out by 3172114c06cd ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 14 Sep 2016 16:49:56 +1000
changeset 355438 22772e4a9c722ff9ff071ecb2c8de362d8c1f77d
parent 355437 7d7558864a662be6535d4a52054b6dc0bf9c5fc7
child 355439 b20f7c887e6c2525e7fabfeb63dd996f0cd7f163
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1302632
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1302632: P2. Only have Description return a non-empty string in case of error. r=jwwang Will simplify the code in the following patch, not having to perform unnecessary test. MozReview-Commit-ID: 5zUzSZgzrG9
dom/media/MediaResult.h
--- a/dom/media/MediaResult.h
+++ b/dom/media/MediaResult.h
@@ -43,16 +43,19 @@ 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();
+    }
     return nsPrintfCString("0x%08x: %s", mCode, mMessage.get());
   }
 
 private:
   nsresult mCode;
   nsCString mMessage;
 };