Bug 1349480 - s/NotSupportedError/TypeError for getUserMedia({}) draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Wed, 22 Mar 2017 08:41:33 -0400
changeset 502816 ae56a6b0cc36ff7de8c23f78a612405d776452f0
parent 502328 9fb5e850ab7ab0b2b90640c604f66038407b411d
child 550278 7e9c0d5d60a45830e0b6374382b14a6e8bdf0d98
push id50416
push userjbruaroey@mozilla.com
push dateWed, 22 Mar 2017 12:42:13 +0000
bugs1349480
milestone55.0a1
Bug 1349480 - s/NotSupportedError/TypeError for getUserMedia({}) MozReview-Commit-ID: 7bJA01u7F0K
dom/media/MediaManager.cpp
dom/media/tests/mochitest/test_getUserMedia_constraints.html
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2016,17 +2016,17 @@ MediaManager::GetUserMedia(nsPIDOMWindow
   MediaStreamConstraints c(aConstraintsPassedIn); // use a modifiable copy
 
   // Do all the validation we can while we're sync (to return an
   // already-rejected promise on failure).
 
   if (!IsOn(c.mVideo) && !IsOn(c.mAudio)) {
     RefPtr<MediaStreamError> error =
         new MediaStreamError(aWindow,
-                             NS_LITERAL_STRING("NotSupportedError"),
+                             NS_LITERAL_STRING("TypeError"),
                              NS_LITERAL_STRING("audio and/or video is required"));
     onFailure->OnError(error);
     return NS_OK;
   }
   if (sInShutdown) {
     RefPtr<MediaStreamError> error =
         new MediaStreamError(aWindow,
                              NS_LITERAL_STRING("AbortError"),
--- a/dom/media/tests/mochitest/test_getUserMedia_constraints.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_constraints.html
@@ -41,17 +41,17 @@ var tests = [
     error: "OverconstrainedError",
     constraint: "mediaSource" },
   { message: "unknown mediaSource in audio fails",
     constraints: { audio: { mediaSource: 'uncle' } },
     error: "OverconstrainedError",
     constraint: "mediaSource" },
   { message: "emtpy constraint fails",
     constraints: { },
-    error: "NotSupportedError" },
+    error: "TypeError" },
   { message: "Triggering mock failure in default video device fails",
     constraints: { video: { deviceId: 'bad device' }, fake: true },
     error: "NotReadableError" },
   { message: "Triggering mock failure in default audio device fails",
     constraints: { audio: { deviceId: 'bad device' }, fake: true },
     error: "NotReadableError" },
   { message: "Success-path: optional video facingMode + audio ignoring facingMode",
     constraints: { audio: { mediaSource: 'microphone',