Bug 1329568 - MediaSource::IsTypeSupported should report a NotSupportedError if type is not supported - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 13 Jan 2017 14:58:23 +1100
changeset 374379 efa49d60877714ea8e7659f957e5889c0b03d5d2
parent 374378 c38a9125908aeb17c9086287a8c081dffbd895bb
child 374380 170324f26108cf4255ccac23ecf56d5e3f130409
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1329568, 1176218
milestone53.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 1329568 - MediaSource::IsTypeSupported should report a NotSupportedError if type is not supported - r=jya Bug 1176218 made IsTypeSupported return a DOMTypeError if the type cannot be parsed, but this was incorrect. This was not important until now, because the basic parser accepted invalid MIME types and therefore would never report an error there. But the next couple of patches will introduce a stronger check that will refuse types other that "application/...", "audio/...", and "video/...", and would now trip the web-platform tests. MozReview-Commit-ID: EeyFnyurEZK
dom/media/mediasource/MediaSource.cpp
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -90,17 +90,17 @@ nsresult
 MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* aDiagnostics)
 {
   if (aType.IsEmpty()) {
     return NS_ERROR_DOM_TYPE_ERR;
   }
 
   Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
   if (!contentType) {
-    return NS_ERROR_DOM_TYPE_ERR;
+    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
 
   if (DecoderTraits::CanHandleContentType(*contentType, aDiagnostics)
       == CANPLAY_NO) {
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
 
   // Now we know that this media type could be played.