Bug 1329568 - MediaSource::IsTypeSupported should report a NotSupportedError if type is not supported - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 13 Jan 2017 14:58:23 +1100
changeset 460516 87e23509063a8b497cf529b31d62bd12f6879476
parent 460515 391efb3d0ff4a5528e86b2df0f34b6ab281d3385
child 460517 3a53b24e7dd9ef53f4b96ac85d81ebf0fc675ce5
push id41406
push usergsquelart@mozilla.com
push dateFri, 13 Jan 2017 06:23:59 +0000
reviewersjya
bugs1329568, 1176218
milestone53.0a1
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.