Bug 1414121. P1 - let mozDumpDebugInfo() return a promise. r=bz
authorJW Wang <jwwang@mozilla.com>
Fri, 03 Nov 2017 10:33:27 +0800
changeset 443538 5dc63b15b7e29659a21b9d63563272045117b03d
parent 443537 110873e70443c09818ac49a8000097d22316a92f
child 443539 694d4dc74495c0453fc63d15f6cbf9a77c6604e3
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1414121
milestone58.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 1414121. P1 - let mozDumpDebugInfo() return a promise. r=bz MozReview-Commit-ID: Klfr3AYdSCG
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/webidl/HTMLMediaElement.webidl
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1600,22 +1600,29 @@ HTMLMediaElement::MozRequestDebugInfo(Er
       });
   } else {
     promise->MaybeResolve(result);
   }
 
   return promise.forget();
 }
 
-void
+already_AddRefed<Promise>
 HTMLMediaElement::MozDumpDebugInfo()
 {
+  ErrorResult rv;
+  RefPtr<Promise> promise = CreateDOMPromise(rv);
+  if (NS_WARN_IF(rv.Failed())) {
+    return nullptr;
+  }
   if (mDecoder) {
     mDecoder->DumpDebugInfo();
   }
+  promise->MaybeResolveWithUndefined();
+  return promise.forget();
 }
 
 void
 HTMLMediaElement::SetVisible(bool aVisible)
 {
   if (!mDecoder) {
     return;
   }
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -620,17 +620,17 @@ public:
   // Returns a string describing the state of the media player internal
   // data. Used for debugging purposes.
   void GetMozDebugReaderData(nsAString& aString);
 
   // Returns a promise which will be resolved after collecting debugging
   // data from decoder/reader/MDSM. Used for debugging purposes.
   already_AddRefed<Promise> MozRequestDebugInfo(ErrorResult& aRv);
 
-  void MozDumpDebugInfo();
+  already_AddRefed<Promise> MozDumpDebugInfo();
 
   // For use by mochitests. Enabling pref "media.test.video-suspend"
   void SetVisible(bool aVisible);
 
   // For use by mochitests. Enabling pref "media.test.video-suspend"
   bool HasSuspendTaint() const;
 
   // Synchronously, return the next video frame and mark the element unable to
--- a/dom/webidl/HTMLMediaElement.webidl
+++ b/dom/webidl/HTMLMediaElement.webidl
@@ -103,17 +103,17 @@ partial interface HTMLMediaElement {
   [Func="HasDebuggerOrTabsPrivilege"]
   readonly attribute MediaSource? mozMediaSourceObject;
   [Func="HasDebuggerOrTabsPrivilege"]
   readonly attribute DOMString mozDebugReaderData;
   [Func="HasDebuggerOrTabsPrivilege", NewObject]
   Promise<DOMString> mozRequestDebugInfo();
 
   [Pref="media.test.dumpDebugInfo"]
-  void mozDumpDebugInfo();
+  Promise<void> mozDumpDebugInfo();
 
   attribute MediaStream? srcObject;
 
   attribute boolean mozPreservesPitch;
   readonly attribute boolean mozAutoplayEnabled;
 
   // NB: for internal use with the video controls:
   [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;