Backout changeset 4867b986b2c7 and b4185d03b6d5 (bug 1180589) for bustage on CLOSED TREE
authorBrian Birtles <birtles@gmail.com>
Tue, 29 Sep 2015 13:50:23 +0900
changeset 264922 5aefdabff497da857476b2ec28caa22189b28335
parent 264921 31392a3bfe2a6da206c6cfdaff8dcc32d989e2b6
child 264923 7561ecbe5769a90fd6a7165e3e9e2b32027a0a83
push id29450
push usercbook@mozilla.com
push dateTue, 29 Sep 2015 10:00:39 +0000
treeherdermozilla-central@acdb22976ff8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1180589
milestone44.0a1
backs out4867b986b2c788e1ec687266eee5edc8dc672443
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
Backout changeset 4867b986b2c7 and b4185d03b6d5 (bug 1180589) for bustage on CLOSED TREE
dom/tv/TVServiceFactory.cpp
dom/tv/TVSimulatorService.js
dom/tv/TVSimulatorService.manifest
dom/tv/TVSource.cpp
dom/tv/TVTuner.cpp
dom/tv/TVTuner.h
dom/tv/TVTypes.cpp
dom/tv/TVTypes.h
dom/tv/moz.build
dom/tv/nsITVService.idl
dom/tv/nsITVSimulatorService.idl
--- a/dom/tv/TVServiceFactory.cpp
+++ b/dom/tv/TVServiceFactory.cpp
@@ -3,17 +3,16 @@
 /* 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 "mozilla/dom/FakeTVService.h"
 #include "mozilla/dom/TVListeners.h"
 #include "mozilla/Preferences.h"
 #include "nsITVService.h"
-#include "nsITVSimulatorService.h"
 #include "nsServiceManagerUtils.h"
 #include "TVServiceFactory.h"
 
 namespace mozilla {
 namespace dom {
 
 /* static */ already_AddRefed<FakeTVService>
 TVServiceFactory::CreateFakeTVService()
@@ -23,24 +22,18 @@ TVServiceFactory::CreateFakeTVService()
 }
 
 /* static */ already_AddRefed<nsITVService>
 TVServiceFactory::AutoCreateTVService()
 {
   nsresult rv;
   nsCOMPtr<nsITVService> service = do_CreateInstance(TV_SERVICE_CONTRACTID);
   if (!service) {
-    if (Preferences::GetBool("dom.testing.tv_enabled_for_hosted_apps", false)) {
-      // Fallback to the fake service.
-      service = do_CreateInstance(FAKE_TV_SERVICE_CONTRACTID, &rv);
-    } else {
-      // Fallback to the TV Simulator Service
-      service = do_CreateInstance(TV_SIMULATOR_SERVICE_CONTRACTID, &rv);
-    }
-
+    // Fallback to the fake service.
+    service = do_CreateInstance(FAKE_TV_SERVICE_CONTRACTID, &rv);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return nullptr;
     }
   }
 
   rv = service->SetSourceListener(new TVSourceListener());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
deleted file mode 100644
--- a/dom/tv/TVSimulatorService.js
+++ /dev/null
@@ -1,438 +0,0 @@
-/* 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/. */
-"use strict";
-
-function debug(aMsg) {
-   //dump("[TVSimulatorService] " + aMsg + "\n");
-}
-
-const Cc = Components.classes;
-const Cu = Components.utils;
-const Ci = Components.interfaces;
-const Cr = Components.returnCode;
-const TV_SIMULATOR_DUMMY_DIRECTORY = "dummy";
-const TV_SIMULATOR_DUMMY_FILE      = "settings.json";
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-function TVSimulatorService() {
-  this._internalTuners = null;
-  this._scanCompleteTimer = null;
-  this._scanningWrapTunerData = null;
-  this._init();
-}
-
-TVSimulatorService.prototype = {
-  classID: Components.ID("{94b065ad-d45a-436a-b394-6dabc3cf110f}"),
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsITVSimulatorService,
-                                         Ci.nsITVService,
-                                         Ci.nsITimerCallback]),
-
-  _init: function TVSimInit() {
-    if (this._internalTuners) {
-      return;
-    }
-
-    // Load the setting file from local JSON file.
-    // Synchrhronous File Reading.
-    let file = Cc["@mozilla.org/file/local;1"]
-                 .createInstance(Ci.nsILocalFile);
-
-    file.initWithPath(this._getFilePath(TV_SIMULATOR_DUMMY_FILE));
-
-    let fstream = Cc["@mozilla.org/network/file-input-stream;1"]
-                    .createInstance(Ci.nsIFileInputStream);
-    let cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]
-                    .createInstance(Ci.nsIConverterInputStream);
-
-    let settingStr = "";
-
-    try {
-      fstream.init(file, -1, 0, 0);
-      cstream.init(fstream,
-                   "UTF-8",
-                   1024,
-                   Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
-
-      let str = {};
-      while (cstream.readString(0xffffffff, str) != 0) {
-        settingStr += str.value;
-      }
-    } catch(e) {
-      debug("Error occurred : " + e );
-      return;
-    } finally {
-      cstream.close();
-    }
-
-    let settingObj;
-    try {
-      /*
-       *
-       * Setting JSON file format:
-       *
-       * Note: This setting JSON is not allow empty array.
-       *       If set the empty array, _init() will fail.
-       *       e.g.
-       *        - "tuners": []
-       *        - "channels":[]
-       * Format:
-       *   {
-       *    "tuners": [{
-       *      "id":                     "The ID of the tuner",
-       *      "supportedType":          ["The array of source type to be used."],
-       *      "sources": [{
-       *        "type":                 "The source type to be used",
-       *        "channels" : [{
-       *          "networkId":          "The ID of the channel network",
-       *          "transportStreamId":  "The ID of channel transport stream",
-       *          "serviceId":          "The ID of channel service",
-       *          "type":               "The type of channel",
-       *          "name":               "The channel name",
-       *          "number" :            The LCN (Logical Channel Number) of the channel,
-       *          "isEmergency" :       Whether this channel is emergency status,
-       *          "isFree":             Whether this channel is free or not,
-       *          "videoFilePath":      "The path of the fake video file",
-       *          "programs":[{
-       *            "eventId":          "The ID of this program event",
-       *            "title" :           "This program's title",
-       *            "startTime":        "The start time of this program",
-       *            "duration":         "The duration of this program",
-       *            "description":      "The description of this program",
-       *            "rating":           "The rating of this program",
-       *            "audioLanugages":   ["The array of audio language"],
-       *            "subtitleLanguages":["The array of subtitle language"],
-       *           },]
-       *         },]
-       *       },]
-       *     },]
-       *   }
-       */
-      settingObj = JSON.parse(settingStr);
-    } catch(e) {
-      debug("File load error: " + e);
-      return;
-    }
-
-    // Key is as follow
-    // {'tunerId':tunerId, 'sourceType':sourceType}
-    this._internalTuners = new Map();
-
-    // TVTunerData
-    for each (let tunerData in settingObj.tuners) {
-      let tuner = Cc["@mozilla.org/tv/tvtunerdata;1"]
-                    .createInstance(Ci.nsITVTunerData);
-      tuner.id = tunerData.id;
-      tuner.streamType = tuner.TV_STREAM_TYPE_SIMULATOR;
-      tuner.setSupportedSourceTypes(tunerData.supportedType.length,
-                                    tunerData.supportedType);
-
-      let wrapTunerData = {
-        'tuner': tuner,
-        'channels': new Map(),
-        'sourceType': undefined,
-      };
-
-      // TVSource
-      for each (let sourceData in tunerData.sources) {
-        wrapTunerData.sourceType = sourceData.type;
-
-        // TVChannel
-        for each (let channelData in sourceData.channels) {
-          let channel = Cc["@mozilla.org/tv/tvchanneldata;1"]
-                          .createInstance(Ci.nsITVChannelData);
-          channel.networkId         = channelData.networkId;
-          channel.transportStreamId = channelData.transportStreamId;
-          channel.serviceId         = channelData.serviceId;
-          channel.type              = channelData.type;
-          channel.name              = channelData.name;
-          channel.number            = channelData.number;
-          channel.isEmergency       = channelData.isEmergency;
-          channel.isFree            = channelData.isFree;
-
-          let wrapChannelData = {
-            'channel': channel,
-            'programs': new Array(),
-            'videoFilePath': channelData.videoFilePath,
-          };
-
-          // TVProgram
-          for each (let programData in channelData.programs) {
-            let program = Cc["@mozilla.org/tv/tvprogramdata;1"]
-                            .createInstance(Ci.nsITVProgramData);
-            program.eventId     = programData.eventId;
-            program.title       = programData.title;
-            program.startTime   = programData.startTime;
-            program.duration    = programData.duration;
-            program.description = programData.description;
-            program.rating      = programData.rating;
-            program.setAudioLanguages(programData.audioLanguages.length,
-                                      programData.audioLanguages);
-            program.setSubtitleLanguages(programData.subtitleLanguages.length,
-                                         programData.subtitleLanguages);
-            wrapChannelData.programs.push(program);
-          }
-
-          // Sort the program according to the startTime
-	  wrapChannelData.programs.sort(function(a, b) {
-            return a.startTime - b.startTime;
-          });
-          wrapTunerData.channels.set(channel.number, wrapChannelData);
-        }
-
-        // Sort the channel according to the channel number
-        wrapTunerData.channels = new Map([...wrapTunerData.channels.entries()].sort(function(a, b) {
-          return a[0] - b[0];
-        }));
-        this._internalTuners.set(
-                this._getTunerMapKey(tuner.id, sourceData.type),
-                wrapTunerData);
-      }
-    }
-  },
-
-  getTuners: function TVSimGetTuners(aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    let tuners = Cc["@mozilla.org/array;1"]
-                   .createInstance(Ci.nsIMutableArray);
-
-    for (let [k,wrapTunerData] of this._internalTuners) {
-      tuners.appendElement(wrapTunerData.tuner, false);
-    }
-
-    return aCallback.notifySuccess(tuners);
-  },
-
-  setSource: function TVSimSetSource(aTunerId, aSourceType, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-    return aCallback.notifySuccess(null);
-  },
-
-  startScanningChannels: function TVSimStartScanningChannels(aTunerId, aSourceType, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData || !wrapTunerData.channels) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    if (this._scanningWrapTunerData) {
-      return aCallback.notifyError(Cr.NS_ERROR_DOM_INVALID_STATE_ERR);
-    }
-
-    this._scanningWrapTunerData = wrapTunerData;
-
-    aCallback.notifySuccess(null);
-
-    for (let [key, wrapChannelData] of wrapTunerData.channels) {
-      this._sourceListener.notifyChannelScanned(
-                                        wrapTunerData.tuner.id,
-                                        wrapTunerData.sourceType,
-                                        wrapChannelData.channel);
-    }
-
-    this._scanCompleteTimer = Cc["@mozilla.org/timer;1"]
-                                .createInstance(Ci.nsITimer);
-    rv = this._scanCompleteTimer.initWithCallback(this, 10,
-                                                  Ci.nsITimer.TYPE_ONE_SHOT);
-    return Cr.NS_OK;
-  },
-
-  notify: function TVSimTimerCallback(aTimer) {
-    if (!this._scanningWrapTunerData) {
-      return;
-    }
-
-    this._scanCompleteTimer = null;
-    this._scanningWrapTunerData = null;
-    return this._sourceListener.notifyChannelScanComplete(
-                                       this._scanningWrapTunerData.tuner.id,
-                                       this._scanningWrapTunerData.sourceType);
-  },
-
-  stopScanningChannels: function TVSimStopScanningChannels(aTunerId, aSourceType, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    if (!this._scanningWrapTunerData) {
-      return aCallback.notifyError(Cr.NS_ERROR_DOM_INVALID_STATE_ERR);
-    }
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    if (this._scanCompleteTimer) {
-      this._scanCompleteTimer.cancel();
-      this._scanCompleteTimer = null;
-    }
-
-    if (wrapTunerData.tuner.id === this._scanningWrapTunerData.tuner.id &&
-        wrapTunerData.sourceType === this._scanningWrapTunerData.sourceType) {
-      this._scanningWrapTunerData = null;
-      this._sourceListener.notifyChannelScanStopped(
-                                 wrapTunerData.tuner.id,
-                                 wrapTunerData.sourceType);
-    }
-
-    return aCallback.notifySuccess(null);
-  },
-
-  clearScannedChannelsCache: function TVSimClearScannedChannelsCache(aTunerId, aSourceType, aCallback) {
-    // Doesn't support for this method.
-    return Cr.NS_OK;
-  },
-
-  setChannel: function TVSimSetChannel(aTunerId, aSourceType, aChannelNumber, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    let channel = Cc["@mozilla.org/array;1"]
-                    .createInstance(Ci.nsIMutableArray);
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData || !wrapTunerData.channels) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
-    if (!wrapChannelData) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    channel.appendElement(wrapChannelData.channel, false);
-    return aCallback.notifySuccess(channel);
-
-  },
-
-  getChannels: function TVSimGetChannels(aTunerId, aSourceType, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    let channelArray = Cc["@mozilla.org/array;1"]
-                         .createInstance(Ci.nsIMutableArray);
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData || !wrapTunerData.channels) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    for (let [key, wrapChannelData] of wrapTunerData.channels) {
-      channelArray.appendElement(wrapChannelData.channel, false);
-    }
-
-    return aCallback.notifySuccess(channelArray);
-  },
-
-  getPrograms: function TVSimGetPrograms(aTunerId, aSourceType, aChannelNumber, aStartTime, aEndTime, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-    let programArray = Cc["@mozilla.org/array;1"]
-                         .createInstance(Ci.nsIMutableArray);
-
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData || !wrapTunerData.channels) {
-      return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
-    }
-
-    let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
-    if (!wrapChannelData || !wrapChannelData.programs) {
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    for each (let program in wrapChannelData.programs) {
-      programArray.appendElement(program, false);
-    }
-
-    return aCallback.notifySuccess(programArray);
-
-  },
-
-  getOverlayId: function TVSimGetOverlayId(aTunerId, aCallback) {
-    if (!aCallback) {
-      debug("aCallback is null\n");
-      return Cr.NS_ERROR_INVALID_ARG;
-    }
-
-    // TVSimulatorService does not use this parameter.
-    overlayIds = Cc["@mozilla.org/array;1"]
-                  .createInstance(Ci.nsIMutableArray);
-    return aCallback.notifySuccess(overlayIds);
-  },
-
-  set sourceListener(aListener) {
-    this._sourceListener = aListener;
-  },
-
-  get sourceListener() {
-      return this._sourceListener;
-  },
-
-  getSimulatorVideoBlobURL: function TVSimGetSimulatorVideoBlob(aTunerId,
-                                                                aSourceType,
-                                                                aChannelNumber,
-                                                                aWin) {
-    let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
-    if (!wrapTunerData || !wrapTunerData.channels) {
-      return "";
-    }
-
-    let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
-    if (!wrapChannelData) {
-      return "";
-    }
-
-    let videoFile = new File(this._getFilePath(wrapChannelData.videoFilePath));
-    let videoBlobURL = aWin.URL.createObjectURL(videoFile);
-
-    return videoBlobURL;
-  },
-
-  _getTunerMapKey: function TVSimGetTunerMapKey(aTunerId, aSourceType) {
-    return JSON.stringify({'tunerId': aTunerId, 'sourceType': aSourceType});
-  },
-
-  _getWrapTunerData: function TVSimGetWrapTunerData(aTunerId, aSourceType) {
-    if (!this._internalTuners || this._internalTuners.size <= 0) {
-      return null;
-    }
-    return this._internalTuners.get(this._getTunerMapKey(aTunerId, aSourceType));
-  },
-
-  _getFilePath: function TVSimGetFilePathFromDummyDirectory(fileName) {
-    let dsFile = Cc["@mozilla.org/file/directory_service;1"]
-                   .getService(Ci.nsIProperties)
-                   .get("ProfD", Ci.nsIFile);
-    dsFile.append(TV_SIMULATOR_DUMMY_DIRECTORY);
-    dsFile.append(fileName);
-
-    return dsFile.path;
-  },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TVSimulatorService]);
deleted file mode 100644
--- a/dom/tv/TVSimulatorService.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-component {94b065ad-d45a-436a-b394-6dabc3cf110f} TVSimulatorService.js
-contract @mozilla.org/tv/simulatorservice;1 {94b065ad-d45a-436a-b394-6dabc3cf110f}
-TVSimulatorService @mozilla.org/tv/simulatorservice;1
--- a/dom/tv/TVSource.cpp
+++ b/dom/tv/TVSource.cpp
@@ -128,24 +128,16 @@ TVSource::SetCurrentChannel(nsITVChannel
       // No actual change.
       return NS_OK;
     }
   }
 
   mCurrentChannel = TVChannel::Create(GetOwner(), this, aChannelData);
   NS_ENSURE_TRUE(mCurrentChannel, NS_ERROR_DOM_ABORT_ERR);
 
-  nsRefPtr<TVSource> currentSource = mTuner->GetCurrentSource();
-  if (currentSource && mType == currentSource->Type()) {
-    rv = mTuner->ReloadMediaStream();
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-  }
-
   return DispatchCurrentChannelChangedEvent(mCurrentChannel);
 }
 
 nsresult
 TVSource::UnsetCurrentChannel()
 {
   mCurrentChannel = nullptr;
   return DispatchCurrentChannelChangedEvent(mCurrentChannel);
--- a/dom/tv/TVTuner.cpp
+++ b/dom/tv/TVTuner.cpp
@@ -8,20 +8,18 @@
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/TVCurrentSourceChangedEvent.h"
 #include "mozilla/dom/TVServiceCallbacks.h"
 #include "mozilla/dom/TVServiceFactory.h"
 #include "mozilla/dom/TVSource.h"
 #include "mozilla/dom/TVUtils.h"
 #include "nsISupportsPrimitives.h"
 #include "nsITVService.h"
-#include "nsITVSimulatorService.h"
 #include "nsServiceManagerUtils.h"
 #include "TVTuner.h"
-#include "mozilla/dom/HTMLVideoElement.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(TVTuner, DOMEventTargetHelper,
                                    mTVService, mStream, mCurrentSource, mSources)
 
 NS_IMPL_ADDREF_INHERITED(TVTuner, DOMEventTargetHelper)
@@ -78,19 +76,16 @@ TVTuner::Init(nsITVTunerData* aData)
     mSupportedSourceTypes.AppendElement(sourceType);
     mSources.AppendElement(source);
   }
   NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, supportedSourceTypes);
 
   mTVService = TVServiceFactory::AutoCreateTVService();
   NS_ENSURE_TRUE(mTVService, false);
 
-  rv = aData->GetStreamType(&mStreamType);
-  NS_ENSURE_SUCCESS(rv, false);
-
   return true;
 }
 
 /* virtual */ JSObject*
 TVTuner::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return TVTunerBinding::Wrap(aCx, this, aGivenProto);
 }
@@ -195,120 +190,25 @@ TVTuner::GetCurrentSource() const
 already_AddRefed<DOMMediaStream>
 TVTuner::GetStream() const
 {
   nsRefPtr<DOMMediaStream> stream = mStream;
   return stream.forget();
 }
 
 nsresult
-TVTuner::ReloadMediaStream()
-{
-  return InitMediaStream();
-}
-
-nsresult
 TVTuner::InitMediaStream()
 {
   nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(GetOwner());
-  nsRefPtr<DOMMediaStream> stream = nullptr;
-  if (mStreamType == nsITVTunerData::TV_STREAM_TYPE_HW) {
-    stream = DOMHwMediaStream::CreateHwStream(window);
-  } else if (mStreamType == nsITVTunerData::TV_STREAM_TYPE_SIMULATOR) {
-    stream = CreateSimulatedMediaStream();
-  }
+  nsRefPtr<DOMHwMediaStream> stream = DOMHwMediaStream::CreateHwStream(window);
 
   mStream = stream.forget();
   return NS_OK;
 }
 
-already_AddRefed<DOMMediaStream>
-TVTuner::CreateSimulatedMediaStream()
-{
-  ErrorResult error;
-
-  nsIDocument* doc = GetOwner()->GetExtantDoc();
-  if (NS_WARN_IF(!doc)) {
-    return nullptr;
-  }
-  nsRefPtr<Element> element = doc->CreateElement(VIDEO_TAG, error);
-  if (NS_WARN_IF(error.Failed())) {
-    return nullptr;
-  }
-
-  nsCOMPtr<nsIContent> content(do_QueryInterface(element));
-  if (NS_WARN_IF(!content)) {
-    return nullptr;
-  }
-
-  HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(content.get());
-  if (NS_WARN_IF(!mediaElement)) {
-    return nullptr;
-  }
-
-  mediaElement->SetAutoplay(true, error);
-  if (NS_WARN_IF(error.Failed())) {
-    return nullptr;
-  }
-
-  mediaElement->SetLoop(true, error);
-  if (NS_WARN_IF(error.Failed())) {
-    return nullptr;
-  }
-
-  nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(GetOwner()));
-  if (NS_WARN_IF(!domWin)) {
-    return nullptr;
-  }
-
-  nsCOMPtr<nsITVSimulatorService> simService(do_QueryInterface(mTVService));
-  if (NS_WARN_IF(!simService)) {
-    return nullptr;
-  }
-
-  if (NS_WARN_IF(!mCurrentSource)) {
-    return nullptr;
-  }
-
-  nsRefPtr<TVChannel> currentChannel = mCurrentSource->GetCurrentChannel();
-  if (NS_WARN_IF(!currentChannel)) {
-    return nullptr;
-  }
-
-  nsString currentChannelNumber;
-  currentChannel->GetNumber(currentChannelNumber);
-  if (currentChannelNumber.IsEmpty()) {
-    return nullptr;
-  }
-
-  nsString currentVideoBlobUrl;
-  nsresult rv = simService->GetSimulatorVideoBlobURL(mId,
-                                                     ToTVSourceTypeStr(mCurrentSource->Type()),
-                                                     currentChannelNumber,
-                                                     domWin,
-                                                     currentVideoBlobUrl);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return nullptr;
-  }
-
-  mediaElement->SetSrc(currentVideoBlobUrl, error);
-  if (NS_WARN_IF(error.Failed())) {
-    return nullptr;
-  }
-
-  // See Media Capture from DOM Elements spec.
-  // http://www.w3.org/TR/mediacapture-fromelement/
-  nsRefPtr<DOMMediaStream> stream = mediaElement->MozCaptureStream(error);
-  if (NS_WARN_IF(error.Failed())) {
-    return nullptr;
-  }
-
-  return stream.forget();
-}
-
 nsresult
 TVTuner::DispatchCurrentSourceChangedEvent(TVSource* aSource)
 {
   TVCurrentSourceChangedEventInit init;
   init.mSource = aSource;
   nsCOMPtr<nsIDOMEvent> event =
     TVCurrentSourceChangedEvent::Constructor(this,
                                              NS_LITERAL_STRING("currentsourcechanged"),
--- a/dom/tv/TVTuner.h
+++ b/dom/tv/TVTuner.h
@@ -6,18 +6,16 @@
 
 #ifndef mozilla_dom_TVTuner_h
 #define mozilla_dom_TVTuner_h
 
 #include "mozilla/DOMEventTargetHelper.h"
 // Include TVTunerBinding.h since enum TVSourceType can't be forward declared.
 #include "mozilla/dom/TVTunerBinding.h"
 
-#define VIDEO_TAG NS_LITERAL_STRING("video")
-
 class nsITVService;
 class nsITVTunerData;
 
 namespace mozilla {
 
 class DOMMediaStream;
 
 namespace dom {
@@ -56,34 +54,29 @@ public:
   void GetId(nsAString& aId) const;
 
   already_AddRefed<TVSource> GetCurrentSource() const;
 
   already_AddRefed<DOMMediaStream> GetStream() const;
 
   IMPL_EVENT_HANDLER(currentsourcechanged);
 
-  nsresult ReloadMediaStream();
-
 private:
   explicit TVTuner(nsPIDOMWindow* aWindow);
 
   ~TVTuner();
 
   bool Init(nsITVTunerData* aData);
 
   nsresult InitMediaStream();
 
-  already_AddRefed<DOMMediaStream> CreateSimulatedMediaStream();
-
   nsresult DispatchCurrentSourceChangedEvent(TVSource* aSource);
 
   nsCOMPtr<nsITVService> mTVService;
   nsRefPtr<DOMMediaStream> mStream;
-  uint16_t mStreamType;
   nsRefPtr<TVSource> mCurrentSource;
   nsTArray<nsRefPtr<TVSource>> mSources;
   nsString mId;
   nsTArray<TVSourceType> mSupportedSourceTypes;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/tv/TVTypes.cpp
+++ b/dom/tv/TVTypes.cpp
@@ -44,30 +44,16 @@ TVTunerData::SetId(const nsAString& aId)
     return NS_ERROR_INVALID_ARG;
   }
 
   mId = aId;
   return NS_OK;
 }
 
 /* virtual */ NS_IMETHODIMP
-TVTunerData::GetStreamType(uint16_t* aStreamType)
-{
-  *aStreamType = mStreamType;
-  return NS_OK;
-}
-
-/* virtual */ NS_IMETHODIMP
-TVTunerData::SetStreamType(const uint16_t aStreamType)
-{
-  mStreamType = aStreamType;
-  return NS_OK;
-}
-
-/* virtual */ NS_IMETHODIMP
 TVTunerData::GetSupportedSourceTypes(uint32_t* aCount,
                                      char*** aSourceTypes)
 {
   *aCount = mCount;
 
   char** sourceTypes = (mCount > 0) ?
                        static_cast<char **>(moz_xmalloc(mCount * sizeof(char*))) :
                        nullptr;
--- a/dom/tv/TVTypes.h
+++ b/dom/tv/TVTypes.h
@@ -21,17 +21,16 @@ public:
   TVTunerData();
 
 private:
   ~TVTunerData();
 
   nsString mId;
   char** mSupportedSourceTypes;
   uint32_t mCount;
-  uint16_t mStreamType;
 };
 
 class TVChannelData final : public nsITVChannelData
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSITVCHANNELDATA
 
--- a/dom/tv/moz.build
+++ b/dom/tv/moz.build
@@ -29,22 +29,16 @@ UNIFIED_SOURCES += [
     'TVServiceFactory.cpp',
     'TVSource.cpp',
     'TVTuner.cpp',
     'TVTypes.cpp',
 ]
 
 XPIDL_SOURCES += [
     'nsITVService.idl',
-    'nsITVSimulatorService.idl',
-]
-
-EXTRA_COMPONENTS += [
-    'TVSimulatorService.js',
-    'TVSimulatorService.manifest',
 ]
 
 XPIDL_MODULE = 'dom_tv'
 
 MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
--- a/dom/tv/nsITVService.idl
+++ b/dom/tv/nsITVService.idl
@@ -15,29 +15,19 @@ interface nsIArray;
 
 /**
  * XPCOM component which acts as the container for tuner data.
  *
  * NOTE: Use do_CreateInstance() to create the Gecko provided implementation,
  * and then uses the setter functions to adjust the properties of the object
  * before passing it.
  */
-[scriptable, builtinclass, uuid(c6d39e86-022b-4db5-b0df-602abfbeac69)]
+[scriptable, builtinclass, uuid(608d3f7e-f9f1-4b3c-82c2-3eb60b1d3de8)]
 interface nsITVTunerData : nsISupports
 {
-  /**
-   * Switch TVTuner.stream type.
-   *  TV_STREAM_TYPE_SIMULATOR : Simulate the MediaStream. This MediaStream load from Profile Directory.
-   *  TV_STREAM_TYPE_HW        : Get from real device
-   */
-  const unsigned short TV_STREAM_TYPE_SIMULATOR = 0;
-  const unsigned short TV_STREAM_TYPE_HW = 1;
-
-  attribute unsigned short streamType;
-
   attribute DOMString id;
 
   /**
    * Get the supported source types of the tuner. Please refer to
    * http://seanyhlin.github.io/TV-Manager-API/ for available values.
    *
    * @param count       The number of supported source types.
    * @param sourceTypes An array of supported source types.
@@ -143,17 +133,17 @@ interface nsITVProgramData : nsISupports
    *
    * @param count     The number of languages.
    * @param languages An array of languages.
    */
   void setSubtitleLanguages(in unsigned long count,
                             [array, size_is(count)] in string languages);
 };
 
-[scriptable, builtinclass, uuid(47746633-1b77-4df4-9424-d315bde3d455)]
+[builtinclass, uuid(c3fd7a8c-21e4-11e4-97e8-74d02b97e723)]
 interface nsITVSourceListener : nsISupports
 {
   /**
    * Called when a channel is detected through scanning (after
    * |nsITVService::startScanningChannels()| is invoked and probably before
    * |nsITVService::stopScanningChannels()|, if any, is invoked).
    *
    * @param tunerId     The ID of the tuner which the source belongs to.
@@ -203,17 +193,17 @@ interface nsITVSourceListener : nsISuppo
    */
   void notifyEITBroadcasted(in DOMString tunerId,
                             in DOMString sourceType,
                             in nsITVChannelData channelData,
                             [array, size_is(count)] in nsITVProgramData programDataList,
                             in unsigned long count);
 };
 
-[scriptable, builtinclass, uuid(01582a11-4707-455d-8d2a-2c8de8227dad)]
+[builtinclass, uuid(a19e6e7e-2293-11e4-b335-74d02b97e723)]
 interface nsITVServiceCallback : nsISupports
 {
   const unsigned short TV_ERROR_OK = 0;
   const unsigned short TV_ERROR_FAILURE = 1;
   const unsigned short TV_ERROR_INVALID_ARG = 2;
   const unsigned short TV_ERROR_NO_SIGNAL = 3;
   const unsigned short TV_ERROR_NOT_SUPPORTED = 4;
 
@@ -263,17 +253,17 @@ interface nsITVServiceCallback : nsISupp
  * the callback off of the runnables, after the function returns.
  * TVServiceRunnables.h provides some ready-made runnables and could be used in
  * the following way.
  *
  * nsCOMPtr<nsIRunnable> runnable =
  *   new TVServiceNotifyRunnable(callback, dataList, optional errorCode);
  * return NS_DispatchToCurrentThread(runnable);
  */
-[scriptable, uuid(e52f93f1-6071-468b-a198-d8e6bc5ca348)]
+[uuid(1b17e3cc-1c84-11e4-a4d4-74d02b97e723)]
 interface nsITVService : nsISupports
 {
   attribute nsITVSourceListener sourceListener;
 
   /**
    * Get all tuners.
    *
    * @param callback   The callback object where either |notifyError| or
@@ -385,9 +375,8 @@ interface nsITVService : nsISupports
    * @param tunerId       The ID of the tuner.
    * @param callback      The callback object where either |notifyError| or
    *                      |notifySuccess|, which takes an array of
    *                      |nsISupportsString| with only one element, is expected.
    */
   void getOverlayId(in DOMString tunerId,
                     in nsITVServiceCallback callback);
 };
-
deleted file mode 100644
--- a/dom/tv/nsITVSimulatorService.idl
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 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 "nsISupports.idl"
-#include "nsITVService.idl"
-#include "nsIDOMWindow.idl"
-
-%{C++
-#define TV_SIMULATOR_SERVICE_CONTRACTID\
-  "@mozilla.org/tv/simulatorservice;1"
-%}
-
-[scriptable, uuid(8ecae67d-a959-4f8a-a786-14dc12bd8d3c)]
-interface nsITVSimulatorService : nsITVService
-{
-  /*
-   * Get the URL of simulated video blob.
-   *
-   * @param tunerId       The ID of the tuner.
-   * @param sourceType    The source type to be used.
-   * @param channelNumber The LCN (Logical Channel Number) of the channel.
-   * @param window        The window object of content.
-   * @return blobUrl      The URL of created blob from local video file.
-   */
-  void getSimulatorVideoBlobURL(in DOMString tunerId,
-                                in DOMString sourceType,
-                                in DOMString channelNumber,
-                                in nsIDOMWindow window,
-                                [retval] out DOMString blobUrl);
-};