Bug 1377146 - Remove AudioStreamTrack and VideoStreamTrack from js. r=jib,smaug
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 11 Oct 2018 15:36:11 +0000
changeset 489201 bb32faa290f0b8871c7c72798dc1876b01e48a31
parent 489200 757e7b60b9ff93a0bd35f7fc145fd941420198c1
child 489202 7fd59dc00149b33ede6efb0ed848eef227cae540
child 489317 905c871bcf0366ad037e4409ce21afe2a2fba440
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersjib, smaug
bugs1377146
milestone64.0a1
Bug 1377146 - Remove AudioStreamTrack and VideoStreamTrack from js. r=jib,smaug Differential Revision: https://phabricator.services.mozilla.com/D8063
dom/bindings/Bindings.conf
dom/media/AudioStreamTrack.cpp
dom/media/AudioStreamTrack.h
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
dom/media/MediaStreamTrack.cpp
dom/media/MediaStreamTrack.h
dom/media/VideoStreamTrack.cpp
dom/media/VideoStreamTrack.h
dom/media/imagecapture/CaptureTask.cpp
dom/media/imagecapture/ImageCapture.cpp
dom/media/imagecapture/ImageCapture.h
dom/tests/mochitest/general/test_interfaces.js
dom/webidl/AudioStreamTrack.webidl
dom/webidl/ImageCapture.webidl
dom/webidl/MediaStream.webidl
dom/webidl/VideoStreamTrack.webidl
dom/webidl/moz.build
testing/web-platform/meta/mediacapture-streams/idlharness.https.window.js.ini
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -541,20 +541,16 @@ DOMInterfaces = {
 'MediaStreamAudioDestinationNode': {
     'binaryNames': { 'stream': 'DOMStream' }
 },
 
 'MediaStreamList': {
     'headerFile': 'MediaStreamList.h',
 },
 
-'MediaStreamTrack': {
-    'concrete': False
-},
-
 'MediaRecorder': {
     'headerFile': 'MediaRecorder.h',
 },
 
 'MessageBroadcaster': {
     'concrete': False
 },
 
--- a/dom/media/AudioStreamTrack.cpp
+++ b/dom/media/AudioStreamTrack.cpp
@@ -2,27 +2,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AudioStreamTrack.h"
 
 #include "nsContentUtils.h"
 
-#include "mozilla/dom/AudioStreamTrackBinding.h"
 
 namespace mozilla {
 namespace dom {
 
-JSObject*
-AudioStreamTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return AudioStreamTrack_Binding::Wrap(aCx, this, aGivenProto);
-}
-
 void
 AudioStreamTrack::GetLabel(nsAString& aLabel, CallerType aCallerType)
 {
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     aLabel.AssignLiteral("Internal Microphone");
     return;
   }
   MediaStreamTrack::GetLabel(aLabel, aCallerType);
--- a/dom/media/AudioStreamTrack.h
+++ b/dom/media/AudioStreamTrack.h
@@ -15,20 +15,17 @@ namespace dom {
 class AudioStreamTrack : public MediaStreamTrack {
 public:
   AudioStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
                    TrackID aInputTrackID,
                    MediaStreamTrackSource* aSource,
                    const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
     : MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource, aConstraints) {}
 
-  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
   AudioStreamTrack* AsAudioStreamTrack() override { return this; }
-
   const AudioStreamTrack* AsAudioStreamTrack() const override { return this; }
 
   // WebIDL
   void GetKind(nsAString& aKind) override { aKind.AssignLiteral("audio"); }
 
   void GetLabel(nsAString& aLabel, CallerType aCallerType) override;
 
 protected:
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -652,38 +652,56 @@ DOMMediaStream::CountUnderlyingStreams(c
 
 void
 DOMMediaStream::GetId(nsAString& aID) const
 {
   aID = mID;
 }
 
 void
-DOMMediaStream::GetAudioTracks(nsTArray<RefPtr<AudioStreamTrack> >& aTracks) const
+DOMMediaStream::GetAudioTracks(nsTArray<RefPtr<AudioStreamTrack>>& aTracks) const
 {
   for (const RefPtr<TrackPort>& info : mTracks) {
-    AudioStreamTrack* t = info->GetTrack()->AsAudioStreamTrack();
-    if (t) {
+    if (AudioStreamTrack* t = info->GetTrack()->AsAudioStreamTrack()) {
       aTracks.AppendElement(t);
     }
   }
 }
 
 void
-DOMMediaStream::GetVideoTracks(nsTArray<RefPtr<VideoStreamTrack> >& aTracks) const
+DOMMediaStream::GetAudioTracks(nsTArray<RefPtr<MediaStreamTrack>>& aTracks) const
+{
+  for (const RefPtr<TrackPort>& info : mTracks) {
+    if (info->GetTrack()->AsAudioStreamTrack()) {
+      aTracks.AppendElement(info->GetTrack());
+    }
+  }
+}
+
+void
+DOMMediaStream::GetVideoTracks(nsTArray<RefPtr<VideoStreamTrack>>& aTracks) const
 {
   for (const RefPtr<TrackPort>& info : mTracks) {
-    VideoStreamTrack* t = info->GetTrack()->AsVideoStreamTrack();
-    if (t) {
+    if (VideoStreamTrack* t = info->GetTrack()->AsVideoStreamTrack()) {
       aTracks.AppendElement(t);
     }
   }
 }
 
 void
+DOMMediaStream::GetVideoTracks(nsTArray<RefPtr<MediaStreamTrack>>& aTracks) const
+{
+  for (const RefPtr<TrackPort>& info : mTracks) {
+    if (info->GetTrack()->AsVideoStreamTrack()) {
+      aTracks.AppendElement(info->GetTrack());
+    }
+  }
+}
+
+void
 DOMMediaStream::GetTracks(nsTArray<RefPtr<MediaStreamTrack> >& aTracks) const
 {
   for (const RefPtr<TrackPort>& info : mTracks) {
     aTracks.AppendElement(info->GetTrack());
   }
 }
 
 void
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -362,17 +362,19 @@ public:
   double CurrentTime();
 
   static already_AddRefed<dom::Promise>
   CountUnderlyingStreams(const dom::GlobalObject& aGlobal, ErrorResult& aRv);
 
   void GetId(nsAString& aID) const;
 
   void GetAudioTracks(nsTArray<RefPtr<AudioStreamTrack> >& aTracks) const;
+  void GetAudioTracks(nsTArray<RefPtr<MediaStreamTrack> >& aTracks) const;
   void GetVideoTracks(nsTArray<RefPtr<VideoStreamTrack> >& aTracks) const;
+  void GetVideoTracks(nsTArray<RefPtr<MediaStreamTrack> >& aTracks) const;
   void GetTracks(nsTArray<RefPtr<MediaStreamTrack> >& aTracks) const;
   MediaStreamTrack* GetTrackById(const nsAString& aId) const;
   void AddTrack(MediaStreamTrack& aTrack);
   void RemoveTrack(MediaStreamTrack& aTrack);
 
   /** Identical to CloneInternal(TrackForwardingOption::EXPLICIT) */
   already_AddRefed<DOMMediaStream> Clone();
 
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -206,16 +206,22 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEvent
 
 nsPIDOMWindowInner*
 MediaStreamTrack::GetParentObject() const
 {
   MOZ_RELEASE_ASSERT(mOwningStream);
   return mOwningStream->GetParentObject();
 }
 
+JSObject*
+MediaStreamTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+  return MediaStreamTrack_Binding::Wrap(aCx, this, aGivenProto);
+}
+
 void
 MediaStreamTrack::GetId(nsAString& aID) const
 {
   aID = mID;
 }
 
 void
 MediaStreamTrack::SetEnabled(bool aEnabled)
--- a/dom/media/MediaStreamTrack.h
+++ b/dom/media/MediaStreamTrack.h
@@ -381,17 +381,17 @@ public:
       MediaStreamTrackSource* aSource,
       const MediaTrackConstraints& aConstraints = MediaTrackConstraints());
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamTrack,
                                            DOMEventTargetHelper)
 
   nsPIDOMWindowInner* GetParentObject() const;
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
+  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual AudioStreamTrack* AsAudioStreamTrack() { return nullptr; }
   virtual VideoStreamTrack* AsVideoStreamTrack() { return nullptr; }
 
   virtual const AudioStreamTrack* AsAudioStreamTrack() const { return nullptr; }
   virtual const VideoStreamTrack* AsVideoStreamTrack() const { return nullptr; }
 
   // WebIDL
--- a/dom/media/VideoStreamTrack.cpp
+++ b/dom/media/VideoStreamTrack.cpp
@@ -4,27 +4,19 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "VideoStreamTrack.h"
 
 #include "MediaStreamVideoSink.h"
 #include "MediaStreamGraph.h"
 #include "nsContentUtils.h"
 
-#include "mozilla/dom/VideoStreamTrackBinding.h"
-
 namespace mozilla {
 namespace dom {
 
-JSObject*
-VideoStreamTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return VideoStreamTrack_Binding::Wrap(aCx, this, aGivenProto);
-}
-
 void
 VideoStreamTrack::AddVideoOutput(MediaStreamVideoSink* aSink)
 {
   GetOwnedStream()->AddVideoOutput(aSink, mTrackID);
 }
 
 void
 VideoStreamTrack::RemoveVideoOutput(MediaStreamVideoSink* aSink)
--- a/dom/media/VideoStreamTrack.h
+++ b/dom/media/VideoStreamTrack.h
@@ -18,20 +18,17 @@ namespace dom {
 class VideoStreamTrack : public MediaStreamTrack {
 public:
   VideoStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
                    TrackID aInputTrackID,
                    MediaStreamTrackSource* aSource,
                    const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
     : MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource, aConstraints) {}
 
-  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
   VideoStreamTrack* AsVideoStreamTrack() override { return this; }
-
   const VideoStreamTrack* AsVideoStreamTrack() const override { return this; }
 
   void AddVideoOutput(MediaStreamVideoSink* aSink);
   void RemoveVideoOutput(MediaStreamVideoSink* aSink);
 
   // WebIDL
   void GetKind(nsAString& aKind) override { aKind.AssignLiteral("video"); }
 
--- a/dom/media/imagecapture/CaptureTask.cpp
+++ b/dom/media/imagecapture/CaptureTask.cpp
@@ -74,28 +74,28 @@ CaptureTask::TaskComplete(already_AddRef
   return rv;
 }
 
 void
 CaptureTask::AttachTrack()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  dom::VideoStreamTrack* track = mImageCapture->GetVideoStreamTrack();
+  dom::MediaStreamTrack* track = mImageCapture->GetVideoStreamTrack();
   track->AddPrincipalChangeObserver(this);
   track->AddListener(mEventListener.get());
   track->AddDirectListener(this);
 }
 
 void
 CaptureTask::DetachTrack()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  dom::VideoStreamTrack* track = mImageCapture->GetVideoStreamTrack();
+  dom::MediaStreamTrack* track = mImageCapture->GetVideoStreamTrack();
   track->RemovePrincipalChangeObserver(this);
   track->RemoveListener(mEventListener.get());
   track->RemoveDirectListener(this);
 }
 
 void
 CaptureTask::PrincipalChanged(dom::MediaStreamTrack* aMediaStreamTrack)
 {
--- a/dom/media/imagecapture/ImageCapture.cpp
+++ b/dom/media/imagecapture/ImageCapture.cpp
@@ -23,59 +23,63 @@ LogModule* GetICLog()
 {
   static LazyLogModule log("ImageCapture");
   return log;
 }
 
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(ImageCapture, DOMEventTargetHelper,
-                                   mVideoStreamTrack)
+                                   mTrack)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ImageCapture)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(ImageCapture, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(ImageCapture, DOMEventTargetHelper)
 
-ImageCapture::ImageCapture(VideoStreamTrack* aVideoStreamTrack,
+ImageCapture::ImageCapture(VideoStreamTrack* aTrack,
                            nsPIDOMWindowInner* aOwnerWindow)
   : DOMEventTargetHelper(aOwnerWindow)
+  , mTrack(aTrack)
 {
   MOZ_ASSERT(aOwnerWindow);
-  MOZ_ASSERT(aVideoStreamTrack);
-
-  mVideoStreamTrack = aVideoStreamTrack;
+  MOZ_ASSERT(aTrack);
 }
 
 ImageCapture::~ImageCapture()
 {
   MOZ_ASSERT(NS_IsMainThread());
 }
 
 already_AddRefed<ImageCapture>
 ImageCapture::Constructor(const GlobalObject& aGlobal,
-                          VideoStreamTrack& aTrack,
+                          MediaStreamTrack& aTrack,
                           ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   if (!win) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  RefPtr<ImageCapture> object = new ImageCapture(&aTrack, win);
+  if (!aTrack.AsVideoStreamTrack()) {
+    aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+    return nullptr;
+  }
+
+  RefPtr<ImageCapture> object = new ImageCapture(aTrack.AsVideoStreamTrack(), win);
 
   return object.forget();
 }
 
-VideoStreamTrack*
+MediaStreamTrack*
 ImageCapture::GetVideoStreamTrack() const
 {
-  return mVideoStreamTrack;
+  return mTrack;
 }
 
 nsresult
 ImageCapture::TakePhotoByMediaEngine()
 {
   // Callback for TakPhoto(), it also monitor the principal. If principal
   // changes, it returns PHOTO_ERROR with security error.
   class TakePhotoCallback : public MediaEnginePhotoCallback,
@@ -113,35 +117,35 @@ ImageCapture::TakePhotoByMediaEngine()
 
   protected:
     ~TakePhotoCallback()
     {
       MOZ_ASSERT(NS_IsMainThread());
       mVideoTrack->RemovePrincipalChangeObserver(this);
     }
 
-    RefPtr<VideoStreamTrack> mVideoTrack;
-    RefPtr<ImageCapture> mImageCapture;
+    const RefPtr<VideoStreamTrack> mVideoTrack;
+    const RefPtr<ImageCapture> mImageCapture;
     bool mPrincipalChanged;
   };
 
   RefPtr<MediaEnginePhotoCallback> callback =
-    new TakePhotoCallback(mVideoStreamTrack, this);
-  return mVideoStreamTrack->GetSource().TakePhoto(callback);
+    new TakePhotoCallback(mTrack, this);
+  return mTrack->GetSource().TakePhoto(callback);
 }
 
 void
 ImageCapture::TakePhoto(ErrorResult& aResult)
 {
-  // According to spec, VideoStreamTrack.readyState must be "live"; however
+  // According to spec, MediaStreamTrack.readyState must be "live"; however
   // gecko doesn't implement it yet (bug 910249). Instead of readyState, we
-  // check VideoStreamTrack.enable before bug 910249 is fixed.
+  // check MediaStreamTrack.enable before bug 910249 is fixed.
   // The error code should be INVALID_TRACK, but spec doesn't define it in
   // ImageCaptureError. So it returns PHOTO_ERROR here before spec updates.
-  if (!mVideoStreamTrack->Enabled()) {
+  if (!mTrack->Enabled()) {
     PostErrorEvent(ImageCaptureError::PHOTO_ERROR, NS_ERROR_FAILURE);
     return;
   }
 
   // Try if MediaEngine supports taking photo.
   nsresult rv = TakePhotoByMediaEngine();
 
   // It falls back to MediaStreamGraph image capture if MediaEngine doesn't
@@ -206,17 +210,17 @@ ImageCapture::PostErrorEvent(uint16_t aE
   return DispatchTrustedEvent(event);
 }
 
 bool
 ImageCapture::CheckPrincipal()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsIPrincipal> principal = mVideoStreamTrack->GetPrincipal();
+  nsCOMPtr<nsIPrincipal> principal = mTrack->GetPrincipal();
 
   if (!GetOwner()) {
     return false;
   }
   nsCOMPtr<nsIDocument> doc = GetOwner()->GetExtantDoc();
   if (!doc || !principal) {
     return false;
   }
--- a/dom/media/imagecapture/ImageCapture.h
+++ b/dom/media/imagecapture/ImageCapture.h
@@ -16,61 +16,62 @@ namespace mozilla {
 #ifndef IC_LOG
 LogModule* GetICLog();
 #define IC_LOG(...) MOZ_LOG(GetICLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
 #endif
 
 namespace dom {
 
 class Blob;
+class MediaStreamTrack;
 class VideoStreamTrack;
 
 /**
- *  Implementation of https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-
- *  capture/ImageCapture.html.
- *  The ImageCapture accepts a VideoStreamTrack as input source. The image will
- *  be sent back as a JPG format via Blob event.
+ * Implementation of https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-
+ * capture/ImageCapture.html.
+ * The ImageCapture accepts a video MediaStreamTrack as input source. The image
+ * will be sent back as a JPG format via Blob event.
  *
- *  All the functions in ImageCapture are run in main thread.
+ * All the functions in ImageCapture are run in main thread.
  *
- *  There are two ways to capture image, MediaEngineSource and MediaStreamGraph.
- *  When the implementation of MediaEngineSource supports TakePhoto(),
- *  it uses the platform camera to grab image. Otherwise, it falls back
- *  to the MediaStreamGraph way.
+ * There are two ways to capture image, MediaEngineSource and MediaStreamGraph.
+ * When the implementation of MediaEngineSource supports TakePhoto(),
+ * it uses the platform camera to grab image. Otherwise, it falls back
+ * to the MediaStreamGraph way.
  */
 
 class ImageCapture final : public DOMEventTargetHelper
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImageCapture, DOMEventTargetHelper)
 
   IMPL_EVENT_HANDLER(photo)
   IMPL_EVENT_HANDLER(error)
 
   // WebIDL members.
   void TakePhoto(ErrorResult& aResult);
 
-  // The MediaStream passed into the constructor.
-  VideoStreamTrack* GetVideoStreamTrack() const;
+  // The MediaStreamTrack passed into the constructor.
+  MediaStreamTrack* GetVideoStreamTrack() const;
 
   // nsWrapperCache member
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return ImageCapture_Binding::Wrap(aCx, this, aGivenProto);
   }
 
   // ImageCapture class members
   nsPIDOMWindowInner* GetParentObject() { return GetOwner(); }
 
   static already_AddRefed<ImageCapture> Constructor(const GlobalObject& aGlobal,
-                                                    VideoStreamTrack& aTrack,
+                                                    MediaStreamTrack& aTrack,
                                                     ErrorResult& aRv);
 
-  ImageCapture(VideoStreamTrack* aVideoStreamTrack,
+  ImageCapture(VideoStreamTrack* aTrack,
                nsPIDOMWindowInner* aOwnerWindow);
 
   // Post a Blob event to script.
   nsresult PostBlobEvent(Blob* aBlob);
 
   // Post an error event to script.
   // aErrorCode should be one of error codes defined in ImageCaptureError.h.
   // aReason is the nsresult which maps to a error string in dom/base/domerr.msg.
@@ -80,15 +81,15 @@ public:
 
 protected:
   virtual ~ImageCapture();
 
   // Capture image by MediaEngine. If it's not support taking photo, this function
   // should return NS_ERROR_NOT_IMPLEMENTED.
   nsresult TakePhotoByMediaEngine();
 
-  RefPtr<VideoStreamTrack> mVideoStreamTrack;
+  RefPtr<VideoStreamTrack> mTrack;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // IMAGECAPTURE_H
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -148,18 +148,16 @@ var interfaceNamesInGlobalScope =
     {name: "AudioParam", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AudioParamMap", insecureContext: true, disabled: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AudioProcessingEvent", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AudioScheduledSourceNode", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "AudioStreamTrack", insecureContext: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AudioWorkletNode", insecureContext: false, disabled: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AuthenticatorAssertionResponse"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AuthenticatorAttestationResponse"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "AuthenticatorResponse"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
@@ -1150,18 +1148,16 @@ var interfaceNamesInGlobalScope =
     {name: "URLSearchParams", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "UserProximityEvent", insecureContext: true, disabled: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "ValidityState", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "VideoPlaybackQuality", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "VideoStreamTrack", insecureContext: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "VisualViewport", insecureContext: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "VRDisplay", insecureContext: true, releaseNonWindows: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "VRDisplayCapabilities", insecureContext: true, releaseNonWindows: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "VRDisplayEvent", insecureContext: true, releaseNonWindows: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
deleted file mode 100644
--- a/dom/webidl/AudioStreamTrack.webidl
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * The origin of this IDL file is
- * http://dev.w3.org/2011/webrtc/editor/getusermedia.html
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
-
-// [Constructor(optional MediaTrackConstraints audioConstraints)]
-interface AudioStreamTrack : MediaStreamTrack {
-//    static sequence<DOMString> getSourceIds ();
-};
--- a/dom/webidl/ImageCapture.webidl
+++ b/dom/webidl/ImageCapture.webidl
@@ -5,20 +5,20 @@
  *
  * The origin of this IDL file is
  * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/ImageCapture.html
  *
  * Copyright © 2012-2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved.
  * W3C liability, trademark and document use rules apply.
  */
 
-[Pref="dom.imagecapture.enabled", Constructor(VideoStreamTrack track)]
+[Pref="dom.imagecapture.enabled", Constructor(MediaStreamTrack track)]
 interface ImageCapture : EventTarget {
   // readonly attribute PhotoSettingsOptions photoSettingsOptions;
-  readonly attribute VideoStreamTrack videoStreamTrack;
+  readonly attribute MediaStreamTrack videoStreamTrack;
   attribute EventHandler onphoto;
   attribute EventHandler onerror;
   // attribute EventHandler onphotosettingschange;
   // attribute EventHandler onframegrab;
 
   // [Throws]
   // void setOptions (PhotoSettings? photoSettings);
   [Throws]
--- a/dom/webidl/MediaStream.webidl
+++ b/dom/webidl/MediaStream.webidl
@@ -24,18 +24,18 @@ dictionary MediaStreamConstraints {
 };
 
 [Exposed=Window,
  Constructor,
  Constructor (MediaStream stream),
  Constructor (sequence<MediaStreamTrack> tracks)]
 interface MediaStream : EventTarget {
     readonly    attribute DOMString    id;
-    sequence<AudioStreamTrack> getAudioTracks ();
-    sequence<VideoStreamTrack> getVideoTracks ();
+    sequence<MediaStreamTrack> getAudioTracks ();
+    sequence<MediaStreamTrack> getVideoTracks ();
     sequence<MediaStreamTrack> getTracks ();
     MediaStreamTrack?          getTrackById (DOMString trackId);
     void                       addTrack (MediaStreamTrack track);
     void                       removeTrack (MediaStreamTrack track);
     MediaStream                clone ();
     readonly    attribute boolean      active;
                 attribute EventHandler onaddtrack;
                 attribute EventHandler onremovetrack;
deleted file mode 100644
--- a/dom/webidl/VideoStreamTrack.webidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * The origin of this IDL file is
- * http://dev.w3.org/2011/webrtc/editor/getusermedia.html
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
-
-// [Constructor(optional MediaTrackConstraints videoConstraints)]
-interface VideoStreamTrack : MediaStreamTrack {
-//    static sequence<DOMString> getSourceIds ();
-//    void                       takePhoto ();
-//                attribute EventHandler onphoto;
-//                attribute EventHandler onphotoerror;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -382,17 +382,16 @@ WEBIDL_FILES = [
     'AudioContext.webidl',
     'AudioDestinationNode.webidl',
     'AudioListener.webidl',
     'AudioNode.webidl',
     'AudioParam.webidl',
     'AudioParamMap.webidl',
     'AudioProcessingEvent.webidl',
     'AudioScheduledSourceNode.webidl',
-    'AudioStreamTrack.webidl',
     'AudioTrack.webidl',
     'AudioTrackList.webidl',
     'AudioWorklet.webidl',
     'AudioWorkletGlobalScope.webidl',
     'AudioWorkletNode.webidl',
     'AudioWorkletProcessor.webidl',
     'AutocompleteInfo.webidl',
     'BarProp.webidl',
@@ -913,17 +912,16 @@ WEBIDL_FILES = [
     'U2F.webidl',
     'UDPMessageEvent.webidl',
     'UDPSocket.webidl',
     'UIEvent.webidl',
     'URL.webidl',
     'URLSearchParams.webidl',
     'ValidityState.webidl',
     'VideoPlaybackQuality.webidl',
-    'VideoStreamTrack.webidl',
     'VideoTrack.webidl',
     'VideoTrackList.webidl',
     'VisualViewport.webidl',
     'VRDisplay.webidl',
     'VRDisplayEvent.webidl',
     'VRServiceTest.webidl',
     'VTTCue.webidl',
     'VTTRegion.webidl',
--- a/testing/web-platform/meta/mediacapture-streams/idlharness.https.window.js.ini
+++ b/testing/web-platform/meta/mediacapture-streams/idlharness.https.window.js.ini
@@ -1,25 +1,19 @@
 [idlharness.https.window.html]
   [MediaStreamTrack interface: operation getCapabilities()]
     expected: FAIL
 
   [MediaStreamTrack interface: attribute onoverconstrained]
     expected: FAIL
 
-  [MediaStreamTrack must be primary interface of [object AudioStreamTrack\]]
+  [MediaStreamTrack interface: [object MediaStreamTrack\] must inherit property "getCapabilities()" with the proper type]
     expected: FAIL
 
-  [Stringification of [object AudioStreamTrack\]]
-    expected: FAIL
-
-  [MediaStreamTrack interface: [object AudioStreamTrack\] must inherit property "getCapabilities()" with the proper type]
-    expected: FAIL
-
-  [MediaStreamTrack interface: [object AudioStreamTrack\] must inherit property "onoverconstrained" with the proper type]
+  [MediaStreamTrack interface: [object MediaStreamTrack\] must inherit property "onoverconstrained" with the proper type]
     expected: FAIL
 
   [OverconstrainedErrorEvent interface: existence and properties of interface object]
     expected: FAIL
 
   [OverconstrainedErrorEvent interface object length]
     expected: FAIL