Bug 1299072: P1. Add message attribute to MediaError object, r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 09 Sep 2016 15:43:25 +1000
changeset 412866 a01860b405d5d87d4453320067a86e6c3e6c3ab3
parent 412836 1646b4c6f2517ae9372d7e12a00b4d6a28857319
child 412867 5a5f3ce57bc0b8ae4b0fc69e472a9164364ce311
push id29276
push userbmo:jyavenard@mozilla.com
push dateTue, 13 Sep 2016 03:29:20 +0000
reviewersgerald
bugs1299072
milestone51.0a1
Bug 1299072: P1. Add message attribute to MediaError object, r?gerald MozReview-Commit-ID: HT6mIg4X0Sz
dom/html/MediaError.cpp
dom/interfaces/html/nsIDOMMediaError.idl
dom/webidl/MediaError.webidl
modules/libpref/init/all.js
--- a/dom/html/MediaError.cpp
+++ b/dom/html/MediaError.cpp
@@ -30,16 +30,21 @@ MediaError::MediaError(HTMLMediaElement*
 NS_IMETHODIMP MediaError::GetCode(uint16_t* aCode)
 {
   if (aCode)
     *aCode = Code();
 
   return NS_OK;
 }
 
+NS_IMETHODIMP MediaError::GetMessage(nsAString& aResult)
+{
+  return NS_OK;
+}
+
 JSObject*
 MediaError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return MediaErrorBinding::Wrap(aCx, this, aGivenProto);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/interfaces/html/nsIDOMMediaError.idl
+++ b/dom/interfaces/html/nsIDOMMediaError.idl
@@ -7,21 +7,23 @@
 
 [uuid(7bd8c29f-8a76-453f-9373-79f820f2dc01)]
 interface nsIDOMMediaError : nsISupports
 {
   /* The download of the media resource was aborted by
      the user agent at the user's requet */
   const unsigned short MEDIA_ERR_ABORTED = 1;
 
-  /* A network error of some description caused the 
+  /* A network error of some description caused the
      user agent to stop downloading the media resource */
   const unsigned short MEDIA_ERR_NETWORK = 2;
 
-  /* An error of some description occurred while decoding 
+  /* An error of some description occurred while decoding
      the media resource */
   const unsigned short MEDIA_ERR_DECODE  = 3;
 
   /* No suitable media resource could be found */
   const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
 
   readonly attribute unsigned short code;
+
+  readonly attribute DOMString message;
 };
--- a/dom/webidl/MediaError.webidl
+++ b/dom/webidl/MediaError.webidl
@@ -14,9 +14,11 @@
 interface MediaError {
   const unsigned short MEDIA_ERR_ABORTED = 1;
   const unsigned short MEDIA_ERR_NETWORK = 2;
   const unsigned short MEDIA_ERR_DECODE = 3;
   const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
 
   [Constant]
   readonly attribute unsigned short code;
+  [Pref="dom.MediaError.message.enabled"]
+  readonly attribute DOMString message;
 };
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -292,16 +292,23 @@ pref("print.shrink-to-fit.scale-limit-pe
 pref("print.use_simplify_page", false);
 
 // Disable support for MathML
 pref("mathml.disabled",    false);
 
 // Enable scale transform for stretchy MathML operators. See bug 414277.
 pref("mathml.scale_stretchy_operators.enabled", true);
 
+// Disable MediaError.message.
+#ifdef RELEASE_BUILD
+pref("dom.MediaError.message.enabled", false);
+#else
+pref("dom.MediaError.message.enabled", true);
+#endif
+
 // Media cache size in kilobytes
 pref("media.cache_size", 512000);
 // When a network connection is suspended, don't resume it until the
 // amount of buffered data falls below this threshold (in seconds).
 pref("media.cache_resume_threshold", 999999);
 // Stop reading ahead when our buffered data is this many seconds ahead
 // of the current playback position. This limit can stop us from using arbitrary
 // amounts of network bandwidth prefetching huge videos.