Bug 1357323 - Remove the gonk code that was referenced by the build system. r?gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 18 Apr 2017 17:46:39 +0900
changeset 564155 a7d8582f942e10cb79336f4ceb4802fda191aa1b
parent 564154 6a8de757e9c7b3b6be14340a654bc27166d3e788
child 624685 6d38c3f4c1b7142c257624fae95aae0bccfa5533
push id54543
push userbmo:mh+mozilla@glandium.org
push dateTue, 18 Apr 2017 10:07:54 +0000
reviewersgps
bugs1357323
milestone55.0a1
Bug 1357323 - Remove the gonk code that was referenced by the build system. r?gps
dom/media/encoder/fmp4_muxer/AMRBox.cpp
dom/media/encoder/fmp4_muxer/AMRBox.h
dom/media/encoder/fmp4_muxer/AVCBox.cpp
dom/media/encoder/fmp4_muxer/AVCBox.h
dom/media/encoder/fmp4_muxer/EVRCBox.cpp
dom/media/encoder/fmp4_muxer/EVRCBox.h
dom/media/encoder/fmp4_muxer/ISOControl.cpp
dom/media/encoder/fmp4_muxer/ISOControl.h
dom/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp
dom/media/encoder/fmp4_muxer/ISOMediaBoxes.h
dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp
dom/media/encoder/fmp4_muxer/ISOMediaWriter.h
dom/media/encoder/fmp4_muxer/ISOTrackMetadata.h
dom/media/encoder/fmp4_muxer/MP4ESDS.cpp
dom/media/encoder/fmp4_muxer/MP4ESDS.h
dom/media/encoder/fmp4_muxer/MuxerOperation.h
dom/media/encoder/fmp4_muxer/moz.build
dom/media/platforms/omx/GonkOmxPlatformLayer.cpp
dom/media/platforms/omx/GonkOmxPlatformLayer.h
dom/network/EthernetManager.js
dom/network/EthernetManager.manifest
dom/network/NetUtils.cpp
dom/network/NetUtils.h
dom/network/interfaces/nsIEthernetManager.idl
dom/secureelement/SEUtils.jsm
dom/secureelement/gonk/ACEService.js
dom/secureelement/gonk/ACEService.manifest
dom/secureelement/gonk/GPAccessRulesManager.js
dom/secureelement/gonk/GPAccessRulesManager.manifest
dom/secureelement/gonk/SecureElement.js
dom/secureelement/gonk/SecureElement.manifest
dom/secureelement/gonk/UiccConnector.js
dom/secureelement/gonk/UiccConnector.manifest
dom/secureelement/gonk/gp_consts.js
dom/secureelement/gonk/nsIAccessControlEnforcer.idl
dom/secureelement/gonk/nsIAccessRulesManager.idl
dom/secureelement/gonk/nsISecureElementConnector.idl
dom/secureelement/gonk/se_consts.js
dom/secureelement/tests/unit/header_helper.js
dom/secureelement/tests/unit/test_SEUtils.js
dom/secureelement/tests/unit/xpcshell.ini
dom/system/gonk/AudioChannelManager.cpp
dom/system/gonk/AudioChannelManager.h
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AudioManager.h
dom/system/gonk/AutoMounter.cpp
dom/system/gonk/AutoMounter.h
dom/system/gonk/AutoMounterSetting.cpp
dom/system/gonk/AutoMounterSetting.h
dom/system/gonk/DataCallInterfaceService.js
dom/system/gonk/DataCallInterfaceService.manifest
dom/system/gonk/DataCallManager.js
dom/system/gonk/DataCallManager.manifest
dom/system/gonk/GeolocationUtil.cpp
dom/system/gonk/GeolocationUtil.h
dom/system/gonk/GonkGPSGeolocationProvider.cpp
dom/system/gonk/GonkGPSGeolocationProvider.h
dom/system/gonk/MozMtpCommon.h
dom/system/gonk/MozMtpDatabase.cpp
dom/system/gonk/MozMtpDatabase.h
dom/system/gonk/MozMtpServer.cpp
dom/system/gonk/MozMtpServer.h
dom/system/gonk/MozMtpStorage.cpp
dom/system/gonk/MozMtpStorage.h
dom/system/gonk/NetIdManager.cpp
dom/system/gonk/NetIdManager.h
dom/system/gonk/NetworkInterfaceListService.js
dom/system/gonk/NetworkInterfaceListService.manifest
dom/system/gonk/NetworkManager.js
dom/system/gonk/NetworkManager.manifest
dom/system/gonk/NetworkService.js
dom/system/gonk/NetworkService.manifest
dom/system/gonk/NetworkUtils.cpp
dom/system/gonk/NetworkUtils.h
dom/system/gonk/NetworkWorker.cpp
dom/system/gonk/NetworkWorker.h
dom/system/gonk/OpenFileFinder.cpp
dom/system/gonk/OpenFileFinder.h
dom/system/gonk/RILSystemMessenger.jsm
dom/system/gonk/RILSystemMessengerHelper.js
dom/system/gonk/RILSystemMessengerHelper.manifest
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/RadioInterfaceLayer.manifest
dom/system/gonk/SystemProperty.cpp
dom/system/gonk/SystemProperty.h
dom/system/gonk/SystemWorkerManager.cpp
dom/system/gonk/SystemWorkerManager.h
dom/system/gonk/TetheringService.js
dom/system/gonk/TetheringService.manifest
dom/system/gonk/TimeZoneSettingObserver.cpp
dom/system/gonk/TimeZoneSettingObserver.h
dom/system/gonk/Volume.cpp
dom/system/gonk/Volume.h
dom/system/gonk/VolumeCommand.cpp
dom/system/gonk/VolumeCommand.h
dom/system/gonk/VolumeManager.cpp
dom/system/gonk/VolumeManager.h
dom/system/gonk/VolumeManagerLog.h
dom/system/gonk/VolumeServiceIOThread.cpp
dom/system/gonk/VolumeServiceIOThread.h
dom/system/gonk/VolumeServiceTest.cpp
dom/system/gonk/VolumeServiceTest.h
dom/system/gonk/android_audio/AudioSystem.h
dom/system/gonk/android_audio/AudioTrack.h
dom/system/gonk/android_audio/EffectApi.h
dom/system/gonk/android_audio/IAudioFlinger.h
dom/system/gonk/android_audio/IAudioFlingerClient.h
dom/system/gonk/android_audio/IAudioRecord.h
dom/system/gonk/android_audio/IAudioTrack.h
dom/system/gonk/android_audio/IEffect.h
dom/system/gonk/android_audio/IEffectClient.h
dom/system/gonk/moz.build
dom/system/gonk/mozstumbler/MozStumbler.cpp
dom/system/gonk/mozstumbler/MozStumbler.h
dom/system/gonk/mozstumbler/StumblerLogging.cpp
dom/system/gonk/mozstumbler/StumblerLogging.h
dom/system/gonk/mozstumbler/UploadStumbleRunnable.cpp
dom/system/gonk/mozstumbler/UploadStumbleRunnable.h
dom/system/gonk/mozstumbler/WriteStumbleOnThread.cpp
dom/system/gonk/mozstumbler/WriteStumbleOnThread.h
dom/system/gonk/nsIAudioManager.idl
dom/system/gonk/nsIDataCallInterfaceService.idl
dom/system/gonk/nsIDataCallManager.idl
dom/system/gonk/nsIGonkDataCallInterfaceService.idl
dom/system/gonk/nsINetworkInterface.idl
dom/system/gonk/nsINetworkInterfaceListService.idl
dom/system/gonk/nsINetworkManager.idl
dom/system/gonk/nsINetworkService.idl
dom/system/gonk/nsINetworkWorker.idl
dom/system/gonk/nsIRadioInterfaceLayer.idl
dom/system/gonk/nsISystemWorkerManager.idl
dom/system/gonk/nsITetheringService.idl
dom/system/gonk/nsIVolume.idl
dom/system/gonk/nsIVolumeMountLock.idl
dom/system/gonk/nsIVolumeService.idl
dom/system/gonk/nsIVolumeStat.idl
dom/system/gonk/nsIWorkerHolder.idl
dom/system/gonk/nsVolume.cpp
dom/system/gonk/nsVolume.h
dom/system/gonk/nsVolumeMountLock.cpp
dom/system/gonk/nsVolumeMountLock.h
dom/system/gonk/nsVolumeService.cpp
dom/system/gonk/nsVolumeService.h
dom/system/gonk/nsVolumeStat.cpp
dom/system/gonk/nsVolumeStat.h
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
dom/system/gonk/ril_worker_buf_object.js
dom/system/gonk/ril_worker_telephony_request_queue.js
dom/system/gonk/systemlibs.js
dom/system/gonk/tests/header_helpers.js
dom/system/gonk/tests/marionette/head.js
dom/system/gonk/tests/marionette/manifest.ini
dom/system/gonk/tests/marionette/ril_jshint/README.md
dom/system/gonk/tests/marionette/ril_jshint/jshint.js
dom/system/gonk/tests/marionette/ril_jshint/jshintrc
dom/system/gonk/tests/marionette/test_all_network_info.js
dom/system/gonk/tests/marionette/test_data_connection.js
dom/system/gonk/tests/marionette/test_data_connection_proxy.js
dom/system/gonk/tests/marionette/test_dsds_numRadioInterfaces.js
dom/system/gonk/tests/marionette/test_geolocation.js
dom/system/gonk/tests/marionette/test_multiple_data_connection.js
dom/system/gonk/tests/marionette/test_network_active_changed.js
dom/system/gonk/tests/marionette/test_network_interface_list_service.js
dom/system/gonk/tests/marionette/test_network_interface_mtu.js
dom/system/gonk/tests/marionette/test_ril_code_quality.py
dom/system/gonk/tests/marionette/test_screen_state.js
dom/system/gonk/tests/marionette/test_timezone_changes.js
dom/system/gonk/tests/test_ril_system_messenger.js
dom/system/gonk/tests/test_ril_worker_barring_password.js
dom/system/gonk/tests/test_ril_worker_buf.js
dom/system/gonk/tests/test_ril_worker_cdma_info_rec.js
dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js
dom/system/gonk/tests/test_ril_worker_cellbroadcast_gsm.js
dom/system/gonk/tests/test_ril_worker_cellbroadcast_umts.js
dom/system/gonk/tests/test_ril_worker_cf.js
dom/system/gonk/tests/test_ril_worker_clip.js
dom/system/gonk/tests/test_ril_worker_clir.js
dom/system/gonk/tests/test_ril_worker_cw.js
dom/system/gonk/tests/test_ril_worker_ecm.js
dom/system/gonk/tests/test_ril_worker_icc_BerTlvHelper.js
dom/system/gonk/tests/test_ril_worker_icc_CardLock.js
dom/system/gonk/tests/test_ril_worker_icc_CardState.js
dom/system/gonk/tests/test_ril_worker_icc_GsmPDUHelper.js
dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js
dom/system/gonk/tests/test_ril_worker_icc_ICCIOHelper.js
dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js
dom/system/gonk/tests/test_ril_worker_icc_ICCRecordHelper.js
dom/system/gonk/tests/test_ril_worker_icc_ICCUtilsHelper.js
dom/system/gonk/tests/test_ril_worker_icc_IconLoader.js
dom/system/gonk/tests/test_ril_worker_icc_SimRecordHelper.js
dom/system/gonk/tests/test_ril_worker_ruim.js
dom/system/gonk/tests/test_ril_worker_sms.js
dom/system/gonk/tests/test_ril_worker_sms_cdma.js
dom/system/gonk/tests/test_ril_worker_sms_cdmapduhelper.js
dom/system/gonk/tests/test_ril_worker_sms_gsmpduhelper.js
dom/system/gonk/tests/test_ril_worker_sms_nl_tables.js
dom/system/gonk/tests/test_ril_worker_sms_segment_info.js
dom/system/gonk/tests/test_ril_worker_smsc_address.js
dom/system/gonk/tests/test_ril_worker_ssn.js
dom/system/gonk/tests/test_ril_worker_stk.js
dom/system/gonk/tests/test_ril_worker_voiceprivacy.js
dom/system/gonk/tests/xpcshell.ini
dom/system/gonk/worker_buf.js
hal/gonk/GonkDiskSpaceWatcher.cpp
hal/gonk/GonkHal.cpp
hal/gonk/GonkSensor.cpp
hal/gonk/GonkSensorsHelpers.cpp
hal/gonk/GonkSensorsHelpers.h
hal/gonk/GonkSensorsInterface.cpp
hal/gonk/GonkSensorsInterface.h
hal/gonk/GonkSensorsPollInterface.cpp
hal/gonk/GonkSensorsPollInterface.h
hal/gonk/GonkSensorsRegistryInterface.cpp
hal/gonk/GonkSensorsRegistryInterface.h
hal/gonk/GonkSwitch.cpp
hal/gonk/SensorsTypes.h
hal/gonk/SystemService.cpp
hal/gonk/UeventPoller.cpp
hal/gonk/UeventPoller.h
hal/gonk/fanotify.h
hal/gonk/tavarua.h
ipc/hal/DaemonRunnables.h
ipc/hal/DaemonSocket.cpp
ipc/hal/DaemonSocket.h
ipc/hal/DaemonSocketConnector.cpp
ipc/hal/DaemonSocketConnector.h
ipc/hal/DaemonSocketConsumer.cpp
ipc/hal/DaemonSocketConsumer.h
ipc/hal/DaemonSocketMessageHandlers.h
ipc/hal/DaemonSocketPDU.cpp
ipc/hal/DaemonSocketPDU.h
ipc/hal/DaemonSocketPDUHelpers.cpp
ipc/hal/DaemonSocketPDUHelpers.h
ipc/hal/moz.build
ipc/netd/Netd.cpp
ipc/netd/Netd.h
ipc/netd/moz.build
ipc/unixfd/UnixFdWatcher.cpp
ipc/unixfd/UnixFdWatcher.h
ipc/unixfd/UnixFileWatcher.cpp
ipc/unixfd/UnixFileWatcher.h
ipc/unixfd/UnixSocketWatcher.cpp
ipc/unixfd/UnixSocketWatcher.h
ipc/unixfd/moz.build
ipc/unixsocket/ConnectionOrientedSocket.cpp
ipc/unixsocket/ConnectionOrientedSocket.h
ipc/unixsocket/DataSocket.cpp
ipc/unixsocket/DataSocket.h
ipc/unixsocket/ListenSocket.cpp
ipc/unixsocket/ListenSocket.h
ipc/unixsocket/ListenSocketConsumer.cpp
ipc/unixsocket/ListenSocketConsumer.h
ipc/unixsocket/SocketBase.cpp
ipc/unixsocket/SocketBase.h
ipc/unixsocket/StreamSocket.cpp
ipc/unixsocket/StreamSocket.h
ipc/unixsocket/StreamSocketConsumer.cpp
ipc/unixsocket/StreamSocketConsumer.h
ipc/unixsocket/UnixSocketConnector.cpp
ipc/unixsocket/UnixSocketConnector.h
ipc/unixsocket/moz.build
mozglue/build/cpuacct.c
mozglue/build/cpuacct.h
netwerk/base/NetStatistics.h
netwerk/wifi/nsWifiMonitorGonk.cpp
uriloader/exthandler/gonk/nsOSHelperAppService.cpp
uriloader/exthandler/gonk/nsOSHelperAppService.h
widget/gonk/moz.build
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/AMRBox.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "AMRBox.h"
-#include "ISOTrackMetadata.h"
-
-namespace mozilla {
-
-nsresult
-AMRSampleEntry::Generate(uint32_t* aBoxSize)
-{
-  uint32_t box_size;
-  nsresult rv = amr_special_box->Generate(&box_size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  size += box_size;
-
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-AMRSampleEntry::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  nsresult rv;
-  rv = AudioSampleEntry::Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = amr_special_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-AMRSampleEntry::AMRSampleEntry(ISOControl* aControl)
-  : AudioSampleEntry(NS_LITERAL_CSTRING("samr"), aControl)
-{
-  amr_special_box = new AMRSpecificBox(aControl);
-  MOZ_COUNT_CTOR(AMRSampleEntry);
-}
-
-AMRSampleEntry::~AMRSampleEntry()
-{
-  MOZ_COUNT_DTOR(AMRSampleEntry);
-}
-
-nsresult
-AMRSpecificBox::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv;
-  FragmentBuffer* frag = mControl->GetFragment(Audio_Track);
-  rv = frag->GetCSD(amrDecSpecInfo);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  size += amrDecSpecInfo.Length();
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-AMRSpecificBox::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-  mControl->Write(amrDecSpecInfo.Elements(), amrDecSpecInfo.Length());
-  return NS_OK;
-}
-
-AMRSpecificBox::AMRSpecificBox(ISOControl* aControl)
-  : Box(NS_LITERAL_CSTRING("damr"), aControl)
-{
-  MOZ_COUNT_CTOR(AMRSpecificBox);
-}
-
-AMRSpecificBox::~AMRSpecificBox()
-{
-  MOZ_COUNT_DTOR(AMRSpecificBox);
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/AMRBox.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef AMRBOX_h_
-#define AMRBOX_h_
-
-#include "nsTArray.h"
-#include "MuxerOperation.h"
-
-namespace mozilla {
-
-class ISOControl;
-
-// 3GPP TS 26.244 6.7 'AMRSpecificBox field for AMRSampleEntry box'
-// Box type: 'damr'
-class AMRSpecificBox : public Box {
-public:
-  // 3GPP members
-  nsTArray<uint8_t> amrDecSpecInfo;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // AMRSpecificBox methods
-  AMRSpecificBox(ISOControl* aControl);
-  ~AMRSpecificBox();
-};
-
-// 3GPP TS 26.244 6.5 'AMRSampleEntry box'
-// Box type: 'sawb'
-class AMRSampleEntry : public AudioSampleEntry {
-public:
-  // 3GPP members
-  RefPtr<AMRSpecificBox> amr_special_box;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // AMRSampleEntry methods
-  AMRSampleEntry(ISOControl* aControl);
-  ~AMRSampleEntry();
-};
-
-}
-
-#endif // AMRBOX_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/AVCBox.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include <climits>
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "AVCBox.h"
-
-namespace mozilla {
-
-nsresult
-AVCSampleEntry::Generate(uint32_t* aBoxSize)
-{
-  uint32_t avc_box_size = 0;
-  nsresult rv;
-  rv = avcConfigBox->Generate(&avc_box_size);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  size += avc_box_size;
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-AVCSampleEntry::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  nsresult rv;
-  rv = VisualSampleEntry::Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = avcConfigBox->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-AVCSampleEntry::AVCSampleEntry(ISOControl* aControl)
-  : VisualSampleEntry(NS_LITERAL_CSTRING("avc1"), aControl)
-{
-  avcConfigBox = new AVCConfigurationBox(aControl);
-  MOZ_COUNT_CTOR(AVCSampleEntry);
-}
-
-AVCSampleEntry::~AVCSampleEntry()
-{
-  MOZ_COUNT_DTOR(AVCSampleEntry);
-}
-
-AVCConfigurationBox::AVCConfigurationBox(ISOControl* aControl)
-  : Box(NS_LITERAL_CSTRING("avcC"), aControl)
-{
-  MOZ_COUNT_CTOR(AVCConfigurationBox);
-}
-
-AVCConfigurationBox::~AVCConfigurationBox()
-{
-  MOZ_COUNT_DTOR(AVCConfigurationBox);
-}
-
-nsresult
-AVCConfigurationBox::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv;
-  FragmentBuffer* frag = mControl->GetFragment(Video_Track);
-  rv = frag->GetCSD(avcConfig);
-  NS_ENSURE_SUCCESS(rv, rv);
-  size += avcConfig.Length();
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-AVCConfigurationBox::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-
-  mControl->Write(avcConfig.Elements(), avcConfig.Length());
-
-  return NS_OK;
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/AVCBox.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef AVCBox_h_
-#define AVCBox_h_
-
-#include "nsTArray.h"
-#include "ISOMediaBoxes.h"
-
-namespace mozilla {
-
-class ISOControl;
-
-// 14496-12 8.5.2.2
-#define resolution_72_dpi 0x00480000
-#define video_depth 0x0018
-
-// 14496-15 5.3.4.1 'Sample description name and format'
-// Box type: 'avcC'
-class AVCConfigurationBox : public Box {
-public:
-  // ISO BMFF members
-
-  // avcConfig is CodecSpecificData from 14496-15 '5.3.4.1 Sample description
-  // name and format.
-  // These data are generated by encoder and we encapsulated the generated
-  // bitstream into box directly.
-  nsTArray<uint8_t> avcConfig;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // AVCConfigurationBox methods
-  AVCConfigurationBox(ISOControl* aControl);
-  ~AVCConfigurationBox();
-};
-
-// 14496-15 5.3.4.1 'Sample description name and format'
-// Box type: 'avc1'
-class AVCSampleEntry : public VisualSampleEntry {
-public:
-  // ISO BMFF members
-  RefPtr<AVCConfigurationBox> avcConfigBox;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // VisualSampleEntry methods
-  AVCSampleEntry(ISOControl* aControl);
-  ~AVCSampleEntry();
-};
-
-}
-
-#endif // AVCBox_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/EVRCBox.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "EVRCBox.h"
-#include "ISOTrackMetadata.h"
-
-namespace mozilla {
-
-nsresult
-EVRCSampleEntry::Generate(uint32_t* aBoxSize)
-{
-  uint32_t box_size;
-  nsresult rv = evrc_special_box->Generate(&box_size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  size += box_size;
-
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-EVRCSampleEntry::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  nsresult rv;
-  rv = AudioSampleEntry::Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = evrc_special_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-EVRCSampleEntry::EVRCSampleEntry(ISOControl* aControl)
-  : AudioSampleEntry(NS_LITERAL_CSTRING("sevc"), aControl)
-{
-  evrc_special_box = new EVRCSpecificBox(aControl);
-  MOZ_COUNT_CTOR(EVRCSampleEntry);
-}
-
-EVRCSampleEntry::~EVRCSampleEntry()
-{
-  MOZ_COUNT_DTOR(EVRCSampleEntry);
-}
-
-nsresult
-EVRCSpecificBox::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv;
-  FragmentBuffer* frag = mControl->GetFragment(Audio_Track);
-  rv = frag->GetCSD(evrcDecSpecInfo);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  size += evrcDecSpecInfo.Length();
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-EVRCSpecificBox::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-  mControl->Write(evrcDecSpecInfo.Elements(), evrcDecSpecInfo.Length());
-  return NS_OK;
-}
-
-EVRCSpecificBox::EVRCSpecificBox(ISOControl* aControl)
-  : Box(NS_LITERAL_CSTRING("devc"), aControl)
-{
-  MOZ_COUNT_CTOR(EVRCSpecificBox);
-}
-
-EVRCSpecificBox::~EVRCSpecificBox()
-{
-  MOZ_COUNT_DTOR(EVRCSpecificBox);
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/EVRCBox.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef EVRCBOX_h_
-#define EVRCBOX_h_
-
-#include "nsTArray.h"
-#include "MuxerOperation.h"
-
-namespace mozilla {
-
-class ISOControl;
-
-// 3GPP TS 26.244 6.7 'EVRCSpecificBox field for EVRCSampleEntry box'
-// Box type: 'devc'
-class EVRCSpecificBox : public Box {
-public:
-  // 3GPP members
-  nsTArray<uint8_t> evrcDecSpecInfo;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // EVRCSpecificBox methods
-  EVRCSpecificBox(ISOControl* aControl);
-  ~EVRCSpecificBox();
-};
-
-// 3GPP TS 26.244 6.5 'EVRCSampleEntry box'
-// Box type: 'sevc'
-class EVRCSampleEntry : public AudioSampleEntry {
-public:
-  // 3GPP members
-  RefPtr<EVRCSpecificBox> evrc_special_box;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // EVRCSampleEntry methods
-  EVRCSampleEntry(ISOControl* aControl);
-  ~EVRCSampleEntry();
-};
-
-}
-
-#endif // EVRCBOX_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOControl.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include <time.h>
-#include "nsAutoPtr.h"
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "EncodedFrameContainer.h"
-
-namespace mozilla {
-
-// For MP4 creation_time and modification_time offset from January 1, 1904 to
-// January 1, 1970.
-#define iso_time_offset 2082844800
-
-FragmentBuffer::FragmentBuffer(uint32_t aTrackType, uint32_t aFragDuration)
-  : mTrackType(aTrackType)
-  , mFragDuration(aFragDuration)
-  , mMediaStartTime(0)
-  , mFragmentNumber(0)
-  , mLastFrameTimeOfLastFragment(0)
-  , mEOS(false)
-{
-  mFragArray.AppendElement();
-  MOZ_COUNT_CTOR(FragmentBuffer);
-}
-
-FragmentBuffer::~FragmentBuffer()
-{
-  MOZ_COUNT_DTOR(FragmentBuffer);
-}
-
-bool
-FragmentBuffer::HasEnoughData()
-{
-  // Audio or video frame is enough to form a moof.
-  return (mFragArray.Length() > 1);
-}
-
-nsresult
-FragmentBuffer::GetCSD(nsTArray<uint8_t>& aCSD)
-{
-  if (!mCSDFrame) {
-    return NS_ERROR_FAILURE;
-  }
-  aCSD.AppendElements(mCSDFrame->GetFrameData().Elements(),
-                      mCSDFrame->GetFrameData().Length());
-
-  return NS_OK;
-}
-
-nsresult
-FragmentBuffer::AddFrame(EncodedFrame* aFrame)
-{
-  // already EOS, it rejects all new data.
-  if (mEOS) {
-    MOZ_ASSERT(0);
-    return NS_OK;
-  }
-
-  EncodedFrame::FrameType type = aFrame->GetFrameType();
-  if (type == EncodedFrame::AAC_CSD || type == EncodedFrame::AVC_CSD ||
-      type == EncodedFrame::AMR_AUDIO_CSD || type == EncodedFrame::EVRC_AUDIO_CSD) {
-    mCSDFrame = aFrame;
-    // Use CSD's timestamp as the start time. Encoder should send CSD frame first
-    // and then data frames.
-    mMediaStartTime = aFrame->GetTimeStamp();
-    mFragmentNumber = 1;
-    return NS_OK;
-  }
-
-  // if the timestamp is incorrect, abort it.
-  if (aFrame->GetTimeStamp() < mMediaStartTime) {
-    MOZ_ASSERT(false);
-    return NS_ERROR_FAILURE;
-  }
-
-  mFragArray.LastElement().AppendElement(aFrame);
-
-  // check if current fragment is reach the fragment duration.
-  if ((aFrame->GetTimeStamp() - mMediaStartTime) >= (mFragDuration * mFragmentNumber)) {
-    mFragArray.AppendElement();
-    mFragmentNumber++;
-  }
-
-  return NS_OK;
-}
-
-nsresult
-FragmentBuffer::GetFirstFragment(nsTArray<RefPtr<EncodedFrame>>& aFragment,
-                                 bool aFlush)
-{
-  // It should be called only if there is a complete fragment in mFragArray.
-  if (mFragArray.Length() <= 1 && !mEOS) {
-    MOZ_ASSERT(false);
-    return NS_ERROR_FAILURE;
-  }
-
-  if (aFlush) {
-    aFragment.SwapElements(mFragArray.ElementAt(0));
-    mFragArray.RemoveElementAt(0);
-  } else {
-    aFragment.AppendElements(mFragArray.ElementAt(0));
-  }
-  return NS_OK;
-}
-
-uint32_t
-FragmentBuffer::GetFirstFragmentSampleNumber()
-{
-  return mFragArray.ElementAt(0).Length();
-}
-
-uint32_t
-FragmentBuffer::GetFirstFragmentSampleSize()
-{
-  uint32_t size = 0;
-  uint32_t len = mFragArray.ElementAt(0).Length();
-  for (uint32_t i = 0; i < len; i++) {
-    size += mFragArray.ElementAt(0).ElementAt(i)->GetFrameData().Length();
-  }
-  return size;
-}
-
-ISOControl::ISOControl(uint32_t aMuxingType)
-  : mMuxingType(aMuxingType)
-  , mAudioFragmentBuffer(nullptr)
-  , mVideoFragmentBuffer(nullptr)
-  , mFragNum(0)
-  , mOutputSize(0)
-  , mBitCount(0)
-  , mBit(0)
-{
-  // Create a data array for first mp4 Box, ftyp.
-  mOutBuffers.SetLength(1);
-  MOZ_COUNT_CTOR(ISOControl);
-}
-
-ISOControl::~ISOControl()
-{
-  MOZ_COUNT_DTOR(ISOControl);
-}
-
-uint32_t
-ISOControl::GetNextTrackID()
-{
-  return (mMetaArray.Length() + 1);
-}
-
-uint32_t
-ISOControl::GetTrackID(TrackMetadataBase::MetadataKind aKind)
-{
-  for (uint32_t i = 0; i < mMetaArray.Length(); i++) {
-    if (mMetaArray[i]->GetKind() == aKind) {
-      return (i + 1);
-    }
-  }
-
-  // Track ID shouldn't be 0. It must be something wrong here.
-  MOZ_ASSERT(0);
-  return 0;
-}
-
-nsresult
-ISOControl::SetMetadata(TrackMetadataBase* aTrackMeta)
-{
-  if (aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AAC ||
-      aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AMR ||
-      aTrackMeta->GetKind() == TrackMetadataBase::METADATA_AVC ||
-      aTrackMeta->GetKind() == TrackMetadataBase::METADATA_EVRC) {
-    mMetaArray.AppendElement(aTrackMeta);
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
-}
-
-nsresult
-ISOControl::GetAudioMetadata(RefPtr<AudioTrackMetadata>& aAudMeta)
-{
-  for (uint32_t i = 0; i < mMetaArray.Length() ; i++) {
-    if (mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AAC ||
-        mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AMR ||
-        mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_EVRC) {
-      aAudMeta = static_cast<AudioTrackMetadata*>(mMetaArray[i].get());
-      return NS_OK;
-    }
-  }
-  return NS_ERROR_FAILURE;
-}
-
-nsresult
-ISOControl::GetVideoMetadata(RefPtr<VideoTrackMetadata>& aVidMeta)
-{
-  for (uint32_t i = 0; i < mMetaArray.Length() ; i++) {
-    if (mMetaArray[i]->GetKind() == TrackMetadataBase::METADATA_AVC) {
-      aVidMeta = static_cast<VideoTrackMetadata*>(mMetaArray[i].get());
-      return NS_OK;
-    }
-  }
-  return NS_ERROR_FAILURE;
-}
-
-bool
-ISOControl::HasAudioTrack()
-{
-  RefPtr<AudioTrackMetadata> audMeta;
-  GetAudioMetadata(audMeta);
-  return audMeta;
-}
-
-bool
-ISOControl::HasVideoTrack()
-{
-  RefPtr<VideoTrackMetadata> vidMeta;
-  GetVideoMetadata(vidMeta);
-  return vidMeta;
-}
-
-nsresult
-ISOControl::SetFragment(FragmentBuffer* aFragment)
-{
-  if (aFragment->GetType() == Audio_Track) {
-    mAudioFragmentBuffer = aFragment;
-  } else {
-    mVideoFragmentBuffer = aFragment;
-  }
-  return NS_OK;
-}
-
-FragmentBuffer*
-ISOControl::GetFragment(uint32_t aType)
-{
-  if (aType == Audio_Track) {
-    return mAudioFragmentBuffer;
-  } else if (aType == Video_Track){
-    return mVideoFragmentBuffer;
-  }
-  MOZ_ASSERT(0);
-  return nullptr;
-}
-
-nsresult
-ISOControl::GetBufs(nsTArray<nsTArray<uint8_t>>* aOutputBufs)
-{
-  uint32_t len = mOutBuffers.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    mOutBuffers[i].SwapElements(*aOutputBufs->AppendElement());
-  }
-  return FlushBuf();
-}
-
-nsresult
-ISOControl::FlushBuf()
-{
-  mOutBuffers.SetLength(1);
-  return NS_OK;
-}
-
-uint32_t
-ISOControl::WriteAVData(nsTArray<uint8_t>& aArray)
-{
-  MOZ_ASSERT(!mBitCount);
-
-  uint32_t len = aArray.Length();
-  if (!len) {
-    return 0;
-  }
-
-  mOutputSize += len;
-
-  // The last element already has data, allocated a new element for pointer
-  // swapping.
-  if (mOutBuffers.LastElement().Length()) {
-    mOutBuffers.AppendElement();
-  }
-  // Swap the video/audio data pointer.
-  mOutBuffers.LastElement().SwapElements(aArray);
-  // Following data could be boxes, so appending a new uint8_t array here.
-  mOutBuffers.AppendElement();
-
-  return len;
-}
-
-uint32_t
-ISOControl::WriteBits(uint64_t aBits, size_t aNumBits)
-{
-  uint8_t output_byte = 0;
-
-  MOZ_ASSERT(aNumBits <= 64);
-  // TODO: rewritten following with bitset?
-  for (size_t i = aNumBits; i > 0; i--) {
-    mBit |= (((aBits >> (i - 1)) & 1) << (8 - ++mBitCount));
-    if (mBitCount == 8) {
-      Write(&mBit, sizeof(uint8_t));
-      mBit = 0;
-      mBitCount = 0;
-      output_byte++;
-    }
-  }
-  return output_byte;
-}
-
-uint32_t
-ISOControl::Write(uint8_t* aBuf, uint32_t aSize)
-{
-  mOutBuffers.LastElement().AppendElements(aBuf, aSize);
-  mOutputSize += aSize;
-  return aSize;
-}
-
-uint32_t
-ISOControl::Write(uint8_t aData)
-{
-  MOZ_ASSERT(!mBitCount);
-  Write((uint8_t*)&aData, sizeof(uint8_t));
-  return sizeof(uint8_t);
-}
-
-uint32_t
-ISOControl::GetBufPos()
-{
-  uint32_t len = mOutBuffers.Length();
-  uint32_t pos = 0;
-  for (uint32_t i = 0; i < len; i++) {
-    pos += mOutBuffers.ElementAt(i).Length();
-  }
-  return pos;
-}
-
-uint32_t
-ISOControl::WriteFourCC(const char* aType)
-{
-  // Bit operation should be aligned to byte before writing any byte data.
-  MOZ_ASSERT(!mBitCount);
-
-  uint32_t size = strlen(aType);
-  if (size == 4) {
-    return Write((uint8_t*)aType, size);
-  }
-
-  return 0;
-}
-
-nsresult
-ISOControl::GenerateFtyp()
-{
-  nsresult rv;
-  uint32_t size;
-  nsAutoPtr<FileTypeBox> type_box(new FileTypeBox(this));
-  rv = type_box->Generate(&size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = type_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  return NS_OK;
-}
-
-nsresult
-ISOControl::GenerateMoov()
-{
-  nsresult rv;
-  uint32_t size;
-  nsAutoPtr<MovieBox> moov_box(new MovieBox(this));
-  rv = moov_box->Generate(&size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = moov_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  return NS_OK;
-}
-
-nsresult
-ISOControl::GenerateMoof(uint32_t aTrackType)
-{
-  mFragNum++;
-
-  nsresult rv;
-  uint32_t size;
-  uint64_t first_sample_offset = mOutputSize;
-  nsAutoPtr<MovieFragmentBox> moof_box(new MovieFragmentBox(aTrackType, this));
-  nsAutoPtr<MediaDataBox> mdat_box(new MediaDataBox(aTrackType, this));
-
-  rv = moof_box->Generate(&size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  first_sample_offset += size;
-  rv = mdat_box->Generate(&size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  first_sample_offset += mdat_box->FirstSampleOffsetInMediaDataBox();
-
-  // correct offset info
-  nsTArray<RefPtr<MuxerOperation>> tfhds;
-  rv = moof_box->Find(NS_LITERAL_CSTRING("tfhd"), tfhds);
-  NS_ENSURE_SUCCESS(rv, rv);
-  uint32_t len = tfhds.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    TrackFragmentHeaderBox* tfhd = (TrackFragmentHeaderBox*) tfhds.ElementAt(i).get();
-    rv = tfhd->UpdateBaseDataOffset(first_sample_offset);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  rv = moof_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = mdat_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-uint32_t
-ISOControl::GetTime()
-{
-  return (uint64_t)time(nullptr) + iso_time_offset;
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOControl.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef ISOCOMPOSITOR_H_
-#define ISOCOMPOSITOR_H_
-
-#include "mozilla/EndianUtils.h"
-#include "nsTArray.h"
-#include "ISOTrackMetadata.h"
-#include "EncodedFrameContainer.h"
-
-namespace mozilla {
-
-class Box;
-class ISOControl;
-
-/**
- * This class collects elementary stream data to form a fragment.
- * ISOMediaWriter will check if the data is enough; if yes, the corresponding
- * moof will be created and write to ISOControl.
- * Each audio and video has its own fragment and only one during the whole
- * life cycle, when a fragment is formed in ISOControl, Flush() needs to
- * be called to reset it.
- */
-class FragmentBuffer {
-public:
-  // aTrackType: it could be Audio_Track or Video_Track.
-  // aFragDuration: it is the fragment duration. (microsecond per unit)
-  //                Audio and video have the same fragment duration.
-  FragmentBuffer(uint32_t aTrackType, uint32_t aFragDuration);
-  ~FragmentBuffer();
-
-  // Get samples of first fragment, that will swap all the elements in the
-  // mFragArray[0] when aFlush = true, and caller is responsible for drop
-  // EncodedFrame reference count.
-  nsresult GetFirstFragment(nsTArray<RefPtr<EncodedFrame>>& aFragment,
-                            bool aFlush = false);
-
-  // Add sample frame to the last element fragment of mFragArray. If sample
-  // number is enough, it will append a new fragment element. And the new
-  // sample will be added to the new fragment element of mFragArray.
-  nsresult AddFrame(EncodedFrame* aFrame);
-
-  // Get total sample size of first complete fragment size.
-  uint32_t GetFirstFragmentSampleSize();
-
-  // Get sample number of first complete fragment.
-  uint32_t GetFirstFragmentSampleNumber();
-
-  // Check if it accumulates enough frame data.
-  // It returns true when data is enough to form a fragment.
-  bool HasEnoughData();
-
-  // Called by ISOMediaWriter when TrackEncoder has sent the last frame. The
-  // remains frame data will form the last moof and move the state machine to
-  // in ISOMediaWriter to last phrase.
-  nsresult SetEndOfStream() {
-    mEOS = true;
-    return  NS_OK;
-  }
-  bool EOS() { return mEOS; }
-
-  // CSD (codec specific data), it is generated by encoder and the data depends
-  // on codec type. This data will be sent as a special frame from encoder to
-  // ISOMediaWriter and pass to this class via AddFrame().
-  nsresult GetCSD(nsTArray<uint8_t>& aCSD);
-
-  bool HasCSD() { return mCSDFrame; }
-
-  uint32_t GetType() { return mTrackType; }
-
-  void SetLastFragmentLastFrameTime(uint32_t aTime) {
-    mLastFrameTimeOfLastFragment = aTime;
-  }
-
-  uint32_t GetLastFragmentLastFrameTime() {
-    return mLastFrameTimeOfLastFragment;
-  }
-
-private:
-  uint32_t mTrackType;
-
-  // Fragment duration, microsecond per unit.
-  uint32_t mFragDuration;
-
-  // Media start time, microsecond per unit.
-  // Together with mFragDuration, mFragmentNumber and EncodedFrame->GetTimeStamp(),
-  // when the difference between current frame time and mMediaStartTime is
-  // exceeded current fragment ceiling timeframe, that means current fragment has
-  // enough data and a new element in mFragArray will be added.
-  uint64_t mMediaStartTime;
-
-  // Current fragment number. It will be increase when a new element of
-  // mFragArray is created.
-  // Note:
-  //   It only means the fragment number of current accumulated frames, not
-  //   the current 'creating' fragment mFragNum in ISOControl.
-  uint32_t mFragmentNumber;
-
-  // The last frame time stamp of last fragment. It is for calculating the
-  // play duration of first frame in current fragment. The frame duration is
-  // defined as "current frame timestamp - last frame timestamp" here. So it
-  // needs to keep the last timestamp of last fragment.
-  uint32_t mLastFrameTimeOfLastFragment;
-
-  // Array of fragments, each element has enough samples to form a
-  // complete fragment.
-  nsTArray<nsTArray<RefPtr<EncodedFrame>>> mFragArray;
-
-  // Codec specific data frame, it will be generated by encoder and send to
-  // ISOMediaWriter through WriteEncodedTrack(). The data will be vary depends
-  // on codec type.
-  RefPtr<EncodedFrame> mCSDFrame;
-
-  // END_OF_STREAM from ContainerWriter
-  bool mEOS;
-};
-
-/**
- * ISOControl will be carried to each box when box is created. It is the main
- * bridge for box to output stream to ContainerWriter and retrieve information.
- * ISOControl acts 3 different roles:
- * 1. Holds the pointer of audio metadata, video metadata, fragment and
- *    pass them to boxes.
- * 2. Provide the functions to generate the base structure of MP4; they are
- *    GenerateFtyp, GenerateMoov, GenerateMoof, and GenerateMfra.
- * 3. The actually writer used by MuxOperation::Write() in each box. It provides
- *    writing methods for different kind of data; they are Write, WriteArray,
- *    WriteBits...etc.
- */
-class ISOControl {
-
-friend class Box;
-
-public:
-  ISOControl(uint32_t aMuxingType);
-  ~ISOControl();
-
-  nsresult GenerateFtyp();
-  nsresult GenerateMoov();
-  nsresult GenerateMoof(uint32_t aTrackType);
-
-  // Swap elementary stream pointer to output buffers.
-  uint32_t WriteAVData(nsTArray<uint8_t>& aArray);
-
-  uint32_t Write(uint8_t* aBuf, uint32_t aSize);
-
-  uint32_t Write(uint8_t aData);
-
-  template <typename T>
-  uint32_t Write(T aData) {
-    MOZ_ASSERT(!mBitCount);
-
-    aData = NativeEndian::swapToNetworkOrder(aData);
-    Write((uint8_t*)&aData, sizeof(T));
-    return sizeof(T);
-  }
-
-  template <typename T>
-  uint32_t WriteArray(const T &aArray, uint32_t aSize) {
-    MOZ_ASSERT(!mBitCount);
-
-    uint32_t size = 0;
-    for (uint32_t i = 0; i < aSize; i++) {
-      size += Write(aArray[i]);
-    }
-    return size;
-  }
-
-  uint32_t WriteFourCC(const char* aType);
-
-  // Bit writing. Note: it needs to be byte-boundary before using
-  // others non-bit writing function.
-  uint32_t WriteBits(uint64_t aBits, size_t aNumBits);
-
-  // This is called by GetContainerData and swap all the buffers to aOutputBuffers.
-  nsresult GetBufs(nsTArray<nsTArray<uint8_t>>* aOutputBufs);
-
-  // Presentation time in seconds since midnight, Jan. 1, 1904, in UTC time.
-  uint32_t GetTime();
-
-  // current fragment number
-  uint32_t GetCurFragmentNumber() { return mFragNum; }
-
-  nsresult SetFragment(FragmentBuffer* aFragment);
-  FragmentBuffer* GetFragment(uint32_t aType);
-
-  uint32_t GetMuxingType() { return mMuxingType; }
-
-  nsresult SetMetadata(TrackMetadataBase* aTrackMeta);
-  nsresult GetAudioMetadata(RefPtr<AudioTrackMetadata>& aAudMeta);
-  nsresult GetVideoMetadata(RefPtr<VideoTrackMetadata>& aVidMeta);
-
-  // Track ID is the Metadata index in mMetaArray. It allows only 1 audio
-  // track and 1 video track in this muxer. In this muxer, it is prohibt to have
-  // mutiple audio track or video track in the same file.
-  uint32_t GetTrackID(TrackMetadataBase::MetadataKind aKind);
-  uint32_t GetNextTrackID();
-
-  bool HasAudioTrack();
-  bool HasVideoTrack();
-
-private:
-  uint32_t GetBufPos();
-  nsresult FlushBuf();
-
-  // One of value in TYPE_XXX, defined in ISOMediaWriter.
-  uint32_t mMuxingType;
-
-  // Audio and video fragments are owned by ISOMediaWriter.
-  // They don't need to worry about pointer going stale because ISOMediaWriter's
-  // lifetime is longer than ISOControl.
-  FragmentBuffer* mAudioFragmentBuffer;
-  FragmentBuffer* mVideoFragmentBuffer;
-
-  // Generated fragment number
-  uint32_t mFragNum;
-
-  // The (index + 1) will be the track ID.
-  nsTArray<RefPtr<TrackMetadataBase>> mMetaArray;
-
-  // Array of output buffers.
-  // To save memory usage, audio/video sample will be swapped into a new element
-  // of this array.
-  //
-  // For example,
-  //   mOutBuffers[0] --> boxes (allocated by muxer)
-  //   mOutBuffers[1] --> video raw data (allocated by encoder)
-  //   mOutBuffers[2] --> video raw data (allocated by encoder)
-  //   mOutBuffers[3] --> video raw data (allocated by encoder)
-  //   mOutBuffers[4] --> boxes (allocated by muxer)
-  //   mOutBuffers[5] --> audio raw data (allocated by encoder)
-  //   ...etc.
-  //
-  nsTArray<nsTArray<uint8_t>> mOutBuffers;
-
-  // Accumulate output size from Write().
-  uint64_t mOutputSize;
-
-  // Bit writing operation. Note: the mBitCount should be 0 before any
-  // byte-boundary writing method be called (Write(uint32_t), Write(uint16_t)...etc);
-  // otherwise, there will be assertion on these functions.
-  uint8_t mBitCount;
-  uint8_t mBit;
-};
-
-}
-#endif
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp
+++ /dev/null
@@ -1,1550 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include <climits>
-#include "TrackMetadataBase.h"
-#include "ISOMediaBoxes.h"
-#include "ISOControl.h"
-#include "ISOMediaWriter.h"
-#include "EncodedFrameContainer.h"
-#include "ISOTrackMetadata.h"
-#include "MP4ESDS.h"
-#include "AMRBox.h"
-#include "AVCBox.h"
-#include "EVRCBox.h"
-#include "VideoUtils.h"
-
-namespace mozilla {
-
-// 14496-12 6.2.2 'Data Types and fields'
-const uint32_t iso_matrix[] = { 0x00010000, 0,          0,
-                                0,          0x00010000, 0,
-                                0,          0,          0x40000000 };
-
-uint32_t
-set_sample_flags(bool aSync)
-{
-  std::bitset<32> flags;
-  flags.set(16, !aSync);
-  return flags.to_ulong();
-}
-
-Box::BoxSizeChecker::BoxSizeChecker(ISOControl* aControl, uint32_t aSize)
-{
-  mControl = aControl;
-  ori_size = mControl->GetBufPos();
-  box_size = aSize;
-  MOZ_COUNT_CTOR(BoxSizeChecker);
-}
-
-Box::BoxSizeChecker::~BoxSizeChecker()
-{
-  uint32_t cur_size = mControl->GetBufPos();
-  if ((cur_size - ori_size) != box_size) {
-    MOZ_ASSERT(false);
-  }
-
-  MOZ_COUNT_DTOR(BoxSizeChecker);
-}
-
-nsresult
-MediaDataBox::Generate(uint32_t* aBoxSize)
-{
-  mFirstSampleOffset = size;
-  mAllSampleSize = 0;
-
-  if (mTrackType & Audio_Track) {
-    FragmentBuffer* frag = mControl->GetFragment(Audio_Track);
-    mAllSampleSize += frag->GetFirstFragmentSampleSize();
-  }
-  if (mTrackType & Video_Track) {
-    FragmentBuffer* frag = mControl->GetFragment(Video_Track);
-    mAllSampleSize += frag->GetFirstFragmentSampleSize();
-  }
-
-  size += mAllSampleSize;
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-MediaDataBox::Write()
-{
-  nsresult rv;
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-  nsTArray<uint32_t> types;
-  types.AppendElement(Audio_Track);
-  types.AppendElement(Video_Track);
-
-  for (uint32_t l = 0; l < types.Length(); l++) {
-    if (mTrackType & types[l]) {
-      FragmentBuffer* frag = mControl->GetFragment(types[l]);
-      nsTArray<RefPtr<EncodedFrame>> frames;
-
-      // Here is the last time we get fragment frames, flush it!
-      rv = frag->GetFirstFragment(frames, true);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      uint32_t len = frames.Length();
-      for (uint32_t i = 0; i < len; i++) {
-        nsTArray<uint8_t> frame_buffer;
-        frames.ElementAt(i)->SwapOutFrameData(frame_buffer);
-        mControl->WriteAVData(frame_buffer);
-      }
-    }
-  }
-
-  return NS_OK;
-}
-
-MediaDataBox::MediaDataBox(uint32_t aTrackType, ISOControl* aControl)
-  : Box(NS_LITERAL_CSTRING("mdat"), aControl)
-  , mAllSampleSize(0)
-  , mFirstSampleOffset(0)
-  , mTrackType(aTrackType)
-{
-  MOZ_COUNT_CTOR(MediaDataBox);
-}
-
-MediaDataBox::~MediaDataBox()
-{
-  MOZ_COUNT_DTOR(MediaDataBox);
-}
-
-uint32_t
-TrackRunBox::fillSampleTable()
-{
-  uint32_t table_size = 0;
-  nsresult rv;
-  nsTArray<RefPtr<EncodedFrame>> frames;
-  FragmentBuffer* frag = mControl->GetFragment(mTrackType);
-
-  rv = frag->GetFirstFragment(frames);
-  if (NS_FAILED(rv)) {
-    return 0;
-  }
-  uint32_t len = frames.Length();
-  sample_info_table = MakeUnique<tbl[]>(len);
-  // Create sample table according to 14496-12 8.8.8.2.
-  for (uint32_t i = 0; i < len; i++) {
-    // Sample size.
-    sample_info_table[i].sample_size = 0;
-    if (flags.to_ulong() & flags_sample_size_present) {
-      sample_info_table[i].sample_size = frames.ElementAt(i)->GetFrameData().Length();
-      mAllSampleSize += sample_info_table[i].sample_size;
-      table_size += sizeof(uint32_t);
-    }
-
-    // Sample flags.
-    sample_info_table[i].sample_flags = 0;
-    if (flags.to_ulong() & flags_sample_flags_present) {
-      sample_info_table[i].sample_flags =
-        set_sample_flags(
-          (frames.ElementAt(i)->GetFrameType() == EncodedFrame::AVC_I_FRAME));
-      table_size += sizeof(uint32_t);
-    }
-
-    // Sample duration.
-    sample_info_table[i].sample_duration = 0;
-    if (flags.to_ulong() & flags_sample_duration_present) {
-      // Calculate each frame's duration, it is decided by "current frame
-      // timestamp - last frame timestamp".
-      uint64_t frame_time = 0;
-      if (i == 0) {
-        frame_time = frames.ElementAt(i)->GetTimeStamp() -
-                     frag->GetLastFragmentLastFrameTime();
-      } else {
-        frame_time = frames.ElementAt(i)->GetTimeStamp() -
-                     frames.ElementAt(i - 1)->GetTimeStamp();
-        // Keep the last frame time of current fagment, it will be used to calculate
-        // the first frame duration of next fragment.
-        if ((len - 1) == i) {
-          frag->SetLastFragmentLastFrameTime(frames.ElementAt(i)->GetTimeStamp());
-        }
-      }
-
-      // In TrackRunBox, there should be exactly one type, either audio or video.
-      MOZ_ASSERT((mTrackType & Video_Track) ^ (mTrackType & Audio_Track));
-      sample_info_table[i].sample_duration = (mTrackType & Video_Track ?
-        frame_time * mVideoMeta->GetVideoClockRate() / USECS_PER_S :
-        frame_time * mAudioMeta->GetAudioSampleRate() / USECS_PER_S);
-
-      table_size += sizeof(uint32_t);
-    }
-
-    sample_info_table[i].sample_composition_time_offset = 0;
-  }
-  return table_size;
-}
-
-nsresult
-TrackRunBox::Generate(uint32_t* aBoxSize)
-{
-  FragmentBuffer* frag = mControl->GetFragment(mTrackType);
-  sample_count = frag->GetFirstFragmentSampleNumber();
-  size += sizeof(sample_count);
-
-  // data_offset needs to be updated if there is other
-  // TrackRunBox before this one.
-  if (flags.to_ulong() & flags_data_offset_present) {
-    data_offset = 0;
-    size += sizeof(data_offset);
-  }
-  size += fillSampleTable();
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-TrackRunBox::SetDataOffset(uint32_t aOffset)
-{
-  data_offset = aOffset;
-  return NS_OK;
-}
-
-nsresult
-TrackRunBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(sample_count);
-  if (flags.to_ulong() & flags_data_offset_present) {
-    mControl->Write(data_offset);
-  }
-  for (uint32_t i = 0; i < sample_count; i++) {
-    if (flags.to_ulong() & flags_sample_duration_present) {
-      mControl->Write(sample_info_table[i].sample_duration);
-    }
-    if (flags.to_ulong() & flags_sample_size_present) {
-      mControl->Write(sample_info_table[i].sample_size);
-    }
-    if (flags.to_ulong() & flags_sample_flags_present) {
-      mControl->Write(sample_info_table[i].sample_flags);
-    }
-  }
-
-  return NS_OK;
-}
-
-TrackRunBox::TrackRunBox(uint32_t aType, uint32_t aFlags, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("trun"), 0, aFlags, aControl)
-  , sample_count(0)
-  , data_offset(0)
-  , first_sample_flags(0)
-  , mAllSampleSize(0)
-  , mTrackType(aType)
-{
-  MOZ_COUNT_CTOR(TrackRunBox);
-}
-
-TrackRunBox::~TrackRunBox()
-{
-  MOZ_COUNT_DTOR(TrackRunBox);
-}
-
-nsresult
-TrackFragmentHeaderBox::UpdateBaseDataOffset(uint64_t aOffset)
-{
-  base_data_offset = aOffset;
-  return NS_OK;
-}
-
-nsresult
-TrackFragmentHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  track_ID = (mTrackType == Audio_Track ?
-                mControl->GetTrackID(mAudioMeta->GetKind()) :
-                mControl->GetTrackID(mVideoMeta->GetKind()));
-  size += sizeof(track_ID);
-
-  if (flags.to_ulong() & base_data_offset_present) {
-    // base_data_offset needs to add size of 'trun', 'tfhd' and
-    // header of 'mdat' later.
-    base_data_offset = 0;
-    size += sizeof(base_data_offset);
-  }
-  if (flags.to_ulong() & default_sample_duration_present) {
-    if (mTrackType == Video_Track) {
-      if (!mVideoMeta->GetVideoFrameRate()) {
-        // 0 means frame rate is variant, so it is wrong to write
-        // default_sample_duration.
-        MOZ_ASSERT(0);
-        default_sample_duration = 0;
-      } else {
-        default_sample_duration = mVideoMeta->GetVideoClockRate() / mVideoMeta->GetVideoFrameRate();
-      }
-    } else if (mTrackType == Audio_Track) {
-      default_sample_duration = mAudioMeta->GetAudioFrameDuration();
-    } else {
-      MOZ_ASSERT(0);
-      return NS_ERROR_FAILURE;
-    }
-    size += sizeof(default_sample_duration);
-  }
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-TrackFragmentHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(track_ID);
-  if (flags.to_ulong() & base_data_offset_present) {
-    mControl->Write(base_data_offset);
-  }
-  if (flags.to_ulong() & default_sample_duration_present) {
-    mControl->Write(default_sample_duration);
-  }
-  return NS_OK;
-}
-
-TrackFragmentHeaderBox::TrackFragmentHeaderBox(uint32_t aType,
-                                               uint32_t aFlags,
-                                               ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("tfhd"), 0, aFlags, aControl)
-  , track_ID(0)
-  , base_data_offset(0)
-  , default_sample_duration(0)
-{
-  mTrackType = aType;
-  MOZ_COUNT_CTOR(TrackFragmentHeaderBox);
-}
-
-TrackFragmentHeaderBox::~TrackFragmentHeaderBox()
-{
-  MOZ_COUNT_DTOR(TrackFragmentHeaderBox);
-}
-
-TrackFragmentBox::TrackFragmentBox(uint32_t aType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("traf"), aControl)
-  , mTrackType(aType)
-{
-  // Flags in TrackFragmentHeaderBox.
-  uint32_t tf_flags = base_data_offset_present;
-
-  // Ideally, audio encoder generates audio frame in const rate. However, some
-  // audio encoders don't do it so the audio frame duration needs to be checked
-  // here.
-  if ((mTrackType & Audio_Track) && mAudioMeta->GetAudioFrameDuration()) {
-    tf_flags |= default_sample_duration_present;
-  }
-
-  boxes.AppendElement(new TrackFragmentHeaderBox(aType, tf_flags, aControl));
-
-  // Always adds flags_data_offset_present in each TrackRunBox, Android
-  // parser requires this flag to calculate the correct bitstream offset.
-  uint32_t tr_flags = flags_sample_size_present | flags_data_offset_present;
-
-  // Flags in TrackRunBox.
-  // If there is no default sample duration exists, each frame duration needs to
-  // be recored in the TrackRunBox.
-  tr_flags |= (tf_flags & default_sample_duration_present ? 0 : flags_sample_duration_present);
-
-  // For video, add sample_flags to record I frame.
-  tr_flags |= (mTrackType & Video_Track ? flags_sample_flags_present : 0);
-
-  boxes.AppendElement(new TrackRunBox(mTrackType, tr_flags, aControl));
-  MOZ_COUNT_CTOR(TrackFragmentBox);
-}
-
-TrackFragmentBox::~TrackFragmentBox()
-{
-  MOZ_COUNT_DTOR(TrackFragmentBox);
-}
-
-nsresult
-MovieFragmentHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  sequence_number = mControl->GetCurFragmentNumber();
-  size += sizeof(sequence_number);
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-MovieFragmentHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(sequence_number);
-  return NS_OK;
-}
-
-MovieFragmentHeaderBox::MovieFragmentHeaderBox(uint32_t aTrackType,
-                                               ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("mfhd"), 0, 0, aControl)
-  , sequence_number(0)
-  , mTrackType(aTrackType)
-{
-  MOZ_COUNT_CTOR(MovieFragmentHeaderBox);
-}
-
-MovieFragmentHeaderBox::~MovieFragmentHeaderBox()
-{
-  MOZ_COUNT_DTOR(MovieFragmentHeaderBox);
-}
-
-MovieFragmentBox::MovieFragmentBox(uint32_t aType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("moof"), aControl)
-  , mTrackType(aType)
-{
-  boxes.AppendElement(new MovieFragmentHeaderBox(mTrackType, aControl));
-
-  if (mTrackType & Audio_Track) {
-    boxes.AppendElement(
-      new TrackFragmentBox(Audio_Track, aControl));
-  }
-  if (mTrackType & Video_Track) {
-    boxes.AppendElement(
-      new TrackFragmentBox(Video_Track, aControl));
-  }
-  MOZ_COUNT_CTOR(MovieFragmentBox);
-}
-
-MovieFragmentBox::~MovieFragmentBox()
-{
-  MOZ_COUNT_DTOR(MovieFragmentBox);
-}
-
-nsresult
-MovieFragmentBox::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv = DefaultContainerImpl::Generate(aBoxSize);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Correct data_offset if there are both audio and video track in
-  // this fragment. This offset means the offset in the MediaDataBox.
-  if (mTrackType & (Audio_Track | Video_Track)) {
-    nsTArray<RefPtr<MuxerOperation>> truns;
-    rv = Find(NS_LITERAL_CSTRING("trun"), truns);
-    NS_ENSURE_SUCCESS(rv, rv);
-    uint32_t len = truns.Length();
-    uint32_t data_offset = 0;
-    for (uint32_t i = 0; i < len; i++) {
-      TrackRunBox* trun = (TrackRunBox*) truns.ElementAt(i).get();
-      rv = trun->SetDataOffset(data_offset);
-      NS_ENSURE_SUCCESS(rv, rv);
-      data_offset += trun->GetAllSampleSize();
-    }
-  }
-
-  return NS_OK;
-}
-
-nsresult
-TrackExtendsBox::Generate(uint32_t* aBoxSize)
-{
-  track_ID = (mTrackType == Audio_Track ?
-                mControl->GetTrackID(mAudioMeta->GetKind()) :
-                mControl->GetTrackID(mVideoMeta->GetKind()));
-
-  if (mTrackType == Audio_Track) {
-    default_sample_description_index = 1;
-    default_sample_duration = mAudioMeta->GetAudioFrameDuration();
-    default_sample_size = mAudioMeta->GetAudioFrameSize();
-    default_sample_flags = set_sample_flags(1);
-  } else if (mTrackType == Video_Track) {
-    default_sample_description_index = 1;
-    // Video meta data has assigned framerate, it implies that this video's
-    // frame rate should be fixed.
-    if (mVideoMeta->GetVideoFrameRate()) {
-      default_sample_duration =
-        mVideoMeta->GetVideoClockRate() / mVideoMeta->GetVideoFrameRate();
-    }
-    default_sample_size = 0;
-    default_sample_flags = set_sample_flags(0);
-  } else {
-    MOZ_ASSERT(0);
-    return NS_ERROR_FAILURE;
-  }
-
-  size += sizeof(track_ID) +
-          sizeof(default_sample_description_index) +
-          sizeof(default_sample_duration) +
-          sizeof(default_sample_size) +
-          sizeof(default_sample_flags);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-TrackExtendsBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(track_ID);
-  mControl->Write(default_sample_description_index);
-  mControl->Write(default_sample_duration);
-  mControl->Write(default_sample_size);
-  mControl->Write(default_sample_flags);
-
-  return NS_OK;
-}
-
-TrackExtendsBox::TrackExtendsBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("trex"), 0, 0, aControl)
-  , track_ID(0)
-  , default_sample_description_index(0)
-  , default_sample_duration(0)
-  , default_sample_size(0)
-  , default_sample_flags(0)
-  , mTrackType(aType)
-{
-  MOZ_COUNT_CTOR(TrackExtendsBox);
-}
-
-TrackExtendsBox::~TrackExtendsBox()
-{
-  MOZ_COUNT_DTOR(TrackExtendsBox);
-}
-
-MovieExtendsBox::MovieExtendsBox(ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("mvex"), aControl)
-{
-  if (mAudioMeta) {
-    boxes.AppendElement(new TrackExtendsBox(Audio_Track, aControl));
-  }
-  if (mVideoMeta) {
-    boxes.AppendElement(new TrackExtendsBox(Video_Track, aControl));
-  }
-  MOZ_COUNT_CTOR(MovieExtendsBox);
-}
-
-MovieExtendsBox::~MovieExtendsBox()
-{
-  MOZ_COUNT_DTOR(MovieExtendsBox);
-}
-
-nsresult
-ChunkOffsetBox::Generate(uint32_t* aBoxSize)
-{
-  // We don't need time to sample table in fragmented mp4.
-  entry_count = 0;
-  size += sizeof(entry_count);
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-ChunkOffsetBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(entry_count);
-  return NS_OK;
-}
-
-ChunkOffsetBox::ChunkOffsetBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("stco"), 0, 0, aControl)
-  , entry_count(0)
-{
-  MOZ_COUNT_CTOR(ChunkOffsetBox);
-}
-
-ChunkOffsetBox::~ChunkOffsetBox()
-{
-  MOZ_COUNT_DTOR(ChunkOffsetBox);
-}
-
-nsresult
-SampleToChunkBox::Generate(uint32_t* aBoxSize)
-{
-  // We don't need time to sample table in fragmented mp4
-  entry_count = 0;
-  size += sizeof(entry_count);
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-SampleToChunkBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(entry_count);
-  return NS_OK;
-}
-
-SampleToChunkBox::SampleToChunkBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("stsc"), 0, 0, aControl)
-  , entry_count(0)
-{
-  MOZ_COUNT_CTOR(SampleToChunkBox);
-}
-
-SampleToChunkBox::~SampleToChunkBox()
-{
-  MOZ_COUNT_DTOR(SampleToChunkBox);
-}
-
-nsresult
-TimeToSampleBox::Generate(uint32_t* aBoxSize)
-{
-  // We don't need time to sample table in fragmented mp4.
-  entry_count = 0;
-  size += sizeof(entry_count);
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-TimeToSampleBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(entry_count);
-  return NS_OK;
-}
-
-TimeToSampleBox::TimeToSampleBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("stts"), 0, 0, aControl)
-  , entry_count(0)
-{
-  MOZ_COUNT_CTOR(TimeToSampleBox);
-}
-
-TimeToSampleBox::~TimeToSampleBox()
-{
-  MOZ_COUNT_DTOR(TimeToSampleBox);
-}
-
-nsresult
-SampleDescriptionBox::Generate(uint32_t* aBoxSize)
-{
-  entry_count = 1;
-  size += sizeof(entry_count);
-
-  nsresult rv;
-  uint32_t box_size;
-  rv = sample_entry_box->Generate(&box_size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  size += box_size;
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-SampleDescriptionBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  nsresult rv;
-  mControl->Write(entry_count);
-  rv = sample_entry_box->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-SampleDescriptionBox::SampleDescriptionBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("stsd"), 0, 0, aControl)
-  , entry_count(0)
-{
-  mTrackType = aType;
-
-  switch (mTrackType) {
-  case Audio_Track:
-    {
-      CreateAudioSampleEntry(sample_entry_box);
-    }
-    break;
-  case Video_Track:
-    {
-      CreateVideoSampleEntry(sample_entry_box);
-    }
-    break;
-  }
-  MOZ_ASSERT(sample_entry_box);
-  MOZ_COUNT_CTOR(SampleDescriptionBox);
-}
-
-nsresult
-SampleDescriptionBox::CreateAudioSampleEntry(RefPtr<SampleEntryBox>& aSampleEntry)
-{
-  if (mAudioMeta->GetKind() == TrackMetadataBase::METADATA_AMR) {
-    aSampleEntry = new AMRSampleEntry(mControl);
-  } else if (mAudioMeta->GetKind() == TrackMetadataBase::METADATA_AAC) {
-    aSampleEntry = new MP4AudioSampleEntry(mControl);
-  } else if (mAudioMeta->GetKind() == TrackMetadataBase::METADATA_EVRC) {
-    aSampleEntry = new EVRCSampleEntry(mControl);
-  } else {
-    MOZ_ASSERT(0);
-  }
-  return NS_OK;
-}
-
-nsresult
-SampleDescriptionBox::CreateVideoSampleEntry(RefPtr<SampleEntryBox>& aSampleEntry)
-{
-  if (mVideoMeta->GetKind() == TrackMetadataBase::METADATA_AVC) {
-    aSampleEntry = new AVCSampleEntry(mControl);
-  } else {
-    MOZ_ASSERT(0);
-  }
-  return NS_OK;
-}
-
-SampleDescriptionBox::~SampleDescriptionBox()
-{
-  MOZ_COUNT_DTOR(SampleDescriptionBox);
-}
-
-nsresult
-SampleSizeBox::Generate(uint32_t* aBoxSize)
-{
-  size += sizeof(sample_size) +
-          sizeof(sample_count);
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-SampleSizeBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(sample_size);
-  mControl->Write(sample_count);
-  return NS_OK;
-}
-
-SampleSizeBox::SampleSizeBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("stsz"), 0, 0, aControl)
-  , sample_size(0)
-  , sample_count(0)
-{
-  MOZ_COUNT_CTOR(SampleSizeBox);
-}
-
-SampleSizeBox::~SampleSizeBox()
-{
-  MOZ_COUNT_DTOR(SampleSizeBox);
-}
-
-SampleTableBox::SampleTableBox(uint32_t aType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("stbl"), aControl)
-{
-  boxes.AppendElement(new SampleDescriptionBox(aType, aControl));
-  boxes.AppendElement(new TimeToSampleBox(aType, aControl));
-  boxes.AppendElement(new SampleToChunkBox(aType, aControl));
-  boxes.AppendElement(new SampleSizeBox(aControl));
-  boxes.AppendElement(new ChunkOffsetBox(aType, aControl));
-  MOZ_COUNT_CTOR(SampleTableBox);
-}
-
-SampleTableBox::~SampleTableBox()
-{
-  MOZ_COUNT_DTOR(SampleTableBox);
-}
-
-nsresult
-DataEntryUrlBox::Generate(uint32_t* aBoxSize)
-{
-  // location is null here, do nothing
-  size += location.Length();
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-DataEntryUrlBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  return NS_OK;
-}
-
-DataEntryUrlBox::DataEntryUrlBox()
-  : FullBox(NS_LITERAL_CSTRING("url "), 0, 0, (ISOControl*) nullptr)
-{
-  MOZ_COUNT_CTOR(DataEntryUrlBox);
-}
-
-DataEntryUrlBox::DataEntryUrlBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("url "), 0, flags_media_at_the_same_file, aControl)
-{
-  MOZ_COUNT_CTOR(DataEntryUrlBox);
-}
-
-DataEntryUrlBox::DataEntryUrlBox(const DataEntryUrlBox& aBox)
-  : FullBox(aBox.boxType, aBox.version, aBox.flags.to_ulong(), aBox.mControl)
-{
-  location = aBox.location;
-  MOZ_COUNT_CTOR(DataEntryUrlBox);
-}
-
-DataEntryUrlBox::~DataEntryUrlBox()
-{
-  MOZ_COUNT_DTOR(DataEntryUrlBox);
-}
-
-nsresult DataReferenceBox::Generate(uint32_t* aBoxSize)
-{
-  entry_count = 1;  // only allow on entry here
-  size += sizeof(uint32_t);
-
-  for (uint32_t i = 0; i < entry_count; i++) {
-    uint32_t box_size = 0;
-    DataEntryUrlBox* url = new DataEntryUrlBox(mControl);
-    url->Generate(&box_size);
-    size += box_size;
-    urls.AppendElement(url);
-  }
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult DataReferenceBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(entry_count);
-
-  for (uint32_t i = 0; i < entry_count; i++) {
-    urls[i]->Write();
-  }
-
-  return NS_OK;
-}
-
-DataReferenceBox::DataReferenceBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("dref"), 0, 0, aControl)
-  , entry_count(0)
-{
-  MOZ_COUNT_CTOR(DataReferenceBox);
-}
-
-DataReferenceBox::~DataReferenceBox()
-{
-  MOZ_COUNT_DTOR(DataReferenceBox);
-}
-
-DataInformationBox::DataInformationBox(ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("dinf"), aControl)
-{
-  boxes.AppendElement(new DataReferenceBox(aControl));
-  MOZ_COUNT_CTOR(DataInformationBox);
-}
-
-DataInformationBox::~DataInformationBox()
-{
-  MOZ_COUNT_DTOR(DataInformationBox);
-}
-
-nsresult
-VideoMediaHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  size += sizeof(graphicsmode) +
-          sizeof(opcolor);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-VideoMediaHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(graphicsmode);
-  mControl->WriteArray(opcolor, 3);
-  return NS_OK;
-}
-
-VideoMediaHeaderBox::VideoMediaHeaderBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("vmhd"), 0, 1, aControl)
-  , graphicsmode(0)
-{
-  memset(opcolor, 0 , sizeof(opcolor));
-  MOZ_COUNT_CTOR(VideoMediaHeaderBox);
-}
-
-VideoMediaHeaderBox::~VideoMediaHeaderBox()
-{
-  MOZ_COUNT_DTOR(VideoMediaHeaderBox);
-}
-
-nsresult
-SoundMediaHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  balance = 0;
-  reserved = 0;
-  size += sizeof(balance) +
-          sizeof(reserved);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-SoundMediaHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(balance);
-  mControl->Write(reserved);
-
-  return NS_OK;
-}
-
-SoundMediaHeaderBox::SoundMediaHeaderBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("smhd"), 0, 0, aControl)
-{
-  MOZ_COUNT_CTOR(SoundMediaHeaderBox);
-}
-
-SoundMediaHeaderBox::~SoundMediaHeaderBox()
-{
-  MOZ_COUNT_DTOR(SoundMediaHeaderBox);
-}
-
-MediaInformationBox::MediaInformationBox(uint32_t aType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("minf"), aControl)
-{
-  mTrackType = aType;
-
-  if (mTrackType == Audio_Track) {
-    boxes.AppendElement(new SoundMediaHeaderBox(aControl));
-  } else if (mTrackType == Video_Track) {
-    boxes.AppendElement(new VideoMediaHeaderBox(aControl));
-  } else {
-    MOZ_ASSERT(0);
-  }
-
-  boxes.AppendElement(new DataInformationBox(aControl));
-  boxes.AppendElement(new SampleTableBox(aType, aControl));
-  MOZ_COUNT_CTOR(MediaInformationBox);
-}
-
-MediaInformationBox::~MediaInformationBox()
-{
-  MOZ_COUNT_DTOR(MediaInformationBox);
-}
-
-nsresult
-HandlerBox::Generate(uint32_t* aBoxSize)
-{
-  pre_defined = 0;
-  if (mTrackType == Audio_Track) {
-    handler_type = FOURCC('s', 'o', 'u', 'n');
-  } else if (mTrackType == Video_Track) {
-    handler_type = FOURCC('v', 'i', 'd', 'e');
-  }
-
-  size += sizeof(pre_defined) +
-          sizeof(handler_type) +
-          sizeof(reserved);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-HandlerBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(pre_defined);
-  mControl->Write(handler_type);
-  mControl->WriteArray(reserved, 3);
-
-  return NS_OK;
-}
-
-HandlerBox::HandlerBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("hdlr"), 0, 0, aControl)
-  , pre_defined(0)
-  , handler_type(0)
-{
-  mTrackType = aType;
-  memset(reserved, 0 , sizeof(reserved));
-  MOZ_COUNT_CTOR(HandlerBox);
-}
-
-HandlerBox::~HandlerBox()
-{
-  MOZ_COUNT_DTOR(HandlerBox);
-}
-
-MediaHeaderBox::MediaHeaderBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("mdhd"), 0, 0, aControl)
-  , creation_time(0)
-  , modification_time(0)
-  , timescale(0)
-  , duration(0)
-  , pad(0)
-  , lang1(0)
-  , lang2(0)
-  , lang3(0)
-  , pre_defined(0)
-{
-  mTrackType = aType;
-  MOZ_COUNT_CTOR(MediaHeaderBox);
-}
-
-MediaHeaderBox::~MediaHeaderBox()
-{
-  MOZ_COUNT_DTOR(MediaHeaderBox);
-}
-
-uint32_t
-MediaHeaderBox::GetTimeScale()
-{
-  if (mTrackType == Audio_Track) {
-    return mAudioMeta->GetAudioSampleRate();
-  }
-
-  return mVideoMeta->GetVideoClockRate();
-}
-
-nsresult
-MediaHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  creation_time = mControl->GetTime();
-  modification_time = mControl->GetTime();
-  timescale = GetTimeScale();
-  duration = 0; // fragmented mp4
-
-  pad = 0;
-  lang1 = 'u' - 0x60; // "und" underdetermined language
-  lang2 = 'n' - 0x60;
-  lang3 = 'd' - 0x60;
-  size += (pad.size() + lang1.size() + lang2.size() + lang3.size()) / CHAR_BIT;
-
-  pre_defined = 0;
-  size += sizeof(creation_time) +
-          sizeof(modification_time) +
-          sizeof(timescale) +
-          sizeof(duration) +
-          sizeof(pre_defined);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-MediaHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(creation_time);
-  mControl->Write(modification_time);
-  mControl->Write(timescale);
-  mControl->Write(duration);
-  mControl->WriteBits(pad.to_ulong(), pad.size());
-  mControl->WriteBits(lang1.to_ulong(), lang1.size());
-  mControl->WriteBits(lang2.to_ulong(), lang2.size());
-  mControl->WriteBits(lang3.to_ulong(), lang3.size());
-  mControl->Write(pre_defined);
-
-  return NS_OK;
-}
-
-MovieBox::MovieBox(ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("moov"), aControl)
-{
-  boxes.AppendElement(new MovieHeaderBox(aControl));
-  if (aControl->HasAudioTrack()) {
-    boxes.AppendElement(new TrackBox(Audio_Track, aControl));
-  }
-  if (aControl->HasVideoTrack()) {
-    boxes.AppendElement(new TrackBox(Video_Track, aControl));
-  }
-  boxes.AppendElement(new MovieExtendsBox(aControl));
-  MOZ_COUNT_CTOR(MovieBox);
-}
-
-MovieBox::~MovieBox()
-{
-  MOZ_COUNT_DTOR(MovieBox);
-}
-
-nsresult
-MovieHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  creation_time = mControl->GetTime();
-  modification_time = mControl->GetTime();
-  timescale = GetTimeScale();
-  duration = 0;     // The duration is always 0 in fragmented mp4.
-  next_track_ID = mControl->GetNextTrackID();
-
-  size += sizeof(next_track_ID) +
-          sizeof(creation_time) +
-          sizeof(modification_time) +
-          sizeof(timescale) +
-          sizeof(duration) +
-          sizeof(rate) +
-          sizeof(volume) +
-          sizeof(reserved16) +
-          sizeof(reserved32) +
-          sizeof(matrix) +
-          sizeof(pre_defined);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-MovieHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(creation_time);
-  mControl->Write(modification_time);
-  mControl->Write(timescale);
-  mControl->Write(duration);
-  mControl->Write(rate);
-  mControl->Write(volume);
-  mControl->Write(reserved16);
-  mControl->WriteArray(reserved32, 2);
-  mControl->WriteArray(matrix, 9);
-  mControl->WriteArray(pre_defined, 6);
-  mControl->Write(next_track_ID);
-
-  return NS_OK;
-}
-
-uint32_t
-MovieHeaderBox::GetTimeScale()
-{
-  // Only audio track in container.
-  if (mAudioMeta && !mVideoMeta) {
-    return mAudioMeta->GetAudioSampleRate();
-  }
-
-  // return video rate
-  return mVideoMeta->GetVideoClockRate();
-}
-
-MovieHeaderBox::~MovieHeaderBox()
-{
-  MOZ_COUNT_DTOR(MovieHeaderBox);
-}
-
-MovieHeaderBox::MovieHeaderBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("mvhd"), 0, 0, aControl)
-  , creation_time(0)
-  , modification_time(0)
-  , timescale(90000)
-  , duration(0)
-  , rate(0x00010000)
-  , volume(0x0100)
-  , reserved16(0)
-  , next_track_ID(1)
-{
-  memcpy(matrix, iso_matrix, sizeof(matrix));
-  memset(reserved32, 0, sizeof(reserved32));
-  memset(pre_defined, 0, sizeof(pre_defined));
-  MOZ_COUNT_CTOR(MovieHeaderBox);
-}
-
-TrackHeaderBox::TrackHeaderBox(uint32_t aType, ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("tkhd"), 0,
-            flags_track_enabled | flags_track_in_movie | flags_track_in_preview,
-            aControl)
-  , creation_time(0)
-  , modification_time(0)
-  , track_ID(0)
-  , reserved(0)
-  , duration(0)
-  , layer(0)
-  , alternate_group(0)
-  , volume(0)
-  , reserved3(0)
-  , width(0)
-  , height(0)
-{
-  mTrackType = aType;
-  memcpy(matrix, iso_matrix, sizeof(matrix));
-  memset(reserved2, 0, sizeof(reserved2));
-  MOZ_COUNT_CTOR(TrackHeaderBox);
-}
-
-TrackHeaderBox::~TrackHeaderBox()
-{
-  MOZ_COUNT_DTOR(TrackHeaderBox);
-}
-
-nsresult
-TrackHeaderBox::Generate(uint32_t* aBoxSize)
-{
-  creation_time = mControl->GetTime();
-  modification_time = mControl->GetTime();
-  track_ID = (mTrackType == Audio_Track ?
-                mControl->GetTrackID(mAudioMeta->GetKind()) :
-                mControl->GetTrackID(mVideoMeta->GetKind()));
-  // fragmented mp4
-  duration = 0;
-
-  // volume, audiotrack is always 0x0100 in 14496-12 8.3.2.2
-  volume = (mTrackType == Audio_Track ? 0x0100 : 0);
-
-  if (mTrackType == Video_Track) {
-    width = mVideoMeta->GetVideoDisplayWidth() << 16;
-    height = mVideoMeta->GetVideoDisplayHeight() << 16;
-    // Check display size, using the pixel size if any of them is invalid.
-    if (!width || !height) {
-      width = mVideoMeta->GetVideoWidth() << 16;
-      height = mVideoMeta->GetVideoHeight() << 16;
-    }
-  }
-
-  size += sizeof(creation_time) +
-          sizeof(modification_time) +
-          sizeof(track_ID) +
-          sizeof(reserved) +
-          sizeof(duration) +
-          sizeof(reserved2) +
-          sizeof(layer) +
-          sizeof(alternate_group) +
-          sizeof(volume) +
-          sizeof(reserved3) +
-          sizeof(matrix) +
-          sizeof(width) +
-          sizeof(height);
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-TrackHeaderBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  mControl->Write(creation_time);
-  mControl->Write(modification_time);
-  mControl->Write(track_ID);
-  mControl->Write(reserved);
-  mControl->Write(duration);
-  mControl->WriteArray(reserved2, 2);
-  mControl->Write(layer);
-  mControl->Write(alternate_group);
-  mControl->Write(volume);
-  mControl->Write(reserved3);
-  mControl->WriteArray(matrix, 9);
-  mControl->Write(width);
-  mControl->Write(height);
-
-  return NS_OK;
-}
-
-nsresult
-FileTypeBox::Generate(uint32_t* aBoxSize)
-{
-  minor_version = 0;
-
-  if (mControl->GetMuxingType() == ISOMediaWriter::TYPE_FRAG_MP4) {
-    if (!mControl->HasVideoTrack() && mControl->HasAudioTrack()) {
-      major_brand = "M4A ";
-    } else {
-      major_brand = "MP42";
-    }
-    compatible_brands.AppendElement("mp42");
-    compatible_brands.AppendElement("isom");
-  } else if (mControl->GetMuxingType() == ISOMediaWriter::TYPE_FRAG_3GP) {
-    major_brand = "3gp9";
-    // According to 3GPP TS 26.244 V12.2.0, section 5.3.4, it's recommended to
-    // list all compatible brands here. 3GP spec supports fragment from '3gp6'.
-    compatible_brands.AppendElement("3gp9");
-    compatible_brands.AppendElement("3gp8");
-    compatible_brands.AppendElement("3gp7");
-    compatible_brands.AppendElement("3gp6");
-    compatible_brands.AppendElement("isom");
-  } else if (mControl->GetMuxingType() == ISOMediaWriter::TYPE_FRAG_3G2) {
-    major_brand = "3g2a";
-    // 3GPP2 Release 0 and A and 3GPP Release 6 allow movie fragmentation
-    compatible_brands.AppendElement("3gp9");
-    compatible_brands.AppendElement("3gp8");
-    compatible_brands.AppendElement("3gp7");
-    compatible_brands.AppendElement("3gp6");
-    compatible_brands.AppendElement("isom");
-    compatible_brands.AppendElement("3g2c");
-    compatible_brands.AppendElement("3g2b");
-    compatible_brands.AppendElement("3g2a");
-  } else {
-    MOZ_ASSERT(0);
-  }
-
-  size += major_brand.Length() +
-          sizeof(minor_version) +
-          compatible_brands.Length() * 4;
-
-  *aBoxSize = size;
-
-  return NS_OK;
-}
-
-nsresult
-FileTypeBox::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-  mControl->WriteFourCC(major_brand.get());
-  mControl->Write(minor_version);
-  uint32_t len = compatible_brands.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    mControl->WriteFourCC(compatible_brands[i].get());
-  }
-
-  return NS_OK;
-}
-
-FileTypeBox::FileTypeBox(ISOControl* aControl)
-  : Box(NS_LITERAL_CSTRING("ftyp"), aControl)
-  , minor_version(0)
-{
-  MOZ_COUNT_CTOR(FileTypeBox);
-}
-
-FileTypeBox::~FileTypeBox()
-{
-  MOZ_COUNT_DTOR(FileTypeBox);
-}
-
-MediaBox::MediaBox(uint32_t aType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("mdia"), aControl)
-{
-  mTrackType = aType;
-  boxes.AppendElement(new MediaHeaderBox(aType, aControl));
-  boxes.AppendElement(new HandlerBox(aType, aControl));
-  boxes.AppendElement(new MediaInformationBox(aType, aControl));
-  MOZ_COUNT_CTOR(MediaBox);
-}
-
-MediaBox::~MediaBox()
-{
-  MOZ_COUNT_DTOR(MediaBox);
-}
-
-nsresult
-DefaultContainerImpl::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv;
-  uint32_t box_size;
-  uint32_t len = boxes.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    rv = boxes.ElementAt(i)->Generate(&box_size);
-    NS_ENSURE_SUCCESS(rv, rv);
-    size += box_size;
-  }
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-DefaultContainerImpl::Find(const nsACString& aType,
-                           nsTArray<RefPtr<MuxerOperation>>& aOperations)
-{
-  nsresult rv = Box::Find(aType, aOperations);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  uint32_t len = boxes.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    rv = boxes.ElementAt(i)->Find(aType, aOperations);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  return NS_OK;
-}
-
-nsresult
-DefaultContainerImpl::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  Box::Write();
-
-  nsresult rv;
-  uint32_t len = boxes.Length();
-  for (uint32_t i = 0; i < len; i++) {
-    rv = boxes.ElementAt(i)->Write();
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return NS_OK;
-}
-
-DefaultContainerImpl::DefaultContainerImpl(const nsACString& aType,
-                                           ISOControl* aControl)
-  : Box(aType, aControl)
-{
-}
-
-nsresult
-Box::Write()
-{
-  mControl->Write(size);
-  mControl->WriteFourCC(boxType.get());
-  return NS_OK;
-}
-
-nsresult
-Box::Find(const nsACString& aType, nsTArray<RefPtr<MuxerOperation>>& aOperations)
-{
-  if (boxType == aType) {
-    aOperations.AppendElement(this);
-  }
-  return NS_OK;
-}
-
-Box::Box(const nsACString& aType, ISOControl* aControl)
-  : size(8), mControl(aControl)
-{
-  MOZ_ASSERT(aType.Length() == 4);
-  boxType = aType;
-  aControl->GetAudioMetadata(mAudioMeta);
-  aControl->GetVideoMetadata(mVideoMeta);
-}
-
-FullBox::FullBox(const nsACString& aType, uint8_t aVersion, uint32_t aFlags,
-                 ISOControl* aControl)
-  : Box(aType, aControl)
-{
-  std::bitset<24> tmp_flags(aFlags);
-  version = aVersion;
-  flags = tmp_flags;
-  size += sizeof(version) + flags.size() / CHAR_BIT;
-}
-
-nsresult
-FullBox::Write()
-{
-  Box::Write();
-  mControl->Write(version);
-  mControl->WriteBits(flags.to_ulong(), flags.size());
-  return NS_OK;
-}
-
-TrackBox::TrackBox(uint32_t aTrackType, ISOControl* aControl)
-  : DefaultContainerImpl(NS_LITERAL_CSTRING("trak"), aControl)
-{
-  boxes.AppendElement(new TrackHeaderBox(aTrackType, aControl));
-  boxes.AppendElement(new MediaBox(aTrackType, aControl));
-  MOZ_COUNT_CTOR(TrackBox);
-}
-
-TrackBox::~TrackBox()
-{
-  MOZ_COUNT_DTOR(TrackBox);
-}
-
-SampleEntryBox::SampleEntryBox(const nsACString& aFormat, ISOControl* aControl)
-  : Box(aFormat, aControl)
-  , data_reference_index(0)
-{
-  data_reference_index = 1; // There is only one data reference in each track.
-  size += sizeof(reserved) +
-          sizeof(data_reference_index);
-  memset(reserved, 0, sizeof(reserved));
-}
-
-nsresult
-SampleEntryBox::Write()
-{
-  Box::Write();
-  mControl->Write(reserved, sizeof(reserved));
-  mControl->Write(data_reference_index);
-  return NS_OK;
-}
-
-nsresult
-AudioSampleEntry::Write()
-{
-  SampleEntryBox::Write();
-  mControl->Write(sound_version);
-  mControl->Write(reserved2, sizeof(reserved2));
-  mControl->Write(channels);
-  mControl->Write(sample_size);
-  mControl->Write(compressionId);
-  mControl->Write(packet_size);
-  mControl->Write(timeScale);
-  return NS_OK;
-}
-
-AudioSampleEntry::AudioSampleEntry(const nsACString& aFormat, ISOControl* aControl)
-  : SampleEntryBox(aFormat, aControl)
-  , sound_version(0)
-  , channels(2)
-  , sample_size(16)
-  , compressionId(0)
-  , packet_size(0)
-  , timeScale(0)
-{
-  memset(reserved2, 0 , sizeof(reserved2));
-  channels = mAudioMeta->GetAudioChannels();
-  timeScale = mAudioMeta->GetAudioSampleRate() << 16;
-
-  size += sizeof(sound_version) +
-          sizeof(reserved2) +
-          sizeof(sample_size) +
-          sizeof(channels) +
-          sizeof(packet_size) +
-          sizeof(compressionId) +
-          sizeof(timeScale);
-
-  MOZ_COUNT_CTOR(AudioSampleEntry);
-}
-
-AudioSampleEntry::~AudioSampleEntry()
-{
-  MOZ_COUNT_DTOR(AudioSampleEntry);
-}
-
-nsresult
-VisualSampleEntry::Write()
-{
-  SampleEntryBox::Write();
-
-  mControl->Write(reserved, sizeof(reserved));
-  mControl->Write(width);
-  mControl->Write(height);
-  mControl->Write(horizresolution);
-  mControl->Write(vertresolution);
-  mControl->Write(reserved2);
-  mControl->Write(frame_count);
-  mControl->Write(compressorName, sizeof(compressorName));
-  mControl->Write(depth);
-  mControl->Write(pre_defined);
-
-  return NS_OK;
-}
-
-VisualSampleEntry::VisualSampleEntry(const nsACString& aFormat, ISOControl* aControl)
-  : SampleEntryBox(aFormat, aControl)
-  , width(0)
-  , height(0)
-  , horizresolution(resolution_72_dpi)
-  , vertresolution(resolution_72_dpi)
-  , reserved2(0)
-  , frame_count(1)
-  , depth(video_depth)
-  , pre_defined(-1)
-{
-  memset(reserved, 0 , sizeof(reserved));
-  memset(compressorName, 0 , sizeof(compressorName));
-
-  // both fields occupy 16 bits defined in 14496-2 6.2.3.
-  width = mVideoMeta->GetVideoWidth();
-  height = mVideoMeta->GetVideoHeight();
-
-  size += sizeof(reserved) +
-          sizeof(width) +
-          sizeof(height) +
-          sizeof(horizresolution) +
-          sizeof(vertresolution) +
-          sizeof(reserved2) +
-          sizeof(frame_count) +
-          sizeof(compressorName) +
-          sizeof(depth) +
-          sizeof(pre_defined);
-
-  MOZ_COUNT_CTOR(VisualSampleEntry);
-}
-
-VisualSampleEntry::~VisualSampleEntry()
-{
-  MOZ_COUNT_DTOR(VisualSampleEntry);
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOMediaBoxes.h
+++ /dev/null
@@ -1,781 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef ISOMediaBoxes_h_
-#define ISOMediaBoxes_h_
-
-#include <bitset>
-#include "nsString.h"
-#include "nsTArray.h"
-#include "nsAutoPtr.h"
-#include "MuxerOperation.h"
-#include "mozilla/UniquePtr.h"
-
-#define WRITE_FULLBOX(_compositor, _size)       \
-  BoxSizeChecker checker(_compositor, _size);   \
-  FullBox::Write();
-
-#define FOURCC(a, b, c, d) ( ((a) << 24) | ((b) << 16) | ((c) << 8) | (d) )
-
-namespace mozilla {
-
-/**
- * track type from spec 8.4.3.3
- */
-#define Audio_Track 0x01
-#define Video_Track 0x02
-
-class AudioTrackMetadata;
-class VideoTrackMetadata;
-class ISOControl;
-
-/**
- * This is the base class for all ISO media format boxes.
- * It provides the fields of box type(four CC) and size.
- * The data members in the beginning of a Box (or its descendants)
- * are the 14496-12 defined member. Other members prefix with 'm'
- * are private control data.
- *
- * This class is for inherited only, it shouldn't be instanced directly.
- */
-class Box : public MuxerOperation {
-protected:
-  // ISO BMFF members
-  uint32_t size;     // 14496-12 4-2 'Object Structure'. Size of this box.
-  nsCString boxType; // four CC name, all table names are listed in
-                     // 14496-12 table 1.
-
-public:
-  // MuxerOperation methods
-  nsresult Write() override;
-  nsresult Find(const nsACString& aType,
-                nsTArray<RefPtr<MuxerOperation>>& aOperations) override;
-
-  // This helper class will compare the written size in Write() and the size in
-  // Generate(). If their are not equal, it will assert.
-  class BoxSizeChecker {
-  public:
-    BoxSizeChecker(ISOControl* aControl, uint32_t aSize);
-    ~BoxSizeChecker();
-
-    uint32_t ori_size;
-    uint32_t box_size;
-    ISOControl* mControl;
-  };
-
-protected:
-  Box() = delete;
-  Box(const nsACString& aType, ISOControl* aControl);
-
-  ISOControl* mControl;
-  RefPtr<AudioTrackMetadata> mAudioMeta;
-  RefPtr<VideoTrackMetadata> mVideoMeta;
-};
-
-/**
- * FullBox (and its descendants) is the box which contains the 'real' data
- * members. It is the edge in the ISO box structure and it doesn't contain
- * any box.
- *
- * This class is for inherited only, it shouldn't be instanced directly.
- */
-class FullBox : public Box {
-public:
-  // ISO BMFF members
-  uint8_t version;       // 14496-12 4.2 'Object Structure'
-  std::bitset<24> flags; //
-
-  // MuxerOperation methods
-  nsresult Write() override;
-
-protected:
-  // FullBox methods
-  FullBox(const nsACString& aType, uint8_t aVersion, uint32_t aFlags,
-          ISOControl* aControl);
-  FullBox() = delete;
-};
-
-/**
- * The default implementation of the container box.
- * Basically, the container box inherits this class and overrides the
- * constructor only.
- *
- * According to 14496-12 3.1.1 'container box', a container box is
- * 'box whose sole purpose is to contain and group a set of related boxes'
- *
- * This class is for inherited only, it shouldn't be instanced directly.
- */
-class DefaultContainerImpl : public Box {
-public:
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-  nsresult Find(const nsACString& aType,
-                nsTArray<RefPtr<MuxerOperation>>& aOperations) override;
-
-protected:
-  // DefaultContainerImpl methods
-  DefaultContainerImpl(const nsACString& aType, ISOControl* aControl);
-  DefaultContainerImpl() = delete;
-
-  nsTArray<RefPtr<MuxerOperation>> boxes;
-};
-
-// 14496-12 4.3 'File Type Box'
-// Box type: 'ftyp'
-class FileTypeBox : public Box {
-public:
-  // ISO BMFF members
-  nsCString major_brand; // four chars
-  uint32_t minor_version;
-  nsTArray<nsCString> compatible_brands;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // FileTypeBox methods
-  FileTypeBox(ISOControl* aControl);
-  ~FileTypeBox();
-};
-
-// 14496-12 8.2.1 'Movie Box'
-// Box type: 'moov'
-// MovieBox contains MovieHeaderBox, TrackBox and MovieExtendsBox.
-class MovieBox : public DefaultContainerImpl {
-public:
-  MovieBox(ISOControl* aControl);
-  ~MovieBox();
-};
-
-// 14496-12 8.2.2 'Movie Header Box'
-// Box type: 'mvhd'
-class MovieHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t creation_time;
-  uint32_t modification_time;
-  uint32_t timescale;
-  uint32_t duration;
-  uint32_t rate;
-  uint16_t volume;
-  uint16_t reserved16;
-  uint32_t reserved32[2];
-  uint32_t matrix[9];
-  uint32_t pre_defined[6];
-  uint32_t next_track_ID;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // MovieHeaderBox methods
-  MovieHeaderBox(ISOControl* aControl);
-  ~MovieHeaderBox();
-  uint32_t GetTimeScale();
-};
-
-// 14496-12 8.4.2 'Media Header Box'
-// Box type: 'mdhd'
-class MediaHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t creation_time;
-  uint32_t modification_time;
-  uint32_t timescale;
-  uint32_t duration;
-  std::bitset<1> pad;
-  std::bitset<5> lang1;
-  std::bitset<5> lang2;
-  std::bitset<5> lang3;
-  uint16_t pre_defined;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // MediaHeaderBox methods
-  MediaHeaderBox(uint32_t aType, ISOControl* aControl);
-  ~MediaHeaderBox();
-  uint32_t GetTimeScale();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.3.1 'Track Box'
-// Box type: 'trak'
-// TrackBox contains TrackHeaderBox and MediaBox.
-class TrackBox : public DefaultContainerImpl {
-public:
-  TrackBox(uint32_t aTrackType, ISOControl* aControl);
-  ~TrackBox();
-};
-
-// 14496-12 8.1.1 'Media Data Box'
-// Box type: 'mdat'
-class MediaDataBox : public Box {
-public:
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // MediaDataBox methods
-  uint32_t GetAllSampleSize() { return mAllSampleSize; }
-  uint32_t FirstSampleOffsetInMediaDataBox() { return mFirstSampleOffset; }
-  MediaDataBox(uint32_t aTrackType, ISOControl* aControl);
-  ~MediaDataBox();
-
-protected:
-  uint32_t mAllSampleSize;      // All audio and video sample size in this box.
-  uint32_t mFirstSampleOffset;  // The offset of first sample in this box from
-                                // the beginning of this mp4 file.
-  uint32_t mTrackType;
-};
-
-// flags for TrackRunBox::flags, 14496-12 8.8.8.1.
-#define flags_data_offset_present                     0x000001
-#define flags_first_sample_flags_present              0x000002
-#define flags_sample_duration_present                 0x000100
-#define flags_sample_size_present                     0x000200
-#define flags_sample_flags_present                    0x000400
-#define flags_sample_composition_time_offsets_present 0x000800
-
-// flag for TrackRunBox::tbl::sample_flags and TrackExtendsBox::default_sample_flags
-// which is defined in 14496-12 8.8.3.1.
-uint32_t set_sample_flags(bool aSync);
-
-// 14496-12 8.8.8 'Track Fragment Run Box'
-// Box type: 'trun'
-class TrackRunBox : public FullBox {
-public:
-  // ISO BMFF members
-  typedef struct {
-    uint32_t sample_duration;
-    uint32_t sample_size;
-    uint32_t sample_flags;
-    uint32_t sample_composition_time_offset;
-  } tbl;
-
-  uint32_t sample_count;
-  // the following are optional fields
-  uint32_t data_offset; // data offset exists when audio/video are present in file.
-  uint32_t first_sample_flags;
-  UniquePtr<tbl[]> sample_info_table;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // TrackRunBox methods
-  uint32_t GetAllSampleSize() { return mAllSampleSize; }
-  nsresult SetDataOffset(uint32_t aOffset);
-
-  TrackRunBox(uint32_t aType, uint32_t aFlags, ISOControl* aControl);
-  ~TrackRunBox();
-
-protected:
-  uint32_t fillSampleTable();
-
-  uint32_t mAllSampleSize;
-  uint32_t mTrackType;
-};
-
-// tf_flags in TrackFragmentHeaderBox, 14496-12 8.8.7.1.
-#define base_data_offset_present         0x000001
-#define sample_description_index_present 0x000002
-#define default_sample_duration_present  0x000008
-#define default_sample_size_present      0x000010
-#define default_sample_flags_present     0x000020
-#define duration_is_empty                0x010000
-#define default_base_is_moof             0x020000
-
-// 14496-12 8.8.7 'Track Fragment Header Box'
-// Box type: 'tfhd'
-class TrackFragmentHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t track_ID;
-  uint64_t base_data_offset;
-  uint32_t default_sample_duration;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // TrackFragmentHeaderBox methods
-  nsresult UpdateBaseDataOffset(uint64_t aOffset); // The offset of the first
-                                                   // sample in file.
-
-  TrackFragmentHeaderBox(uint32_t aType, uint32_t aFlags, ISOControl* aControl);
-  ~TrackFragmentHeaderBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.8.6 'Track Fragment Box'
-// Box type: 'traf'
-// TrackFragmentBox cotains TrackFragmentHeaderBox and TrackRunBox.
-class TrackFragmentBox : public DefaultContainerImpl {
-public:
-  TrackFragmentBox(uint32_t aType, ISOControl* aControl);
-  ~TrackFragmentBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.8.5 'Movie Fragment Header Box'
-// Box type: 'mfhd'
-class MovieFragmentHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t sequence_number;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // MovieFragmentHeaderBox methods
-  MovieFragmentHeaderBox(uint32_t aType, ISOControl* aControl);
-  ~MovieFragmentHeaderBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.8.4 'Movie Fragment Box'
-// Box type: 'moof'
-// MovieFragmentBox contains MovieFragmentHeaderBox and TrackFragmentBox.
-class MovieFragmentBox : public DefaultContainerImpl {
-public:
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-
-  // MovieFragmentBox methods
-  MovieFragmentBox(uint32_t aType, ISOControl* aControl);
-  ~MovieFragmentBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.8.3 'Track Extends Box'
-// Box type: 'trex'
-class TrackExtendsBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t track_ID;
-  uint32_t default_sample_description_index;
-  uint32_t default_sample_duration;
-  uint32_t default_sample_size;
-  uint32_t default_sample_flags;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // TrackExtendsBox methods
-  TrackExtendsBox(uint32_t aType, ISOControl* aControl);
-  ~TrackExtendsBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.8.1 'Movie Extends Box'
-// Box type: 'mvex'
-// MovieExtendsBox contains TrackExtendsBox.
-class MovieExtendsBox : public DefaultContainerImpl {
-public:
-  MovieExtendsBox(ISOControl* aControl);
-  ~MovieExtendsBox();
-};
-
-// 14496-12 8.7.5 'Chunk Offset Box'
-// Box type: 'stco'
-class ChunkOffsetBox : public FullBox {
-public:
-  // ISO BMFF members
-  typedef struct {
-    uint32_t chunk_offset;
-  } tbl;
-
-  uint32_t entry_count;
-  UniquePtr<tbl[]> sample_tbl;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // ChunkOffsetBox methods
-  ChunkOffsetBox(uint32_t aType, ISOControl* aControl);
-  ~ChunkOffsetBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.7.4 'Sample To Chunk Box'
-// Box type: 'stsc'
-class SampleToChunkBox : public FullBox {
-public:
-  // ISO BMFF members
-  typedef struct {
-    uint32_t first_chunk;
-    uint32_t sample_per_chunk;
-    uint32_t sample_description_index;
-  } tbl;
-
-  uint32_t entry_count;
-  UniquePtr<tbl[]> sample_tbl;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // SampleToChunkBox methods
-  SampleToChunkBox(uint32_t aType, ISOControl* aControl);
-  ~SampleToChunkBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.6.1.2 'Decoding Time to Sample Box'
-// Box type: 'stts'
-class TimeToSampleBox : public FullBox {
-public:
-  // ISO BMFF members
-  typedef struct {
-    uint32_t sample_count;
-    uint32_t sample_delta;
-  } tbl;
-
-  uint32_t entry_count;
-  UniquePtr<tbl[]> sample_tbl;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // TimeToSampleBox methods
-  TimeToSampleBox(uint32_t aType, ISOControl* aControl);
-  ~TimeToSampleBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-/**
- * 14496-12 8.5.2 'Sample Description Box'
- * This is the base class for VisualSampleEntry and AudioSampleEntry.
- *
- * This class is for inherited only, it shouldn't be instanced directly.
- *
- * The inhertied tree of a codec box should be:
- *
- *                                            +--> AVCSampleEntry
- *                  +--> VisualSampleEntryBox +
- *                  |                         +--> ...
- *   SampleEntryBox +
- *                  |                         +--> MP4AudioSampleEntry
- *                  +--> AudioSampleEntryBox  +
- *                                            +--> AMRSampleEntry
- *                                            +
- *                                            +--> ...
- *
- */
-class SampleEntryBox : public Box {
-public:
-  // ISO BMFF members
-  uint8_t reserved[6];
-  uint16_t data_reference_index;
-
-  // sampleentrybox methods
-  SampleEntryBox(const nsACString& aFormat, ISOControl* aControl);
-
-  // MuxerOperation methods
-  nsresult Write() override;
-
-protected:
-  SampleEntryBox() = delete;
-};
-
-// 14496-12 8.5.2 'Sample Description Box'
-// Box type: 'stsd'
-class SampleDescriptionBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t entry_count;
-  RefPtr<SampleEntryBox> sample_entry_box;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // SampleDescriptionBox methods
-  SampleDescriptionBox(uint32_t aType, ISOControl* aControl);
-  ~SampleDescriptionBox();
-
-protected:
-  nsresult CreateAudioSampleEntry(RefPtr<SampleEntryBox>& aSampleEntry);
-  nsresult CreateVideoSampleEntry(RefPtr<SampleEntryBox>& aSampleEntry);
-
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.5.2.2
-// The base class for audio codec box.
-// This class is for inherited only, it shouldn't be instanced directly.
-class AudioSampleEntry : public SampleEntryBox {
-public:
-  // ISO BMFF members
-  uint16_t sound_version;
-  uint8_t reserved2[6];
-  uint16_t channels;
-  uint16_t sample_size;
-  uint16_t compressionId;
-  uint16_t packet_size;
-  uint32_t timeScale;  // (sample rate of media) <<16
-
-  // MuxerOperation methods
-  nsresult Write() override;
-
-  ~AudioSampleEntry();
-
-protected:
-  AudioSampleEntry(const nsACString& aFormat, ISOControl* aControl);
-};
-
-// 14496-12 8.5.2.2
-// The base class for video codec box.
-// This class is for inherited only, it shouldn't be instanced directly.
-class VisualSampleEntry : public SampleEntryBox {
-public:
-  // ISO BMFF members
-  uint8_t reserved[16];
-  uint16_t width;
-  uint16_t height;
-
-  uint32_t horizresolution; // 72 dpi
-  uint32_t vertresolution;  // 72 dpi
-  uint32_t reserved2;
-  uint16_t frame_count;     // 1, defined in 14496-12 8.5.2.2
-
-  uint8_t compressorName[32];
-  uint16_t depth;       // 0x0018, defined in 14496-12 8.5.2.2;
-  uint16_t pre_defined; // -1, defined in 14496-12 8.5.2.2;
-
-  // MuxerOperation methods
-  nsresult Write() override;
-
-  // VisualSampleEntry methods
-  ~VisualSampleEntry();
-
-protected:
-  VisualSampleEntry(const nsACString& aFormat, ISOControl* aControl);
-};
-
-// 14496-12 8.7.3.2 'Sample Size Box'
-// Box type: 'stsz'
-class SampleSizeBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t sample_size;
-  uint32_t sample_count;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // SampleSizeBox methods
-  SampleSizeBox(ISOControl* aControl);
-  ~SampleSizeBox();
-};
-
-// 14496-12 8.5.1 'Sample Table Box'
-// Box type: 'stbl'
-//
-// SampleTableBox contains SampleDescriptionBox,
-//                         TimeToSampleBox,
-//                         SampleToChunkBox,
-//                         SampleSizeBox and
-//                         ChunkOffsetBox.
-class SampleTableBox : public DefaultContainerImpl {
-public:
-  SampleTableBox(uint32_t aType, ISOControl* aControl);
-  ~SampleTableBox();
-};
-
-// 14496-12 8.7.2 'Data Reference Box'
-// Box type: 'url '
-class DataEntryUrlBox : public FullBox {
-public:
-  // ISO BMFF members
-  // flags in DataEntryUrlBox::flags
-  const static uint16_t flags_media_at_the_same_file = 0x0001;
-
-  nsCString location;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // DataEntryUrlBox methods
-  DataEntryUrlBox();
-  DataEntryUrlBox(ISOControl* aControl);
-  DataEntryUrlBox(const DataEntryUrlBox& aBox);
-  ~DataEntryUrlBox();
-};
-
-// 14496-12 8.7.2 'Data Reference Box'
-// Box type: 'dref'
-class DataReferenceBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t entry_count;
-  nsTArray<nsAutoPtr<DataEntryUrlBox>> urls;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // DataReferenceBox methods
-  DataReferenceBox(ISOControl* aControl);
-  ~DataReferenceBox();
-};
-
-// 14496-12 8.7.1 'Data Information Box'
-// Box type: 'dinf'
-// DataInformationBox contains DataReferenceBox.
-class DataInformationBox : public DefaultContainerImpl {
-public:
-  DataInformationBox(ISOControl* aControl);
-  ~DataInformationBox();
-};
-
-// 14496-12 8.4.5.2 'Video Media Header Box'
-// Box type: 'vmhd'
-class VideoMediaHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint16_t graphicsmode;
-  uint16_t opcolor[3];
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // VideoMediaHeaderBox methods
-  VideoMediaHeaderBox(ISOControl* aControl);
-  ~VideoMediaHeaderBox();
-};
-
-// 14496-12 8.4.5.3 'Sound Media Header Box'
-// Box type: 'smhd'
-class SoundMediaHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint16_t balance;
-  uint16_t reserved;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // SoundMediaHeaderBox methods
-  SoundMediaHeaderBox(ISOControl* aControl);
-  ~SoundMediaHeaderBox();
-};
-
-// 14496-12 8.4.4 'Media Information Box'
-// Box type: 'minf'
-// MediaInformationBox contains SoundMediaHeaderBox, DataInformationBox and
-// SampleTableBox.
-class MediaInformationBox : public DefaultContainerImpl {
-public:
-  MediaInformationBox(uint32_t aType, ISOControl* aControl);
-  ~MediaInformationBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// flags for TrackHeaderBox::flags.
-#define flags_track_enabled    0x000001
-#define flags_track_in_movie   0x000002
-#define flags_track_in_preview 0x000004
-
-// 14496-12 8.3.2 'Track Header Box'
-// Box type: 'tkhd'
-class TrackHeaderBox : public FullBox {
-public:
-  // ISO BMFF members
-  // version = 0
-  uint32_t creation_time;
-  uint32_t modification_time;
-  uint32_t track_ID;
-  uint32_t reserved;
-  uint32_t duration;
-
-  uint32_t reserved2[2];
-  uint16_t layer;
-  uint16_t alternate_group;
-  uint16_t volume;
-  uint16_t reserved3;
-  uint32_t matrix[9];
-  uint32_t width;
-  uint32_t height;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // TrackHeaderBox methods
-  TrackHeaderBox(uint32_t aType, ISOControl* aControl);
-  ~TrackHeaderBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.4.3 'Handler Reference Box'
-// Box type: 'hdlr'
-class HandlerBox : public FullBox {
-public:
-  // ISO BMFF members
-  uint32_t pre_defined;
-  uint32_t handler_type;
-  uint32_t reserved[3];
-  nsCString name;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // HandlerBox methods
-  HandlerBox(uint32_t aType, ISOControl* aControl);
-  ~HandlerBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-// 14496-12 8.4.1 'Media Box'
-// Box type: 'mdia'
-// MediaBox contains MediaHeaderBox, HandlerBox, and MediaInformationBox.
-class MediaBox : public DefaultContainerImpl {
-public:
-  MediaBox(uint32_t aType, ISOControl* aControl);
-  ~MediaBox();
-
-protected:
-  uint32_t mTrackType;
-};
-
-}
-#endif // ISOMediaBoxes_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include "ISOMediaWriter.h"
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "ISOTrackMetadata.h"
-#include "nsThreadUtils.h"
-#include "MediaEncoder.h"
-#include "VideoUtils.h"
-#include "GeckoProfiler.h"
-
-#undef LOG
-#ifdef MOZ_WIDGET_GONK
-#include <android/log.h>
-#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
-#else
-#define LOG(args, ...)
-#endif
-
-namespace mozilla {
-
-const static uint32_t FRAG_DURATION = 2 * USECS_PER_S;    // microsecond per unit
-
-ISOMediaWriter::ISOMediaWriter(uint32_t aType, uint32_t aHint)
-  : ContainerWriter()
-  , mState(MUXING_HEAD)
-  , mBlobReady(false)
-  , mType(0)
-{
-  if (aType & CREATE_AUDIO_TRACK) {
-    mType |= Audio_Track;
-  }
-  if (aType & CREATE_VIDEO_TRACK) {
-    mType |= Video_Track;
-  }
-  mControl = new ISOControl(aHint);
-  MOZ_COUNT_CTOR(ISOMediaWriter);
-}
-
-ISOMediaWriter::~ISOMediaWriter()
-{
-  MOZ_COUNT_DTOR(ISOMediaWriter);
-}
-
-nsresult
-ISOMediaWriter::RunState()
-{
-  nsresult rv;
-  switch (mState) {
-    case MUXING_HEAD:
-    {
-      rv = mControl->GenerateFtyp();
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = mControl->GenerateMoov();
-      NS_ENSURE_SUCCESS(rv, rv);
-      mState = MUXING_FRAG;
-      break;
-    }
-    case MUXING_FRAG:
-    {
-      rv = mControl->GenerateMoof(mType);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      bool EOS;
-      if (ReadyToRunState(EOS) && EOS) {
-        mState = MUXING_DONE;
-      }
-      break;
-    }
-    case MUXING_DONE:
-    {
-      break;
-    }
-  }
-  mBlobReady = true;
-  return NS_OK;
-}
-
-nsresult
-ISOMediaWriter::WriteEncodedTrack(const EncodedFrameContainer& aData,
-                                  uint32_t aFlags)
-{
-  PROFILER_LABEL("ISOMediaWriter", "WriteEncodedTrack",
-    js::ProfileEntry::Category::OTHER);
-  // Muxing complete, it doesn't allowed to reentry again.
-  if (mState == MUXING_DONE) {
-    MOZ_ASSERT(false);
-    return NS_ERROR_FAILURE;
-  }
-
-  FragmentBuffer* frag = nullptr;
-  uint32_t len = aData.GetEncodedFrames().Length();
-
-  if (!len) {
-    // no frame? why bother to WriteEncodedTrack
-    return NS_OK;
-  }
-  for (uint32_t i = 0; i < len; i++) {
-    RefPtr<EncodedFrame> frame(aData.GetEncodedFrames()[i]);
-    EncodedFrame::FrameType type = frame->GetFrameType();
-    if (type == EncodedFrame::AAC_AUDIO_FRAME ||
-        type == EncodedFrame::AAC_CSD ||
-        type == EncodedFrame::AMR_AUDIO_FRAME ||
-        type == EncodedFrame::AMR_AUDIO_CSD ||
-        type == EncodedFrame::EVRC_AUDIO_FRAME ||
-        type == EncodedFrame::EVRC_AUDIO_CSD) {
-      frag = mAudioFragmentBuffer;
-    } else if (type == EncodedFrame::AVC_I_FRAME ||
-               type == EncodedFrame::AVC_P_FRAME ||
-               type == EncodedFrame::AVC_B_FRAME ||
-               type == EncodedFrame::AVC_CSD) {
-      frag = mVideoFragmentBuffer;
-    } else {
-      MOZ_ASSERT(0);
-      return NS_ERROR_FAILURE;
-    }
-
-    frag->AddFrame(frame);
-  }
-
-  // Encoder should send CSD (codec specific data) frame before sending the
-  // audio/video frames. When CSD data is ready, it is sufficient to generate a
-  // moov data. If encoder doesn't send CSD yet, muxer needs to wait before
-  // generating anything.
-  if (mType & Audio_Track && (!mAudioFragmentBuffer ||
-                              !mAudioFragmentBuffer->HasCSD())) {
-    return NS_OK;
-  }
-  if (mType & Video_Track && (!mVideoFragmentBuffer ||
-                              !mVideoFragmentBuffer->HasCSD())) {
-    return NS_OK;
-  }
-
-  // Only one FrameType in EncodedFrameContainer so it doesn't need to be
-  // inside the for-loop.
-  if (frag && (aFlags & END_OF_STREAM)) {
-    frag->SetEndOfStream();
-  }
-
-  nsresult rv;
-  bool EOS;
-  if (ReadyToRunState(EOS)) {
-    // Because track encoder won't generate new data after EOS, it needs to make
-    // sure the state reaches MUXING_DONE when EOS is signaled.
-    do {
-      rv = RunState();
-    } while (EOS && mState != MUXING_DONE);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return NS_OK;
-}
-
-bool
-ISOMediaWriter::ReadyToRunState(bool& aEOS)
-{
-  aEOS = false;
-  bool bReadyToMux = true;
-  if ((mType & Audio_Track) && (mType & Video_Track)) {
-    if (!mAudioFragmentBuffer->HasEnoughData()) {
-      bReadyToMux = false;
-    }
-    if (!mVideoFragmentBuffer->HasEnoughData()) {
-      bReadyToMux = false;
-    }
-
-    if (mAudioFragmentBuffer->EOS() && mVideoFragmentBuffer->EOS()) {
-      aEOS = true;
-      bReadyToMux = true;
-    }
-  } else if (mType == Audio_Track) {
-    if (!mAudioFragmentBuffer->HasEnoughData()) {
-      bReadyToMux = false;
-    }
-    if (mAudioFragmentBuffer->EOS()) {
-      aEOS = true;
-      bReadyToMux = true;
-    }
-  } else if (mType == Video_Track) {
-    if (!mVideoFragmentBuffer->HasEnoughData()) {
-      bReadyToMux = false;
-    }
-    if (mVideoFragmentBuffer->EOS()) {
-      aEOS = true;
-      bReadyToMux = true;
-    }
-  }
-
-  return bReadyToMux;
-}
-
-nsresult
-ISOMediaWriter::GetContainerData(nsTArray<nsTArray<uint8_t>>* aOutputBufs,
-                                 uint32_t aFlags)
-{
-  PROFILER_LABEL("ISOMediaWriter", "GetContainerData",
-    js::ProfileEntry::Category::OTHER);
-  if (mBlobReady) {
-    if (mState == MUXING_DONE) {
-      mIsWritingComplete = true;
-    }
-    mBlobReady = false;
-    return mControl->GetBufs(aOutputBufs);
-  }
-  return NS_OK;
-}
-
-nsresult
-ISOMediaWriter::SetMetadata(TrackMetadataBase* aMetadata)
-{
-  PROFILER_LABEL("ISOMediaWriter", "SetMetadata",
-    js::ProfileEntry::Category::OTHER);
-  if (aMetadata->GetKind() == TrackMetadataBase::METADATA_AAC ||
-      aMetadata->GetKind() == TrackMetadataBase::METADATA_AMR ||
-      aMetadata->GetKind() == TrackMetadataBase::METADATA_EVRC) {
-    mControl->SetMetadata(aMetadata);
-    mAudioFragmentBuffer = new FragmentBuffer(Audio_Track, FRAG_DURATION);
-    mControl->SetFragment(mAudioFragmentBuffer);
-    return NS_OK;
-  }
-  if (aMetadata->GetKind() == TrackMetadataBase::METADATA_AVC) {
-    mControl->SetMetadata(aMetadata);
-    mVideoFragmentBuffer = new FragmentBuffer(Video_Track, FRAG_DURATION);
-    mControl->SetFragment(mVideoFragmentBuffer);
-    return NS_OK;
-  }
-
-  return NS_ERROR_FAILURE;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOMediaWriter.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef ISOMediaWriter_h_
-#define ISOMediaWriter_h_
-
-#include "ContainerWriter.h"
-#include "nsAutoPtr.h"
-#include "nsIRunnable.h"
-
-namespace mozilla {
-
-class ISOControl;
-class FragmentBuffer;
-
-class ISOMediaWriter : public ContainerWriter
-{
-public:
-  // Generate an fragmented MP4 stream, ISO/IEC 14496-12.
-  // Brand names in 'ftyp' box are 'isom' and 'mp42'.
-  const static uint32_t TYPE_FRAG_MP4 = 1 << 0;
-
-  // Generate an fragmented 3GP stream, 3GPP TS 26.244,
-  // '5.4.3 Basic profile'.
-  // Brand names in 'ftyp' box are '3gp9' and 'isom'.
-  const static uint32_t TYPE_FRAG_3GP = 1 << 1;
-
-  // Generate an fragmented 3G2 stream, 3GPP2 C.S0050-B
-  // Brand names in 'ftyp' box are '3g2c' and 'isom'
-  const static uint32_t TYPE_FRAG_3G2 = 1 << 2;
-
-  // aType is the combination of CREATE_AUDIO_TRACK and CREATE_VIDEO_TRACK.
-  // It is a hint to muxer that the output streaming contains audio, video
-  // or both.
-  //
-  // aHint is one of the value in TYPE_XXXXXXXX. It is a hint to muxer what kind
-  // of ISO format should be generated.
-  ISOMediaWriter(uint32_t aType, uint32_t aHint = TYPE_FRAG_MP4);
-  ~ISOMediaWriter();
-
-  // ContainerWriter methods
-  nsresult WriteEncodedTrack(const EncodedFrameContainer &aData,
-                             uint32_t aFlags = 0) override;
-
-  nsresult GetContainerData(nsTArray<nsTArray<uint8_t>>* aOutputBufs,
-                            uint32_t aFlags = 0) override;
-
-  nsresult SetMetadata(TrackMetadataBase* aMetadata) override;
-
-protected:
-  /**
-   * The state of each state will generate one or more blob.
-   * Each blob will be a moov, moof, moof... until receiving EOS.
-   * The generated sequence is:
-   *
-   *   moov -> moof -> moof -> ... -> moof -> moof
-   *
-   * Following is the details of each state.
-   *   MUXING_HEAD:
-   *     It collects the metadata to generate a moov. The state transits to
-   *     MUXING_HEAD after output moov blob.
-   *
-   *   MUXING_FRAG:
-   *     It collects enough audio/video data to generate a fragment blob. This
-   *     will be repeated until END_OF_STREAM and then transiting to MUXING_DONE.
-   *
-   *   MUXING_DONE:
-   *     End of ISOMediaWriter life cycle.
-   */
-  enum MuxState {
-    MUXING_HEAD,
-    MUXING_FRAG,
-    MUXING_DONE,
-  };
-
-private:
-  nsresult RunState();
-
-  // True if one of following conditions hold:
-  //   1. Audio/Video accumulates enough data to generate a moof.
-  //   2. Get EOS signal.
-  //   aEOS will be assigned to true if it gets EOS signal.
-  bool ReadyToRunState(bool& aEOS);
-
-  // The main class to generate and iso box. Its life time is same as
-  // ISOMediaWriter and deleted only if ISOMediaWriter is destroyed.
-  nsAutoPtr<ISOControl> mControl;
-
-  // Buffers to keep audio/video data frames, they are created when metadata is
-  // received. Only one instance for each media type is allowed and they will be
-  // deleted only if ISOMediaWriter is destroyed.
-  nsAutoPtr<FragmentBuffer> mAudioFragmentBuffer;
-  nsAutoPtr<FragmentBuffer> mVideoFragmentBuffer;
-
-  MuxState mState;
-
-  // A flag to indicate the output buffer is ready to blob out.
-  bool mBlobReady;
-
-  // Combination of Audio_Track or Video_Track.
-  uint32_t mType;
-};
-
-} // namespace mozilla
-
-#endif // ISOMediaWriter_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/ISOTrackMetadata.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef ISOTrackMetadata_h_
-#define ISOTrackMetadata_h_
-
-#include "TrackMetadataBase.h"
-
-namespace mozilla {
-
-class AACTrackMetadata : public AudioTrackMetadata {
-public:
-  // AudioTrackMetadata members
-  uint32_t GetAudioFrameDuration() override { return mFrameDuration; }
-  uint32_t GetAudioFrameSize() override { return mFrameSize; }
-  uint32_t GetAudioSampleRate() override { return mSampleRate; }
-  uint32_t GetAudioChannels() override { return mChannels; }
-
-  // TrackMetadataBase member
-  MetadataKind GetKind() const override { return METADATA_AAC; }
-
-  // AACTrackMetadata members
-  AACTrackMetadata()
-    : mSampleRate(0)
-    , mFrameDuration(0)
-    , mFrameSize(0)
-    , mChannels(0) {
-    MOZ_COUNT_CTOR(AACTrackMetadata);
-  }
-  ~AACTrackMetadata() { MOZ_COUNT_DTOR(AACTrackMetadata); }
-
-  uint32_t mSampleRate;     // From 14496-3 table 1.16, it could be 7350 ~ 96000.
-  uint32_t mFrameDuration;  // Audio frame duration based on SampleRate.
-  uint32_t mFrameSize;      // Audio frame size, 0 is variant size.
-  uint32_t mChannels;       // Channel number, it should be 1 or 2.
-};
-
-// AVC clock rate is 90k Hz.
-#define AVC_CLOCK_RATE 90000
-
-class AVCTrackMetadata : public VideoTrackMetadata {
-public:
-  // VideoTrackMetadata members
-  uint32_t GetVideoHeight() override { return mHeight; }
-  uint32_t GetVideoWidth() override {return mWidth; }
-  uint32_t GetVideoDisplayHeight() override { return mDisplayHeight; }
-  uint32_t GetVideoDisplayWidth() override { return mDisplayWidth;  }
-  uint32_t GetVideoClockRate() override { return AVC_CLOCK_RATE; }
-  uint32_t GetVideoFrameRate() override { return mFrameRate; }
-
-  // TrackMetadataBase member
-  MetadataKind GetKind() const override { return METADATA_AVC; }
-
-  // AVCTrackMetadata
-  AVCTrackMetadata()
-    : mHeight(0)
-    , mWidth(0)
-    , mDisplayHeight(0)
-    , mDisplayWidth(0)
-    , mFrameRate(0) {
-    MOZ_COUNT_CTOR(AVCTrackMetadata);
-  }
-  ~AVCTrackMetadata() { MOZ_COUNT_DTOR(AVCTrackMetadata); }
-
-  uint32_t mHeight;
-  uint32_t mWidth;
-  uint32_t mDisplayHeight;
-  uint32_t mDisplayWidth;
-  uint32_t mFrameRate;       // frames per second
-};
-
-
-// AMR sample rate is 8000 samples/s.
-#define AMR_SAMPLE_RATE 8000
-
-// Channel number is always 1.
-#define AMR_CHANNELS    1
-
-// AMR speech codec, 3GPP TS 26.071. Encoder and continer support AMR-NB only
-// currently.
-class AMRTrackMetadata : public AudioTrackMetadata {
-public:
-  // AudioTrackMetadata members
-  //
-  // The number of sample sets generates by encoder is variant. So the
-  // frame duration and frame size are both 0.
-  uint32_t GetAudioFrameDuration() override { return 0; }
-  uint32_t GetAudioFrameSize() override { return 0; }
-  uint32_t GetAudioSampleRate() override { return AMR_SAMPLE_RATE; }
-  uint32_t GetAudioChannels() override { return AMR_CHANNELS; }
-
-  // TrackMetadataBase member
-  MetadataKind GetKind() const override { return METADATA_AMR; }
-
-  // AMRTrackMetadata members
-  AMRTrackMetadata() { MOZ_COUNT_CTOR(AMRTrackMetadata); }
-  ~AMRTrackMetadata() { MOZ_COUNT_DTOR(AMRTrackMetadata); }
-};
-
-// EVRC sample rate is 8000 samples/s.
-#define EVRC_SAMPLE_RATE 8000
-
-class EVRCTrackMetadata : public AudioTrackMetadata {
-public:
-  // AudioTrackMetadata members
-  //
-  // The number of sample sets generates by encoder is variant. So the
-  // frame duration and frame size are both 0.
-  uint32_t GetAudioFrameDuration() override { return 0; }
-  uint32_t GetAudioFrameSize() override { return 0; }
-  uint32_t GetAudioSampleRate() override { return EVRC_SAMPLE_RATE; }
-  uint32_t GetAudioChannels() override { return mChannels; }
-
-  // TrackMetadataBase member
-  MetadataKind GetKind() const override { return METADATA_EVRC; }
-
-  // EVRCTrackMetadata members
-  EVRCTrackMetadata()
-    : mChannels(0) {
-    MOZ_COUNT_CTOR(EVRCTrackMetadata);
-  }
-  ~EVRCTrackMetadata() { MOZ_COUNT_DTOR(EVRCTrackMetadata); }
-
-  uint32_t mChannels;       // Channel number, it should be 1 or 2.
-};
-
-}
-
-#endif // ISOTrackMetadata_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/MP4ESDS.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include <climits>
-#include "ISOControl.h"
-#include "ISOMediaBoxes.h"
-#include "MP4ESDS.h"
-
-namespace mozilla {
-
-nsresult
-MP4AudioSampleEntry::Generate(uint32_t* aBoxSize)
-{
-  uint32_t box_size;
-  nsresult rv = es->Generate(&box_size);
-  NS_ENSURE_SUCCESS(rv, rv);
-  size += box_size;
-
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-MP4AudioSampleEntry::Write()
-{
-  BoxSizeChecker checker(mControl, size);
-  nsresult rv;
-  rv = AudioSampleEntry::Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = es->Write();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-MP4AudioSampleEntry::MP4AudioSampleEntry(ISOControl* aControl)
-  : AudioSampleEntry(NS_LITERAL_CSTRING("mp4a"), aControl)
-{
-  es = new ESDBox(aControl);
-  MOZ_COUNT_CTOR(MP4AudioSampleEntry);
-}
-
-MP4AudioSampleEntry::~MP4AudioSampleEntry()
-{
-  MOZ_COUNT_DTOR(MP4AudioSampleEntry);
-}
-
-nsresult
-ESDBox::Generate(uint32_t* aBoxSize)
-{
-  uint32_t box_size;
-  es_descriptor->Generate(&box_size);
-  size += box_size;
-  *aBoxSize = size;
-  return NS_OK;
-}
-
-nsresult
-ESDBox::Write()
-{
-  WRITE_FULLBOX(mControl, size)
-  es_descriptor->Write();
-  return NS_OK;
-}
-
-ESDBox::ESDBox(ISOControl* aControl)
-  : FullBox(NS_LITERAL_CSTRING("esds"), 0, 0, aControl)
-{
-  es_descriptor = new ES_Descriptor(aControl);
-  MOZ_COUNT_CTOR(ESDBox);
-}
-
-ESDBox::~ESDBox()
-{
-  MOZ_COUNT_DTOR(ESDBox);
-}
-
-nsresult
-ES_Descriptor::Find(const nsACString& aType,
-                    nsTArray<RefPtr<MuxerOperation>>& aOperations)
-{
-  // ES_Descriptor is not a real ISOMediaBox, so we return nothing here.
-  return NS_OK;
-}
-
-nsresult
-ES_Descriptor::Write()
-{
-  mControl->Write(tag);
-  mControl->Write(length);
-  mControl->Write(ES_ID);
-  mControl->WriteBits(streamDependenceFlag.to_ulong(), streamDependenceFlag.size());
-  mControl->WriteBits(URL_Flag.to_ulong(), URL_Flag.size());
-  mControl->WriteBits(reserved.to_ulong(), reserved.size());
-  mControl->WriteBits(streamPriority.to_ulong(), streamPriority.size());
-  mControl->Write(DecodeSpecificInfo.Elements(), DecodeSpecificInfo.Length());
-
-  return NS_OK;
-}
-
-nsresult
-ES_Descriptor::Generate(uint32_t* aBoxSize)
-{
-  nsresult rv;
-  //   14496-1 '8.3.4 DecoderConfigDescriptor'
-  //   14496-1 '10.2.3 SL Packet Header Configuration'
-  FragmentBuffer* frag = mControl->GetFragment(Audio_Track);
-  rv = frag->GetCSD(DecodeSpecificInfo);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  length = sizeof(ES_ID) + 1;
-  length += DecodeSpecificInfo.Length();
-
-  *aBoxSize = sizeof(tag) + sizeof(length) + length;
-  return NS_OK;
-}
-
-ES_Descriptor::ES_Descriptor(ISOControl* aControl)
-  : tag(ESDescrTag)
-  , length(0)
-  , ES_ID(0)
-  , streamDependenceFlag(0)
-  , URL_Flag(0)
-  , reserved(0)
-  , streamPriority(0)
-  , mControl(aControl)
-{
-  MOZ_COUNT_CTOR(ES_Descriptor);
-}
-
-ES_Descriptor::~ES_Descriptor()
-{
-  MOZ_COUNT_DTOR(ES_Descriptor);
-}
-
-}
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/MP4ESDS.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#ifndef MP4ESDS_h_
-#define MP4ESDS_h_
-
-#include "nsTArray.h"
-#include "MuxerOperation.h"
-
-namespace mozilla {
-
-class ISOControl;
-
-/**
- * ESDS tag
- */
-#define ESDescrTag        0x03
-
-/**
- * 14496-1 '8.3.3 ES_Descriptor'.
- * It will get DecoderConfigDescriptor and SLConfigDescriptor from
- * AAC CSD data.
- */
-class ES_Descriptor : public MuxerOperation {
-public:
-  // ISO BMFF members
-  uint8_t tag;      // ESDescrTag
-  uint8_t length;
-  uint16_t ES_ID;
-  std::bitset<1> streamDependenceFlag;
-  std::bitset<1> URL_Flag;
-  std::bitset<1> reserved;
-  std::bitset<5> streamPriority;
-
-  nsTArray<uint8_t> DecodeSpecificInfo;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-  nsresult Find(const nsACString& aType,
-                nsTArray<RefPtr<MuxerOperation>>& aOperations) override;
-
-  // ES_Descriptor methods
-  ES_Descriptor(ISOControl* aControl);
-  ~ES_Descriptor();
-
-protected:
-  ISOControl* mControl;
-};
-
-// 14496-14 5.6 'Sample Description Boxes'
-// Box type: 'esds'
-class ESDBox : public FullBox {
-public:
-  // ISO BMFF members
-  RefPtr<ES_Descriptor> es_descriptor;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // ESDBox methods
-  ESDBox(ISOControl* aControl);
-  ~ESDBox();
-};
-
-// 14496-14 5.6 'Sample Description Boxes'
-// Box type: 'mp4a'
-class MP4AudioSampleEntry : public AudioSampleEntry {
-public:
-  // ISO BMFF members
-  RefPtr<ESDBox> es;
-
-  // MuxerOperation methods
-  nsresult Generate(uint32_t* aBoxSize) override;
-  nsresult Write() override;
-
-  // MP4AudioSampleEntry methods
-  MP4AudioSampleEntry(ISOControl* aControl);
-  ~MP4AudioSampleEntry();
-};
-
-}
-
-#endif // MP4ESDS_h_
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/MuxerOperation.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include "nsString.h"
-#include "nsTArray.h"
-
-#ifndef MuxerOperation_h_
-#define MuxerOperation_h_
-
-namespace mozilla {
-
-/**
- * The interface for ISO box. All Boxes inherit from this interface.
- * Generate() and Write() are needed to be called to produce a complete box.
- *
- * Generate() will generate all the data structures and their size.
- *
- * Write() will write all data into muxing output stream (ISOControl actually)
- * and update the data which can't be known at Generate() (for example, the
- * offset of the video data in mp4 file).
- *
- * ISO base media format is composed of several container boxes and the contained
- * boxes. The container boxes hold a list of MuxerOperation which is implemented
- * by contained boxes. The contained boxes will be called via the list.
- * For example:
- *   MovieBox (container) ---> boxes (array of MuxerOperation)
- *                              |---> MovieHeaderBox (full box)
- *                              |---> TrakBox (container)
- *                              |---> MovieExtendsBox (container)
- *
- * The complete box structure can be found at 14496-12 E.2 "The‘isom’brand".
- */
-class MuxerOperation {
-public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MuxerOperation)
-
-  // Generate data of this box and its contained box, and calculate box size.
-  virtual nsresult Generate(uint32_t* aBoxSize) = 0;
-
-  // Write data to stream.
-  virtual nsresult Write() = 0;
-
-  // Find the box type via its name (name is the box type defined in 14496-12;
-  // for example, 'moov' is the name of MovieBox).
-  // It can only look child boxes including itself and the box in the boxes
-  // list if exists. It can't look parent boxes.
-  virtual nsresult Find(const nsACString& aType,
-                        nsTArray<RefPtr<MuxerOperation>>& aOperations) = 0;
-
-protected:
-  virtual ~MuxerOperation() {}
-};
-
-}
-#endif
deleted file mode 100644
--- a/dom/media/encoder/fmp4_muxer/moz.build
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-EXPORTS += [
-    'ISOMediaWriter.h',
-    'ISOTrackMetadata.h',
-]
-
-UNIFIED_SOURCES += [
-    'AMRBox.cpp',
-    'AVCBox.cpp',
-    'EVRCBox.cpp',
-    'ISOControl.cpp',
-    'ISOMediaBoxes.cpp',
-    'ISOMediaWriter.cpp',
-    'MP4ESDS.cpp',
-]
-
-FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/dom/media/platforms/omx/GonkOmxPlatformLayer.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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 "GonkOmxPlatformLayer.h"
-
-#include <binder/MemoryDealer.h>
-#include <cutils/properties.h>
-#include <media/IOMX.h>
-#include <media/stagefright/MediaCodecList.h>
-#include <utils/List.h>
-
-#include "mozilla/Monitor.h"
-#include "mozilla/layers/TextureClient.h"
-#include "mozilla/layers/GrallocTextureClient.h"
-#include "mozilla/layers/ImageBridgeChild.h"
-#include "mozilla/layers/TextureClientRecycleAllocator.h"
-
-#include "ImageContainer.h"
-#include "MediaInfo.h"
-#include "OmxDataDecoder.h"
-
-
-#ifdef LOG
-#undef LOG
-#endif
-
-#define LOG(arg, ...) MOZ_LOG(sPDMLog, mozilla::LogLevel::Debug, ("GonkOmxPlatformLayer(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
-
-#define CHECK_ERR(err)                    \
-  if (err != OK)                       {  \
-    LOG("error %d at %s", err, __func__); \
-    return NS_ERROR_FAILURE;              \
-  }                                       \
-
-// Android proprietary value.
-#define ANDROID_OMX_VIDEO_CodingVP8 (static_cast<OMX_VIDEO_CODINGTYPE>(9))
-
-using namespace android;
-
-namespace mozilla {
-
-// In Gonk, the software component name has prefix "OMX.google". It needs to
-// have a way to use hardware codec first.
-bool IsSoftwareCodec(const char* aComponentName)
-{
-  nsAutoCString str(aComponentName);
-  return (str.Find(NS_LITERAL_CSTRING("OMX.google.")) == -1 ? false : true);
-}
-
-bool IsInEmulator()
-{
-  char propQemu[PROPERTY_VALUE_MAX];
-  property_get("ro.kernel.qemu", propQemu, "");
-  return !strncmp(propQemu, "1", 1);
-}
-
-class GonkOmxObserver : public BnOMXObserver {
-public:
-  void onMessage(const omx_message& aMsg)
-  {
-    switch (aMsg.type) {
-      case omx_message::EVENT:
-      {
-        sp<GonkOmxObserver> self = this;
-        nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self, aMsg] () {
-          if (self->mClient && self->mClient->Event(aMsg.u.event_data.event,
-                                                    aMsg.u.event_data.data1,
-                                                    aMsg.u.event_data.data2))
-          {
-            return;
-          }
-        });
-        mTaskQueue->Dispatch(r.forget());
-        break;
-      }
-      case omx_message::EMPTY_BUFFER_DONE:
-      {
-        sp<GonkOmxObserver> self = this;
-        nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self, aMsg] () {
-          if (!self->mPromiseLayer) {
-            return;
-          }
-          BufferData::BufferID id = (BufferData::BufferID)aMsg.u.buffer_data.buffer;
-          self->mPromiseLayer->EmptyFillBufferDone(OMX_DirInput, id);
-        });
-        mTaskQueue->Dispatch(r.forget());
-        break;
-      }
-      case omx_message::FILL_BUFFER_DONE:
-      {
-        sp<GonkOmxObserver> self = this;
-        nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self, aMsg] () {
-          if (!self->mPromiseLayer) {
-            return;
-          }
-
-          // TODO: these codes look a little ugly, it'd be better to improve them.
-          RefPtr<BufferData> buf;
-          BufferData::BufferID id = (BufferData::BufferID)aMsg.u.extended_buffer_data.buffer;
-          buf = self->mPromiseLayer->FindAndRemoveBufferHolder(OMX_DirOutput, id);
-          MOZ_RELEASE_ASSERT(buf);
-          GonkBufferData* gonkBuffer = static_cast<GonkBufferData*>(buf.get());
-
-          // Copy the critical information to local buffer.
-          if (gonkBuffer->IsLocalBuffer()) {
-            gonkBuffer->mBuffer->nOffset = aMsg.u.extended_buffer_data.range_offset;
-            gonkBuffer->mBuffer->nFilledLen = aMsg.u.extended_buffer_data.range_length;
-            gonkBuffer->mBuffer->nFlags = aMsg.u.extended_buffer_data.flags;
-            gonkBuffer->mBuffer->nTimeStamp = aMsg.u.extended_buffer_data.timestamp;
-          }
-          self->mPromiseLayer->EmptyFillBufferDone(OMX_DirOutput, buf);
-        });
-        mTaskQueue->Dispatch(r.forget());
-        break;
-      }
-      default:
-      {
-        LOG("Unhandle event %d", aMsg.type);
-      }
-    }
-  }
-
-  void Shutdown()
-  {
-    MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
-    mPromiseLayer = nullptr;
-    mClient = nullptr;
-  }
-
-  GonkOmxObserver(TaskQueue* aTaskQueue, OmxPromiseLayer* aPromiseLayer, OmxDataDecoder* aDataDecoder)
-    : mTaskQueue(aTaskQueue)
-    , mPromiseLayer(aPromiseLayer)
-    , mClient(aDataDecoder)
-  {
-  }
-
-protected:
-  RefPtr<TaskQueue> mTaskQueue;
-  // TODO:
-  //   we should combine both event handlers into one. And we should provide
-  //   an unified way for event handling in OmxPlatformLayer class.
-  RefPtr<OmxPromiseLayer> mPromiseLayer;
-  RefPtr<OmxDataDecoder> mClient;
-};
-
-// This class allocates Gralloc buffer and manages TextureClient's recycle.
-class GonkTextureClientRecycleHandler : public layers::ITextureClientRecycleAllocator
-{
-  typedef MozPromise<layers::TextureClient*, nsresult, /* IsExclusive = */ true> TextureClientRecyclePromise;
-
-public:
-  GonkTextureClientRecycleHandler(OMX_VIDEO_PORTDEFINITIONTYPE& aDef)
-    : ITextureClientRecycleAllocator()
-    , mMonitor("GonkTextureClientRecycleHandler")
-  {
-    RefPtr<layers::ImageBridgeChild> bridge = layers::ImageBridgeChild::GetSingleton();
-
-    // Allocate Gralloc texture memory.
-    layers::GrallocTextureData* textureData =
-      layers::GrallocTextureData::Create(gfx::IntSize(aDef.nFrameWidth, aDef.nFrameHeight),
-                                         aDef.eColorFormat,
-                                         gfx::BackendType::NONE,
-                                         GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_READ_OFTEN,
-                                         bridge);
-
-    mGraphBuffer = textureData->GetGraphicBuffer();
-    MOZ_ASSERT(mGraphBuffer.get());
-
-    mTextureClient =
-      layers::TextureClient::CreateWithData(textureData,
-                                            layers::TextureFlags::DEALLOCATE_CLIENT | layers::TextureFlags::RECYCLE,
-                                            bridge);
-    MOZ_ASSERT(mTextureClient);
-
-    mPromise.SetMonitor(&mMonitor);
-  }
-
-  RefPtr<TextureClientRecyclePromise> WaitforRecycle()
-  {
-    MonitorAutoLock lock(mMonitor);
-    MOZ_ASSERT(!!mGraphBuffer.get());
-
-    mTextureClient->SetRecycleAllocator(this);
-    return mPromise.Ensure(__func__);
-  }
-
-  // DO NOT use smart pointer to receive TextureClient; otherwise it will
-  // distrupt the reference count.
-  layers::TextureClient* GetTextureClient()
-  {
-    return mTextureClient;
-  }
-
-  GraphicBuffer* GetGraphicBuffer()
-  {
-    MonitorAutoLock lock(mMonitor);
-    return mGraphBuffer.get();
-  }
-
-  // This function is called from layers thread.
-  void RecycleTextureClient(layers::TextureClient* aClient) override
-  {
-    MOZ_ASSERT(mTextureClient == aClient);
-
-    // Clearing the recycle allocator drops a reference, so make sure we stay alive
-    // for the duration of this function.
-    RefPtr<GonkTextureClientRecycleHandler> kungFuDeathGrip(this);
-    aClient->SetRecycleAllocator(nullptr);
-
-    {
-      MonitorAutoLock lock(mMonitor);
-      mPromise.ResolveIfExists(mTextureClient, __func__);
-    }
-  }
-
-  void Shutdown()
-  {
-    MonitorAutoLock lock(mMonitor);
-
-    mPromise.RejectIfExists(NS_ERROR_FAILURE, __func__);
-
-    // DO NOT clear TextureClient here.
-    // The ref count could be 1 and RecycleCallback will be called if we clear
-    // the ref count here. That breaks the whole mechanism. (RecycleCallback
-    // should be called from layers)
-    mGraphBuffer = nullptr;
-  }
-
-private:
-  // Because TextureClient calls RecycleCallbackl when ref count is 1, so we
-  // should hold only one reference here and use raw pointer when out of this
-  // class.
-  RefPtr<layers::TextureClient> mTextureClient;
-
-  // It is protected by mMonitor.
-  sp<android::GraphicBuffer> mGraphBuffer;
-
-  // It is protected by mMonitor.
-  MozPromiseHolder<TextureClientRecyclePromise> mPromise;
-
-  Monitor mMonitor;
-};
-
-GonkBufferData::GonkBufferData(bool aLiveInLocal,
-                               GonkOmxPlatformLayer* aGonkPlatformLayer)
-  : BufferData(nullptr)
-  , mId(0)
-  , mGonkPlatformLayer(aGonkPlatformLayer)
-{
-  if (!aLiveInLocal) {
-    mMirrorBuffer = new OMX_BUFFERHEADERTYPE;
-    PodZero(mMirrorBuffer.get());
-    mBuffer = mMirrorBuffer.get();
-  }
-}
-
-void
-GonkBufferData::ReleaseBuffer()
-{
-  if (mTextureClientRecycleHandler) {
-    mTextureClientRecycleHandler->Shutdown();
-    mTextureClientRecycleHandler = nullptr;
-  }
-}
-
-nsresult
-GonkBufferData::InitSharedMemory(android::IMemory* aMemory)
-{
-  MOZ_RELEASE_ASSERT(mMirrorBuffer.get());
-
-  // aMemory is a IPC memory, it is safe to use it here.
-  mBuffer->pBuffer = (OMX_U8*)aMemory->pointer();
-  mBuffer->nAllocLen = aMemory->size();
-  return NS_OK;
-}
-
-nsresult
-GonkBufferData::InitLocalBuffer(IOMX::buffer_id aId)
-{
-  MOZ_RELEASE_ASSERT(!mMirrorBuffer.get());
-
-  mBuffer = (OMX_BUFFERHEADERTYPE*)aId;
-  return NS_OK;
-}
-
-nsresult
-GonkBufferData::InitGraphicBuffer(OMX_VIDEO_PORTDEFINITIONTYPE& aDef)
-{
-  mTextureClientRecycleHandler = new GonkTextureClientRecycleHandler(aDef);
-
-  if (!mTextureClientRecycleHandler->GetGraphicBuffer()) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-already_AddRefed<MediaData>
-GonkBufferData::GetPlatformMediaData()
-{
-  if (mGonkPlatformLayer->GetTrackInfo()->GetAsAudioInfo()) {
-    // This is audio decoding.
-    return nullptr;
-  }
-
-  if (!mTextureClientRecycleHandler) {
-    // There is no GraphicBuffer, it should fallback to normal YUV420 VideoData.
-    return nullptr;
-  }
-
-  VideoInfo info(*mGonkPlatformLayer->GetTrackInfo()->GetAsVideoInfo());
-  RefPtr<VideoData> data =
-    VideoData::CreateAndCopyIntoTextureClient(info,
-                                              0,
-                                              mBuffer->nTimeStamp,
-                                              1,
-                                              mTextureClientRecycleHandler->GetTextureClient(),
-                                              false,
-                                              0,
-                                              info.ImageRect());
-  LOG("%p, disp width %d, height %d, pic width %d, height %d, time %ld",
-      this, info.mDisplay.width, info.mDisplay.height,
-      info.mImage.width, info.mImage.height, mBuffer->nTimeStamp);
-
-  // Get TextureClient Promise here to wait for resolved.
-  RefPtr<GonkBufferData> self(this);
-  mTextureClientRecycleHandler->WaitforRecycle()
-    ->Then(mGonkPlatformLayer->GetTaskQueue(), __func__,
-           [self] () {
-             self->mPromise.ResolveIfExists(self, __func__);
-           },
-           [self] () {
-             OmxBufferFailureHolder failure(OMX_ErrorUndefined, self);
-             self->mPromise.RejectIfExists(failure, __func__);
-           });
-
-  return data.forget();
-}
-
-GonkOmxPlatformLayer::GonkOmxPlatformLayer(OmxDataDecoder* aDataDecoder,
-                                           OmxPromiseLayer* aPromiseLayer,
-                                           TaskQueue* aTaskQueue,
-                                           layers::ImageContainer* aImageContainer)
-  : mTaskQueue(aTaskQueue)
-  , mImageContainer(aImageContainer)
-  , mNode(0)
-{
-  mOmxObserver = new GonkOmxObserver(mTaskQueue, aPromiseLayer, aDataDecoder);
-}
-
-nsresult
-GonkOmxPlatformLayer::AllocateOmxBuffer(OMX_DIRTYPE aType,
-                                        BUFFERLIST* aBufferList)
-{
-  MOZ_ASSERT(!mMemoryDealer[aType].get());
-
-  // Get port definition.
-  OMX_PARAM_PORTDEFINITIONTYPE def;
-  nsTArray<uint32_t> portindex;
-  GetPortIndices(portindex);
-  for (auto idx : portindex) {
-    InitOmxParameter(&def);
-    def.nPortIndex = idx;
-
-    OMX_ERRORTYPE err = GetParameter(OMX_IndexParamPortDefinition,
-                                     &def,
-                                     sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
-    if (err != OMX_ErrorNone) {
-      return NS_ERROR_FAILURE;
-    } else if (def.eDir == aType) {
-      LOG("Get OMX_IndexParamPortDefinition: port: %d, type: %d", def.nPortIndex, def.eDir);
-      break;
-    }
-  }
-
-  size_t t = 0;
-
-  // Configure video output GraphicBuffer for video decoding acceleration.
-  bool useGralloc = false;
-  if (aType == OMX_DirOutput && mQuirks.test(kRequiresAllocateBufferOnOutputPorts) &&
-      (def.eDomain == OMX_PortDomainVideo)) {
-    if (NS_FAILED(EnableOmxGraphicBufferPort(def))) {
-      return NS_ERROR_FAILURE;
-    }
-
-    LOG("Enable OMX GraphicBuffer port, number %d, width %d, height %d", def.nBufferCountActual,
-        def.format.video.nFrameWidth, def.format.video.nFrameHeight);
-
-    useGralloc = true;
-
-    t = 1024; // MemoryDealer doesn't like 0, it's just for MemoryDealer happy.
-  } else {
-    t = def.nBufferCountActual * def.nBufferSize;
-    LOG("Buffer count %d, buffer size %d", def.nBufferCountActual, def.nBufferSize);
-  }
-
-  bool liveinlocal = mOmx->livesLocally(mNode, getpid());
-
-  // MemoryDealer is a IPC buffer allocator in Gonk because IOMX is actually
-  // lives in mediaserver.
-  mMemoryDealer[aType] = new MemoryDealer(t, "Gecko-OMX");
-  for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
-    RefPtr<GonkBufferData> buffer;
-    IOMX::buffer_id bufferID;
-    status_t st;
-    nsresult rv;
-
-    buffer = new GonkBufferData(liveinlocal, this);
-    if (useGralloc) {
-      // Buffer is lived remotely. Use GraphicBuffer for decoded video frame display.
-      rv = buffer->InitGraphicBuffer(def.format.video);
-      NS_ENSURE_SUCCESS(rv, rv);
-      st = mOmx->useGraphicBuffer(mNode,
-                                  def.nPortIndex,
-                                  buffer->mTextureClientRecycleHandler->GetGraphicBuffer(),
-                                  &bufferID);
-      CHECK_ERR(st);
-    } else {
-      sp<IMemory> mem = mMemoryDealer[aType]->allocate(def.nBufferSize);
-      MOZ_ASSERT(mem.get());
-
-      if ((mQuirks.test(kRequiresAllocateBufferOnInputPorts) && aType == OMX_DirInput) ||
-          (mQuirks.test(kRequiresAllocateBufferOnOutputPorts) && aType == OMX_DirOutput)) {
-        // Buffer is lived remotely. We allocate a local OMX_BUFFERHEADERTYPE
-        // as the mirror of the remote OMX_BUFFERHEADERTYPE.
-        st = mOmx->allocateBufferWithBackup(mNode, aType, mem, &bufferID);
-        CHECK_ERR(st);
-        rv = buffer->InitSharedMemory(mem.get());
-        NS_ENSURE_SUCCESS(rv, rv);
-      } else {
-        // Buffer is lived locally, bufferID is the actually OMX_BUFFERHEADERTYPE
-        // pointer.
-        st = mOmx->useBuffer(mNode, aType, mem, &bufferID);
-        CHECK_ERR(st);
-        rv = buffer->InitLocalBuffer(bufferID);
-        NS_ENSURE_SUCCESS(rv, rv);
-      }
-    }
-
-    rv = buffer->SetBufferId(bufferID);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    aBufferList->AppendElement(buffer);
-  }
-
-  return NS_OK;
-}
-
-nsresult
-GonkOmxPlatformLayer::ReleaseOmxBuffer(OMX_DIRTYPE aType,
-                                       BUFFERLIST* aBufferList)
-{
-  status_t st;
-  uint32_t len = aBufferList->Length();
-  for (uint32_t i = 0; i < len; i++) {
-    GonkBufferData* buffer = static_cast<GonkBufferData*>(aBufferList->ElementAt(i).get());
-    IOMX::buffer_id id = (OMX_BUFFERHEADERTYPE*) buffer->ID();
-    st = mOmx->freeBuffer(mNode, aType, id);
-    if (st != OK) {
-      return NS_ERROR_FAILURE;
-    }
-    buffer->ReleaseBuffer();
-  }
-  aBufferList->Clear();
-  mMemoryDealer[aType].clear();
-
-  return NS_OK;
-}
-
-nsresult
-GonkOmxPlatformLayer::EnableOmxGraphicBufferPort(OMX_PARAM_PORTDEFINITIONTYPE& aDef)
-{
-  status_t st;
-
-  st = mOmx->enableGraphicBuffers(mNode, aDef.nPortIndex, OMX_TRUE);
-  CHECK_ERR(st);
-
-  return NS_OK;
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::GetState(OMX_STATETYPE* aType)
-{
-  return (OMX_ERRORTYPE)mOmx->getState(mNode, aType);
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::GetParameter(OMX_INDEXTYPE aParamIndex,
-                                   OMX_PTR aComponentParameterStructure,
-                                   OMX_U32 aComponentParameterSize)
-{
-  return (OMX_ERRORTYPE)mOmx->getParameter(mNode,
-                                           aParamIndex,
-                                           aComponentParameterStructure,
-                                           aComponentParameterSize);
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::SetParameter(OMX_INDEXTYPE aParamIndex,
-                                   OMX_PTR aComponentParameterStructure,
-                                   OMX_U32 aComponentParameterSize)
-{
-  return (OMX_ERRORTYPE)mOmx->setParameter(mNode,
-                                           aParamIndex,
-                                           aComponentParameterStructure,
-                                           aComponentParameterSize);
-}
-
-nsresult
-GonkOmxPlatformLayer::Shutdown()
-{
-  mOmx->freeNode(mNode);
-  mOmxObserver->Shutdown();
-  mOmxObserver = nullptr;
-  mOmxClient.disconnect();
-
-  return NS_OK;
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::InitOmxToStateLoaded(const TrackInfo* aInfo)
-{
-  mInfo = aInfo;
-  status_t err = mOmxClient.connect();
-  if (err != OK) {
-      return OMX_ErrorUndefined;
-  }
-  mOmx = mOmxClient.interface();
-  if (!mOmx.get()) {
-    return OMX_ErrorUndefined;
-  }
-
-  LOG("find componenet for mime type %s", mInfo->mMimeType.Data());
-
-  nsTArray<ComponentInfo> components;
-  if (FindComponents(mInfo->mMimeType, &components)) {
-    for (auto comp : components) {
-      if (LoadComponent(comp)) {
-        return OMX_ErrorNone;
-      }
-    }
-  }
-
-  LOG("no component is loaded");
-  return OMX_ErrorUndefined;
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::EmptyThisBuffer(BufferData* aData)
-{
-  return (OMX_ERRORTYPE)mOmx->emptyBuffer(mNode,
-                                          (IOMX::buffer_id)aData->ID(),
-                                          aData->mBuffer->nOffset,
-                                          aData->mBuffer->nFilledLen,
-                                          aData->mBuffer->nFlags,
-                                          aData->mBuffer->nTimeStamp);
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::FillThisBuffer(BufferData* aData)
-{
-  return (OMX_ERRORTYPE)mOmx->fillBuffer(mNode, (IOMX::buffer_id)aData->ID());
-}
-
-OMX_ERRORTYPE
-GonkOmxPlatformLayer::SendCommand(OMX_COMMANDTYPE aCmd,
-                                  OMX_U32 aParam1,
-                                  OMX_PTR aCmdData)
-{
-  return  (OMX_ERRORTYPE)mOmx->sendCommand(mNode, aCmd, aParam1);
-}
-
-bool
-GonkOmxPlatformLayer::LoadComponent(const ComponentInfo& aComponent)
-{
-  status_t err = mOmx->allocateNode(aComponent.mName, mOmxObserver, &mNode);
-  if (err == OK) {
-    mQuirks = aComponent.mQuirks;
-    LOG("Load OpenMax component %s, alloc input %d, alloc output %d, live locally %d",
-        aComponent.mName, mQuirks.test(kRequiresAllocateBufferOnInputPorts),
-        mQuirks.test(kRequiresAllocateBufferOnOutputPorts),
-        mOmx->livesLocally(mNode, getpid()));
-    return true;
-  }
-  return false;
-}
-
-layers::ImageContainer*
-GonkOmxPlatformLayer::GetImageContainer()
-{
-  return mImageContainer;
-}
-
-const TrackInfo*
-GonkOmxPlatformLayer::GetTrackInfo()
-{
-  return mInfo;
-}
-
-bool
-GonkOmxPlatformLayer::FindComponents(const nsACString& aMimeType,
-                                     nsTArray<ComponentInfo>* aComponents)
-{
-  static const MediaCodecList* codecs = MediaCodecList::getInstance();
-
-  bool useHardwareCodecOnly = false;
-
-  // H264 and H263 has different profiles, software codec doesn't support high profile.
-  // So we use hardware codec only.
-  if (!IsInEmulator() &&
-      (aMimeType.EqualsLiteral("video/avc") ||
-       aMimeType.EqualsLiteral("video/mp4") ||
-       aMimeType.EqualsLiteral("video/mp4v-es") ||
-       aMimeType.EqualsLiteral("video/3gp"))) {
-    useHardwareCodecOnly = true;
-  }
-
-  const char* mime = aMimeType.Data();
-  // Translate VP8 MIME type to Android format.
-  if (aMimeType.EqualsLiteral("video/webm; codecs=vp8")) {
-    mime = "video/x-vnd.on2.vp8";
-  }
-
-  size_t start = 0;
-  bool found = false;
-  while (true) {
-    ssize_t index = codecs->findCodecByType(mime, false /* encoder */, start);
-    if (index < 0) {
-      break;
-    }
-    start = index + 1;
-
-    const char* name = codecs->getCodecName(index);
-    if (IsSoftwareCodec(name) && useHardwareCodecOnly) {
-      continue;
-    }
-
-    found = true;
-
-    if (!aComponents) {
-      continue;
-    }
-    ComponentInfo* comp = aComponents->AppendElement();
-    comp->mName = name;
-    if (codecs->codecHasQuirk(index, "requires-allocate-on-input-ports")) {
-      comp->mQuirks.set(kRequiresAllocateBufferOnInputPorts);
-    }
-    if (codecs->codecHasQuirk(index, "requires-allocate-on-output-ports")) {
-      comp->mQuirks.set(kRequiresAllocateBufferOnOutputPorts);
-    }
-  }
-
-  return found;
-}
-
-OMX_VIDEO_CODINGTYPE
-GonkOmxPlatformLayer::CompressionFormat()
-{
-  MOZ_ASSERT(mInfo);
-
-  return mInfo->mMimeType.EqualsLiteral("video/webm; codecs=vp8") ?
-    ANDROID_OMX_VIDEO_CodingVP8 : OmxPlatformLayer::CompressionFormat();
-}
-
-} // mozilla
deleted file mode 100644
--- a/dom/media/platforms/omx/GonkOmxPlatformLayer.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-
-#if !defined(GonkOmxPlatformLayer_h_)
-#define GonkOmxPlatformLayer_h_
-
-#pragma GCC visibility push(default)
-
-#include <bitset>
-
-#include <utils/RefBase.h>
-#include <media/stagefright/OMXClient.h>
-#include "nsAutoPtr.h"
-
-#include "OMX_Component.h"
-
-#include "OmxPlatformLayer.h"
-
-class nsACString;
-
-namespace android {
-class IMemory;
-class MemoryDealer;
-}
-
-namespace mozilla {
-
-class GonkOmxObserver;
-class GonkOmxPlatformLayer;
-class GonkTextureClientRecycleHandler;
-
-/*
- * Due to Android's omx node could live in local process (client) or remote
- * process (mediaserver). And there are 3 kinds of buffer in Android OMX.
- *
- * 1.
- * When buffer is in local process, the IOMX::buffer_id is OMX_BUFFERHEADERTYPE
- * pointer actually, it is safe to use it directly.
- *
- * 2.
- * When buffer is in remote process, the OMX_BUFFERHEADERTYPE pointer is 'IN' the
- * remote process. It can't be used in local process, so here it allocates a
- * local OMX_BUFFERHEADERTYPE. The raw/decoded data is in the android shared
- * memory, IMemory.
- *
- * 3.
- * When buffer is in remote process for the display output port. It uses
- * GraphicBuffer to accelerate the decoding and display.
- *
- */
-class GonkBufferData : public OmxPromiseLayer::BufferData {
-protected:
-  virtual ~GonkBufferData() {}
-
-public:
-  GonkBufferData(bool aLiveInLocal,
-                 GonkOmxPlatformLayer* aLayer);
-
-  BufferID ID() override
-  {
-    return mId;
-  }
-
-  already_AddRefed<MediaData> GetPlatformMediaData() override;
-
-  bool IsLocalBuffer()
-  {
-    return !!mMirrorBuffer.get();
-  }
-
-  void ReleaseBuffer();
-
-  nsresult SetBufferId(android::IOMX::buffer_id aId)
-  {
-    mId = aId;
-    return NS_OK;
-  }
-
-  // The mBuffer is in local process. And aId is actually the OMX_BUFFERHEADERTYPE
-  // pointer. It doesn't need a mirror buffer.
-  nsresult InitLocalBuffer(android::IOMX::buffer_id aId);
-
-  // aMemory is an IPC based memory which will be used as the pBuffer in
-  // mBuffer. And the mBuffer will be the mirror OMX_BUFFERHEADERTYPE
-  // of the one in the remote process.
-  nsresult InitSharedMemory(android::IMemory* aMemory);
-
-  // GraphicBuffer is for video decoding acceleration on output port.
-  // Then mBuffer is the mirror OMX_BUFFERHEADERTYPE of the one in the remote
-  // process.
-  nsresult InitGraphicBuffer(OMX_VIDEO_PORTDEFINITIONTYPE& aDef);
-
-  // Android OMX uses this id to pass the buffer between OMX component and
-  // client.
-  android::IOMX::buffer_id mId;
-
-  // mMirrorBuffer are used only when the omx node is in mediaserver.
-  // Due to IPC problem, the mId is the OMX_BUFFERHEADERTYPE address in mediaserver.
-  // It can't mapping to client process, so we need a local OMX_BUFFERHEADERTYPE
-  // here to mirror the remote OMX_BUFFERHEADERTYPE in mediaserver.
-  nsAutoPtr<OMX_BUFFERHEADERTYPE> mMirrorBuffer;
-
-  // It creates GraphicBuffer and manages TextureClient.
-  RefPtr<GonkTextureClientRecycleHandler> mTextureClientRecycleHandler;
-
-  GonkOmxPlatformLayer* mGonkPlatformLayer;
-};
-
-class GonkOmxPlatformLayer : public OmxPlatformLayer {
-public:
-  enum {
-    kRequiresAllocateBufferOnInputPorts = 0,
-    kRequiresAllocateBufferOnOutputPorts,
-    QUIRKS,
-  };
-  typedef std::bitset<QUIRKS> Quirks;
-
-  struct ComponentInfo {
-    const char* mName;
-    Quirks mQuirks;
-  };
-
-  GonkOmxPlatformLayer(OmxDataDecoder* aDataDecoder,
-                       OmxPromiseLayer* aPromiseLayer,
-                       TaskQueue* aTaskQueue,
-                       layers::ImageContainer* aImageContainer);
-
-  nsresult AllocateOmxBuffer(OMX_DIRTYPE aType, BUFFERLIST* aBufferList) override;
-
-  nsresult ReleaseOmxBuffer(OMX_DIRTYPE aType, BUFFERLIST* aBufferList) override;
-
-  OMX_ERRORTYPE GetState(OMX_STATETYPE* aType) override;
-
-  OMX_ERRORTYPE GetParameter(OMX_INDEXTYPE aParamIndex,
-                             OMX_PTR aComponentParameterStructure,
-                             OMX_U32 aComponentParameterSize) override;
-
-  OMX_ERRORTYPE SetParameter(OMX_INDEXTYPE nIndex,
-                             OMX_PTR aComponentParameterStructure,
-                             OMX_U32 aComponentParameterSize) override;
-
-  OMX_ERRORTYPE InitOmxToStateLoaded(const TrackInfo* aInfo) override;
-
-  OMX_ERRORTYPE EmptyThisBuffer(BufferData* aData) override;
-
-  OMX_ERRORTYPE FillThisBuffer(BufferData* aData) override;
-
-  OMX_ERRORTYPE SendCommand(OMX_COMMANDTYPE aCmd,
-                            OMX_U32 aParam1,
-                            OMX_PTR aCmdData) override;
-
-  nsresult Shutdown() override;
-
-  static bool FindComponents(const nsACString& aMimeType,
-                             nsTArray<ComponentInfo>* aComponents = nullptr);
-
-  // Android/QCOM decoder uses its own OMX_VIDEO_CodingVP8 definition in
-  // frameworks/native/media/include/openmax/OMX_Video.h, not the one defined
-  // in OpenMAX v1.1.2 OMX_VideoExt.h
-  OMX_VIDEO_CODINGTYPE CompressionFormat() override;
-
-protected:
-  friend GonkBufferData;
-
-  layers::ImageContainer* GetImageContainer();
-
-  const TrackInfo* GetTrackInfo();
-
-  TaskQueue* GetTaskQueue()
-  {
-    return mTaskQueue;
-  }
-
-  nsresult EnableOmxGraphicBufferPort(OMX_PARAM_PORTDEFINITIONTYPE& aDef);
-
-  bool LoadComponent(const ComponentInfo& aComponent);
-
-  friend class GonkOmxObserver;
-
-  RefPtr<TaskQueue> mTaskQueue;
-
-  RefPtr<layers::ImageContainer> mImageContainer;
-
-  // OMX_DirInput is 0, OMX_DirOutput is 1.
-  android::sp<android::MemoryDealer> mMemoryDealer[2];
-
-  android::sp<GonkOmxObserver> mOmxObserver;
-
-  android::sp<android::IOMX> mOmx;
-
-  android::IOMX::node_id mNode;
-
-  android::OMXClient mOmxClient;
-
-  Quirks mQuirks;
-};
-
-}
-
-#pragma GCC visibility pop
-
-#endif // GonkOmxPlatformLayer_h_
deleted file mode 100644
--- a/dom/network/EthernetManager.js
+++ /dev/null
@@ -1,655 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
-/* 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";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const TOPIC_INTERFACE_STATE_CHANGED = "network-interface-state-changed";
-
-const ETHERNET_NETWORK_IFACE_PREFIX = "eth";
-const DEFAULT_ETHERNET_NETWORK_IFACE = "eth0";
-
-const INTERFACE_IPADDR_NULL = "0.0.0.0";
-const INTERFACE_GATEWAY_NULL = "0.0.0.0";
-const INTERFACE_PREFIX_NULL = 0;
-const INTERFACE_MACADDR_NULL = "00:00:00:00:00:00";
-
-const NETWORK_INTERFACE_UP   = "up";
-const NETWORK_INTERFACE_DOWN = "down";
-
-const IP_MODE_DHCP = "dhcp";
-const IP_MODE_STATIC = "static";
-
-const PREF_NETWORK_DEBUG_ENABLED = "network.debugging.enabled";
-
-XPCOMUtils.defineLazyServiceGetter(this, "gNetworkManager",
-                                   "@mozilla.org/network/manager;1",
-                                   "nsINetworkManager");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gNetworkService",
-                                   "@mozilla.org/network/service;1",
-                                   "nsINetworkService");
-
-let debug;
-function updateDebug() {
-  let debugPref = false; // set default value here.
-  try {
-    debugPref = debugPref || Services.prefs.getBoolPref(PREF_NETWORK_DEBUG_ENABLED);
-  } catch (e) {}
-
-  if (debugPref) {
-    debug = function(s) {
-      dump("-*- EthernetManager: " + s + "\n");
-    };
-  } else {
-    debug = function(s) {};
-  }
-}
-updateDebug();
-
-// nsINetworkInterface
-
-function EthernetInterface(attr) {
-  this.info.state = attr.state;
-  this.info.type = attr.type;
-  this.info.name = attr.name;
-  this.info.ipMode = attr.ipMode;
-  this.info.ips = [attr.ip];
-  this.info.prefixLengths = [attr.prefixLength];
-  this.info.gateways = [attr.gateway];
-  this.info.dnses = attr.dnses;
-  this.httpProxyHost = "";
-  this.httpProxyPort = 0;
-}
-EthernetInterface.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
-
-  updateConfig: function(config) {
-    debug("Interface " + this.info.name + " updateConfig " + JSON.stringify(config));
-    this.info.state = (config.state != undefined) ?
-                  config.state : this.info.state;
-    this.info.ips = (config.ip != undefined) ? [config.ip] : this.info.ips;
-    this.info.prefixLengths = (config.prefixLength != undefined) ?
-                         [config.prefixLength] : this.info.prefixLengths;
-    this.info.gateways = (config.gateway != undefined) ?
-                    [config.gateway] : this.info.gateways;
-    this.info.dnses = (config.dnses != undefined) ? config.dnses : this.info.dnses;
-    this.httpProxyHost = (config.httpProxyHost != undefined) ?
-                          config.httpProxyHost : this.httpProxyHost;
-    this.httpProxyPort = (config.httpProxyPort != undefined) ?
-                          config.httpProxyPort : this.httpProxyPort;
-    this.info.ipMode = (config.ipMode != undefined) ?
-                   config.ipMode : this.info.ipMode;
-  },
-
-  info: {
-    getAddresses: function(ips, prefixLengths) {
-      ips.value = this.ips.slice();
-      prefixLengths.value = this.prefixLengths.slice();
-
-      return this.ips.length;
-    },
-
-    getGateways: function(count) {
-      if (count) {
-        count.value = this.gateways.length;
-      }
-      return this.gateways.slice();
-    },
-
-    getDnses: function(count) {
-      if (count) {
-        count.value = this.dnses.length;
-      }
-      return this.dnses.slice();
-    }
-  }
-};
-
-// nsIEthernetManager
-
-/*
- *  Network state transition diagram
- *
- *   ----------  enable  ---------  connect   -----------   disconnect   --------------
- *  | Disabled | -----> | Enabled | -------> | Connected | <----------> | Disconnected |
- *   ----------          ---------            -----------    connect     --------------
- *       ^                  |                      |                           |
- *       |     disable      |                      |                           |
- *       -----------------------------------------------------------------------
- */
-
-function EthernetManager() {
-  debug("EthernetManager start");
-
-  // Interface list.
-  this.ethernetInterfaces = {};
-
-  // Used to memorize last connection information.
-  this.lastStaticConfig = {};
-
-  Services.obs.addObserver(this, "xpcom-shutdown");
-}
-
-EthernetManager.prototype = {
-  classID: Components.ID("a96441dd-36b3-4f7f-963b-2c032e28a039"),
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIEthernetManager]),
-
-  ethernetInterfaces: null,
-  lastStaticConfig: null,
-
-  observer: function(subject, topic, data) {
-    switch (topic) {
-      case "xpcom-shutdown":
-        debug("xpcom-shutdown");
-
-        this._shutdown();
-
-        Services.obs.removeObserver(this, "xpcom-shutdown");
-        break;
-    }
-  },
-
-  _shutdown: function() {
-    debug("Shuting down");
-    (function onRemove(ifnameList) {
-      if (!ifnameList.length) {
-        return;
-      }
-
-      let ifname = ifnameList.shift();
-      this.removeInterface(ifname, { notify: onRemove.bind(this, ifnameList) });
-    }).call(this, Object.keys(this.ethernetInterfaces));
-  },
-
-  get interfaceList() {
-    return Object.keys(this.ethernetInterfaces);
-  },
-
-  scan: function(callback) {
-    debug("Scan");
-
-    gNetworkService.getInterfaces(function(success, list) {
-      let ethList = [];
-
-      if (!success) {
-        if (callback) {
-          callback.notify(ethList);
-        }
-        return;
-      }
-
-      for (let i = 0; i < list.length; i++) {
-        debug("Found interface " + list[i]);
-        if (!list[i].startsWith(ETHERNET_NETWORK_IFACE_PREFIX)) {
-          continue;
-        }
-        ethList.push(list[i]);
-      }
-
-      if (callback) {
-        callback.notify(ethList);
-      }
-    });
-  },
-
-  addInterface: function(ifname, callback) {
-    debug("Add interface " + ifname);
-
-    if (!ifname || !ifname.startsWith(ETHERNET_NETWORK_IFACE_PREFIX)) {
-      if (callback) {
-        callback.notify(false, "Invalid interface.");
-      }
-      return;
-    }
-
-    if (this.ethernetInterfaces[ifname]) {
-      if (callback) {
-        callback.notify(true, "Interface already exists.");
-      }
-      return;
-    }
-
-    gNetworkService.getInterfaceConfig(ifname, function(success, result) {
-      if (!success) {
-        if (callback) {
-          callback.notify(false, "Netd error.");
-        }
-        return;
-      }
-
-      // Since the operation may still succeed with an invalid interface name,
-      // check the mac address as well.
-      if (result.macAddr == INTERFACE_MACADDR_NULL) {
-        if (callback) {
-          callback.notify(false, "Interface not found.");
-        }
-        return;
-      }
-
-      this.ethernetInterfaces[ifname] = new EthernetInterface({
-        state:        result.link == NETWORK_INTERFACE_UP ?
-                        Ci.nsINetworkInfo.NETWORK_STATE_DISABLED :
-                        Ci.nsINetworkInfo.NETWORK_STATE_ENABLED,
-        name:         ifname,
-        type:         Ci.nsINetworkInfo.NETWORK_TYPE_ETHERNET,
-        ip:           result.ip,
-        prefixLength: result.prefix,
-        ipMode:       IP_MODE_DHCP
-      });
-
-      // Register the interface to NetworkManager.
-      gNetworkManager.registerNetworkInterface(this.ethernetInterfaces[ifname]);
-
-      debug("Add interface " + ifname + " succeeded with " +
-            JSON.stringify(this.ethernetInterfaces[ifname]));
-
-      if (callback) {
-        callback.notify(true, "ok");
-      }
-    }.bind(this));
-  },
-
-  removeInterface: function(ifname, callback) {
-    debug("Remove interface " + ifname);
-
-    if (!ifname || !ifname.startsWith(ETHERNET_NETWORK_IFACE_PREFIX)) {
-      if (callback) {
-        callback.notify(false, "Invalid interface.");
-      }
-      return;
-    }
-
-    if (!this.ethernetInterfaces[ifname]) {
-      if (callback) {
-        callback.notify(true, "Interface does not exist.");
-      }
-      return;
-    }
-
-    // Make sure interface is disable before removing.
-    this.disable(ifname, { notify: function(success, message) {
-      // Unregister the interface from NetworkManager and also remove it from
-      // the interface list.
-      gNetworkManager.unregisterNetworkInterface(this.ethernetInterfaces[ifname]);
-      delete this.ethernetInterfaces[ifname];
-
-      debug("Remove interface " + ifname + " succeeded.");
-
-      if (callback) {
-        callback.notify(true, "ok");
-      }
-    }.bind(this)});
-  },
-
-  updateInterfaceConfig: function(ifname, config, callback) {
-    debug("Update interface config with " + ifname);
-
-    this._ensureIfname(ifname, callback, function(iface) {
-      if (!config) {
-        if (callback) {
-          callback.notify(false, "No config to update.");
-        }
-        return;
-      }
-
-      // Network state can not be modified externally.
-      if (config.state) {
-        delete config.state;
-      }
-
-      let currentIpMode = iface.info.ipMode;
-
-      // Update config.
-      this.ethernetInterfaces[iface.info.name].updateConfig(config);
-
-      // Do not automatically re-connect if the interface is not in connected
-      // state.
-      if (iface.info.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
-        if (callback) {
-          callback.notify(true, "ok");
-        }
-        return;
-      }
-
-      let newIpMode = this.ethernetInterfaces[iface.info.name].info.ipMode;
-
-      if (newIpMode == IP_MODE_STATIC) {
-        this._setStaticIP(iface.info.name, callback);
-        return;
-      }
-      if ((currentIpMode == IP_MODE_STATIC) && (newIpMode == IP_MODE_DHCP)) {
-        gNetworkService.stopDhcp(iface.info.name, function(success) {
-          if (success) {
-            debug("DHCP for " + iface.info.name + " stopped.");
-          }
-        });
-
-        // Clear the current network settings before do dhcp request, otherwise
-        // dhcp settings could fail.
-        this.disconnect(iface.info.name, { notify: function(success, message) {
-          if (!success) {
-            if (callback) {
-              callback.notify("Disconnect failed.");
-            }
-            return;
-          }
-          this._runDhcp(iface.info.name, callback);
-        }.bind(this) });
-        return;
-      }
-
-      if (callback) {
-        callback.notify(true, "ok");
-      }
-    }.bind(this));
-  },
-
-  enable: function(ifname, callback) {
-    debug("Enable interface " + ifname);
-
-    this._ensureIfname(ifname, callback, function(iface) {
-      // Interface can be only enabled in the state of disabled.
-      if (iface.info.state != Ci.nsINetworkInfo.NETWORK_STATE_DISABLED) {
-        if (callback) {
-          callback.notify(true, "Interface already enabled.");
-        }
-        return;
-      }
-
-      let ips = {};
-      let prefixLengths = {};
-      iface.info.getAddresses(ips, prefixLengths);
-      let config = { ifname: iface.info.name,
-                     ip:     ips.value[0],
-                     prefix: prefixLengths.value[0],
-                     link:   NETWORK_INTERFACE_UP };
-      gNetworkService.setInterfaceConfig(config, function(success) {
-        if (!success) {
-          if (callback) {
-            callback.notify(false, "Netd Error.");
-          }
-          return;
-        }
-
-        this.ethernetInterfaces[iface.info.name].updateConfig({
-          state: Ci.nsINetworkInfo.NETWORK_STATE_ENABLED
-        });
-
-        debug("Enable interface " + iface.info.name + " succeeded.");
-
-        if (callback) {
-          callback.notify(true, "ok");
-        }
-      }.bind(this));
-    }.bind(this));
-  },
-
-  disable: function(ifname, callback) {
-    debug("Disable interface " + ifname);
-
-    this._ensureIfname(ifname, callback, function(iface) {
-      if (iface.info.state == Ci.nsINetworkInfo.NETWORK_STATE_DISABLED) {
-        if (callback) {
-          callback.notify(true, "Interface already disabled.");
-        }
-        return;
-      }
-
-      if (iface.info.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
-        gNetworkService.stopDhcp(iface.info.name, function(success) {
-          if (success) {
-            debug("DHCP for " + iface.info.name + " stopped.");
-          }
-        });
-      }
-
-      let ips = {};
-      let prefixLengths = {};
-      iface.info.getAddresses(ips, prefixLengths);
-      let config = { ifname: iface.info.name,
-                     ip:     ips.value[0],
-                     prefix: prefixLengths.value[0],
-                     link:   NETWORK_INTERFACE_DOWN };
-      gNetworkService.setInterfaceConfig(config, function(success) {
-        if (!success) {
-          if (callback) {
-            callback.notify(false, "Netd Error.");
-          }
-          return;
-        }
-
-        this.ethernetInterfaces[iface.info.name].updateConfig({
-          state: Ci.nsINetworkInfo.NETWORK_STATE_DISABLED
-        });
-
-        debug("Disable interface " + iface.info.name + " succeeded.");
-
-        if (callback) {
-          callback.notify(true, "ok");
-        }
-      }.bind(this));
-    }.bind(this));
-  },
-
-  connect: function(ifname, callback) {
-    debug("Connect interface " + ifname);
-
-    this._ensureIfname(ifname, callback, function(iface) {
-      // Interface can only be connected in the state of enabled or
-      // disconnected.
-      if (iface.info.state == Ci.nsINetworkInfo.NETWORK_STATE_DISABLED ||
-          iface.info.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
-        if (callback) {
-          callback.notify(true, "Interface " + ifname + " is not available or "
-                                 + " already connected.");
-        }
-        return;
-      }
-
-      if (iface.info.ipMode == IP_MODE_DHCP) {
-        this._runDhcp(iface.info.name, callback);
-        return;
-      }
-
-      if (iface.info.ipMode == IP_MODE_STATIC) {
-        if (this._checkConfigNull(iface) && this.lastStaticConfig[iface.info.name]) {
-          debug("Connect with lastStaticConfig " +
-                JSON.stringify(this.lastStaticConfig[iface.info.name]));
-          this.ethernetInterfaces[iface.info.name].updateConfig(
-            this.lastStaticConfig[iface.info.name]);
-        }
-        this._setStaticIP(iface.info.name, callback);
-        return;
-      }
-
-      if (callback) {
-        callback.notify(false, "IP mode is wrong or not set.");
-      }
-    }.bind(this));
-  },
-
-  disconnect: function(ifname, callback) {
-    debug("Disconnect interface " + ifname);
-
-    this._ensureIfname(ifname, callback, function(iface) {
-      // Interface can be only disconnected in the state of connected.
-      if (iface.info.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
-        if (callback) {
-          callback.notify(true, "Interface is already disconnected");
-        }
-        return;
-      }
-
-      let config = { ifname: iface.info.name,
-                     ip:     INTERFACE_IPADDR_NULL,
-                     prefix: INTERFACE_PREFIX_NULL,
-                     link:   NETWORK_INTERFACE_UP };
-      gNetworkService.setInterfaceConfig(config, function(success) {
-        if (!success) {
-          if (callback) {
-            callback.notify(false, "Netd error.");
-          }
-          return;
-        }
-
-        // Stop dhcp daemon.
-        gNetworkService.stopDhcp(iface.info.name, function(success) {
-          if (success) {
-            debug("DHCP for " + iface.info.name + " stopped.");
-          }
-        });
-
-        this.ethernetInterfaces[iface.info.name].updateConfig({
-          state:        Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED,
-          ip:           INTERFACE_IPADDR_NULL,
-          prefixLength: INTERFACE_PREFIX_NULL,
-          gateway:      INTERFACE_GATEWAY_NULL
-        });
-
-        gNetworkManager.updateNetworkInterface(this.ethernetInterfaces[ifname]);
-
-        debug("Disconnect interface " + iface.info.name + " succeeded.");
-
-        if (callback) {
-          callback.notify(true, "ok");
-        }
-      }.bind(this));
-    }.bind(this));
-  },
-
-  _checkConfigNull: function(iface) {
-    let ips = {};
-    let prefixLengths = {};
-    let gateways = iface.info.getGateways();
-    iface.info.getAddresses(ips, prefixLengths);
-
-    if (ips.value[0] == INTERFACE_IPADDR_NULL &&
-        prefixLengths.value[0] == INTERFACE_PREFIX_NULL &&
-        gateways[0] == INTERFACE_GATEWAY_NULL) {
-      return true;
-    }
-
-    return false;
-  },
-
-  _ensureIfname: function(ifname, callback, func) {
-    // If no given ifname, use the default one.
-    if (!ifname) {
-      ifname = DEFAULT_ETHERNET_NETWORK_IFACE;
-    }
-
-    let iface = this.ethernetInterfaces[ifname];
-    if (!iface) {
-      if (callback) {
-        callback.notify(true, "Interface " + ifname + " is not available.");
-      }
-      return;
-    }
-
-    func.call(this, iface);
-  },
-
-  _runDhcp: function(ifname, callback) {
-    debug("runDhcp with " + ifname);
-
-    if (!this.ethernetInterfaces[ifname]) {
-      if (callback) {
-        callback.notify(false, "Invalid interface.");
-      }
-      return;
-    }
-
-    gNetworkService.dhcpRequest(ifname, function(success, result) {
-      if (!success) {
-        if (callback) {
-          callback.notify(false, "DHCP failed.");
-        }
-        return;
-      }
-
-      debug("DHCP succeeded with " + JSON.stringify(result));
-
-      // Clear last static network information when connecting with dhcp mode.
-      if (this.lastStaticConfig[ifname]) {
-        this.lastStaticConfig[ifname] = null;
-      }
-
-      this.ethernetInterfaces[ifname].updateConfig({
-        state:        Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED,
-        ip:           result.ipaddr_str,
-        gateway:      result.gateway_str,
-        prefixLength: result.prefixLength,
-        dnses:        [result.dns1_str, result.dns2_str]
-      });
-
-      gNetworkManager.updateNetworkInterface(this.ethernetInterfaces[ifname]);
-
-      debug("Connect interface " + ifname + " with DHCP succeeded.");
-
-      if (callback) {
-        callback.notify(true, "ok");
-      }
-    }.bind(this));
-  },
-
-  _setStaticIP: function(ifname, callback) {
-    let iface = this.ethernetInterfaces[ifname];
-    if (!iface) {
-      if (callback) {
-        callback.notify(false, "Invalid interface.");
-      }
-      return;
-    }
-
-    let ips = {};
-    let prefixLengths = {};
-    iface.info.getAddresses(ips, prefixLengths);
-
-    let config = { ifname: iface.info.name,
-                   ip:     ips.value[0],
-                   prefix: prefixLengths.value[0],
-                   link:   NETWORK_INTERFACE_UP };
-    gNetworkService.setInterfaceConfig(config, function(success) {
-      if (!success) {
-        if (callback) {
-          callback.notify(false, "Netd Error.");
-        }
-        return;
-      }
-
-      // Keep the lastest static network information.
-      let ips = {};
-      let prefixLengths = {};
-      let gateways = iface.info.getGateways();
-      iface.info.getAddresses(ips, prefixLengths);
-
-      this.lastStaticConfig[iface.info.name] = {
-        ip:           ips.value[0],
-        prefixLength: prefixLengths.value[0],
-        gateway:      gateways[0]
-      };
-
-      this.ethernetInterfaces[ifname].updateConfig({
-        state: Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED,
-      });
-
-      gNetworkManager.updateNetworkInterface(this.ethernetInterfaces[ifname]);
-
-      debug("Connect interface " + ifname + " with static ip succeeded.");
-
-      if (callback) {
-        callback.notify(true, "ok");
-      }
-    }.bind(this));
-  },
-}
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EthernetManager]);
deleted file mode 100644
--- a/dom/network/EthernetManager.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {a96441dd-36b3-4f7f-963b-2c032e28a039} EthernetManager.js
-contract @mozilla.org/ethernetManager;1 {a96441dd-36b3-4f7f-963b-2c032e28a039}
deleted file mode 100644
--- a/dom/network/NetUtils.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "NetUtils.h"
-#include <dlfcn.h>
-#include <errno.h>
-#include "prinit.h"
-#include "mozilla/Assertions.h"
-#include "nsDebug.h"
-#include "SystemProperty.h"
-
-using mozilla::system::Property;
-
-static void* sNetUtilsLib;
-static PRCallOnceType sInitNetUtilsLib;
-
-static PRStatus
-InitNetUtilsLib()
-{
-  sNetUtilsLib = dlopen("/system/lib/libnetutils.so", RTLD_LAZY);
-  // We might fail to open the hardware lib. That's OK.
-  return PR_SUCCESS;
-}
-
-static void*
-GetNetUtilsLibHandle()
-{
-  PR_CallOnce(&sInitNetUtilsLib, InitNetUtilsLib);
-  return sNetUtilsLib;
-}
-
-// static
-void*
-NetUtils::GetSharedLibrary()
-{
-  void* netLib = GetNetUtilsLibHandle();
-  if (!netLib) {
-    NS_WARNING("No /system/lib/libnetutils.so");
-  }
-  return netLib;
-}
-
-// static
-int32_t
-NetUtils::SdkVersion()
-{
-  char propVersion[Property::VALUE_MAX_LENGTH];
-  Property::Get("ro.build.version.sdk", propVersion, "0");
-  int32_t version = strtol(propVersion, nullptr, 10);
-  return version;
-}
-
-DEFINE_DLFUNC(ifc_enable, int32_t, const char*)
-DEFINE_DLFUNC(ifc_disable, int32_t, const char*)
-DEFINE_DLFUNC(ifc_configure, int32_t, const char*, in_addr_t, uint32_t,
-              in_addr_t, in_addr_t, in_addr_t)
-DEFINE_DLFUNC(ifc_reset_connections, int32_t, const char*, const int32_t)
-DEFINE_DLFUNC(ifc_set_default_route, int32_t, const char*, in_addr_t)
-DEFINE_DLFUNC(ifc_add_route, int32_t, const char*, const char*, uint32_t, const char*)
-DEFINE_DLFUNC(ifc_remove_route, int32_t, const char*, const char*, uint32_t, const char*)
-DEFINE_DLFUNC(ifc_remove_host_routes, int32_t, const char*)
-DEFINE_DLFUNC(ifc_remove_default_route, int32_t, const char*)
-DEFINE_DLFUNC(dhcp_stop, int32_t, const char*)
-
-NetUtils::NetUtils()
-{
-}
-
-int32_t NetUtils::do_ifc_enable(const char *ifname)
-{
-  USE_DLFUNC(ifc_enable)
-  return ifc_enable(ifname);
-}
-
-int32_t NetUtils::do_ifc_disable(const char *ifname)
-{
-  USE_DLFUNC(ifc_disable)
-  return ifc_disable(ifname);
-}
-
-int32_t NetUtils::do_ifc_configure(const char *ifname,
-                                       in_addr_t address,
-                                       uint32_t prefixLength,
-                                       in_addr_t gateway,
-                                       in_addr_t dns1,
-                                       in_addr_t dns2)
-{
-  USE_DLFUNC(ifc_configure)
-  int32_t ret = ifc_configure(ifname, address, prefixLength, gateway, dns1, dns2);
-  return ret;
-}
-
-int32_t NetUtils::do_ifc_reset_connections(const char *ifname,
-                                               const int32_t resetMask)
-{
-  USE_DLFUNC(ifc_reset_connections)
-  return ifc_reset_connections(ifname, resetMask);
-}
-
-int32_t NetUtils::do_ifc_set_default_route(const char *ifname,
-                                           in_addr_t gateway)
-{
-  USE_DLFUNC(ifc_set_default_route)
-  return ifc_set_default_route(ifname, gateway);
-}
-
-int32_t NetUtils::do_ifc_add_route(const char *ifname,
-                                   const char *dst,
-                                   uint32_t prefixLength,
-                                   const char *gateway)
-{
-  USE_DLFUNC(ifc_add_route)
-  return ifc_add_route(ifname, dst, prefixLength, gateway);
-}
-
-int32_t NetUtils::do_ifc_remove_route(const char *ifname,
-                                      const char *dst,
-                                      uint32_t prefixLength,
-                                      const char *gateway)
-{
-  USE_DLFUNC(ifc_remove_route)
-  return ifc_remove_route(ifname, dst, prefixLength, gateway);
-}
-
-int32_t NetUtils::do_ifc_remove_host_routes(const char *ifname)
-{
-  USE_DLFUNC(ifc_remove_host_routes)
-  return ifc_remove_host_routes(ifname);
-}
-
-int32_t NetUtils::do_ifc_remove_default_route(const char *ifname)
-{
-  USE_DLFUNC(ifc_remove_default_route)
-  return ifc_remove_default_route(ifname);
-}
-
-int32_t NetUtils::do_dhcp_stop(const char *ifname)
-{
-  USE_DLFUNC(dhcp_stop)
-  return dhcp_stop(ifname);
-}
-
-int32_t NetUtils::do_dhcp_do_request(const char *ifname,
-                                         char *ipaddr,
-                                         char *gateway,
-                                         uint32_t *prefixLength,
-                                         char *dns1,
-                                         char *dns2,
-                                         char *server,
-                                         uint32_t  *lease,
-                                         char* vendorinfo)
-{
-  int32_t ret = -1;
-  uint32_t sdkVersion = SdkVersion();
-
-  if (sdkVersion == 15) {
-    // ICS
-    // http://androidxref.com/4.0.4/xref/system/core/libnetutils/dhcp_utils.c#149
-    DEFINE_DLFUNC(dhcp_do_request, int32_t, const char*, char*, char*,  uint32_t*, char*, char*, char*, uint32_t*)
-    USE_DLFUNC(dhcp_do_request)
-    vendorinfo[0] = '\0';
-
-    ret = dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns1, dns2,
-                          server, lease);
-  } else if (sdkVersion == 16 || sdkVersion == 17) {
-    // JB 4.1 and 4.2
-    // http://androidxref.com/4.1.2/xref/system/core/libnetutils/dhcp_utils.c#175
-    // http://androidxref.com/4.2.2_r1/xref/system/core/include/netutils/dhcp.h#26
-    DEFINE_DLFUNC(dhcp_do_request, int32_t, const char*, char*, char*,  uint32_t*, char*, char*, char*, uint32_t*, char*)
-    USE_DLFUNC(dhcp_do_request)
-    ret = dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns1, dns2,
-                          server, lease, vendorinfo);
-  } else if (sdkVersion == 18) {
-    // JB 4.3
-    // http://androidxref.com/4.3_r2.1/xref/system/core/libnetutils/dhcp_utils.c#181
-    DEFINE_DLFUNC(dhcp_do_request, int32_t, const char*, char*, char*,  uint32_t*, char**, char*, uint32_t*, char*, char*)
-    USE_DLFUNC(dhcp_do_request)
-    char *dns[3] = {dns1, dns2, nullptr};
-    char domains[Property::VALUE_MAX_LENGTH];
-    ret = dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns,
-                          server, lease, vendorinfo, domains);
-  } else if (sdkVersion >= 19) {
-    // KitKat 4.4.X
-    // http://androidxref.com/4.4_r1/xref/system/core/libnetutils/dhcp_utils.c#18
-    // Lollipop 5.0
-    //http://androidxref.com/5.0.0_r2/xref/system/core/libnetutils/dhcp_utils.c#186
-    DEFINE_DLFUNC(dhcp_do_request, int32_t, const char*, char*, char*,  uint32_t*, char**, char*, uint32_t*, char*, char*, char*)
-    USE_DLFUNC(dhcp_do_request)
-    char *dns[3] = {dns1, dns2, nullptr};
-    char domains[Property::VALUE_MAX_LENGTH];
-    char mtu[Property::VALUE_MAX_LENGTH];
-    ret = dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns, server, lease, vendorinfo, domains, mtu);
-  } else {
-    NS_WARNING("Unable to perform do_dhcp_request: unsupported sdk version!");
-  }
-  return ret;
-}
deleted file mode 100644
--- a/dom/network/NetUtils.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-/**
- * Abstraction on top of the network support from libnetutils that we
- * use to set up network connections.
- */
-
-#ifndef NetUtils_h
-#define NetUtils_h
-
-#include "arpa/inet.h"
-
-// Copied from ifc.h
-#define RESET_IPV4_ADDRESSES 0x01
-#define RESET_IPV6_ADDRESSES 0x02
-#define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
-
-// Implements netutils functions. No need for an abstract class here since we
-// only have a one sdk specific method (dhcp_do_request)
-class NetUtils
-{
-public:
-  static void* GetSharedLibrary();
-
-  NetUtils();
-
-  int32_t do_ifc_enable(const char *ifname);
-  int32_t do_ifc_disable(const char *ifname);
-  int32_t do_ifc_configure(const char *ifname,
-                           in_addr_t address,
-                           uint32_t prefixLength,
-                           in_addr_t gateway,
-                           in_addr_t dns1,
-                           in_addr_t dns2);
-  int32_t do_ifc_reset_connections(const char *ifname, const int32_t resetMask);
-  int32_t do_ifc_set_default_route(const char *ifname, in_addr_t gateway);
-  int32_t do_ifc_add_route(const char *ifname,
-                           const char *dst,
-                           uint32_t prefixLength,
-                           const char *gateway);
-  int32_t do_ifc_remove_route(const char *ifname,
-                              const char *dst,
-                              uint32_t prefixLength,
-                              const char *gateway);
-  int32_t do_ifc_remove_host_routes(const char *ifname);
-  int32_t do_ifc_remove_default_route(const char *ifname);
-  int32_t do_dhcp_stop(const char *ifname);
-  int32_t do_dhcp_do_request(const char *ifname,
-                             char *ipaddr,
-                             char *gateway,
-                             uint32_t *prefixLength,
-                             char *dns1,
-                             char *dns2,
-                             char *server,
-                             uint32_t  *lease,
-                             char* vendorinfo);
-
-  static int32_t SdkVersion();
-};
-
-// Defines a function type with the right arguments and return type.
-#define DEFINE_DLFUNC(name, ret, args...) typedef ret (*FUNC##name)(args);
-
-// Set up a dlsymed function ready to use.
-#define USE_DLFUNC(name)                                                      \
-  FUNC##name name = (FUNC##name) dlsym(GetSharedLibrary(), #name);            \
-  if (!name) {                                                                \
-    MOZ_CRASH("Symbol not found in shared library : " #name);                 \
-  }
-
-#endif // NetUtils_h
deleted file mode 100644
--- a/dom/network/interfaces/nsIEthernetManager.idl
+++ /dev/null
@@ -1,137 +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"
-
-[scriptable, function, uuid(2a3ad56c-edc0-439f-8aae-900b331ddf49)]
-interface nsIEthernetManagerCallback : nsISupports
-{
-  /**
-   * Callback function used to report the success of different operations.
-   *
-   * @param success
-   *        Boolean value indicates the success of an operation.
-   * @prarm message
-   *        Message reported in the end of operation.
-   */
-  void notify(in boolean success, in DOMString message);
-};
-
-[scriptable, function, uuid(1746e7dd-92d4-43fa-8ef4-bc13d0b60353)]
-interface nsIEthernetManagerScanCallback : nsISupports
-{
-  /**
-   * Callback function used to report the result of scan function.
-   *
-   * @param list
-   *        List of available ethernet interfaces.
-   */
-  void notify(in jsval list);
-};
-
-/**
- * An internal idl provides control to ethernet interfaces.
- */
-[scriptable, uuid(81750c87-bb3b-4724-b955-834eafa53fd1)]
-interface nsIEthernetManager : nsISupports
-{
-  /**
-   * List of exisiting interface name.
-   */
-  readonly attribute jsval interfaceList;
-
-  /**
-   * Scan available ethernet interfaces on device.
-   *
-   * @param callback
-   *        Callback function.
-   */
-  void scan(in nsIEthernetManagerScanCallback callback);
-
-  /**
-   * Add a new interface to the interface list.
-   *
-   * @param ifname
-   *        Interface name. Should be the form of "eth*".
-   * @param callback
-   *        Callback function.
-   */
-  void addInterface(in DOMString ifname,
-                    in nsIEthernetManagerCallback callback);
-
-  /**
-   * Remove an existing interface from the interface list.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param Callback
-   *        Callback function.
-   */
-  void removeInterface(in DOMString ifname,
-                       in nsIEthernetManagerCallback callback);
-
-  /**
-   * Update a conifg of an existing interface in the interface list.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param config
-   *        .ip: IP address.
-   *        .prefixLength: Mask length.
-   *        .gateway: Gateway.
-   *        .dnses: DNS addresses.
-   *        .httpProxyHost: HTTP proxy host.
-   *        .httpProxyPort: HTTP proxy port.
-   *        .ipMode: IP mode, can be 'dhcp' or 'static'.
-   * @param callback
-   *        Callback function.
-   */
-  void updateInterfaceConfig(in DOMString ifname,
-                             in jsval config,
-                             in nsIEthernetManagerCallback callback);
-
-  /**
-   * Enable networking of an existing interface in the interface list.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param callback
-   *        Callback function.
-   */
-  void enable(in DOMString ifname,
-              in nsIEthernetManagerCallback callback);
-
-  /**
-   * Disable networking of an existing interface in the interface list.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param callback
-   *        Callback function.
-   */
-  void disable(in DOMString ifname,
-               in nsIEthernetManagerCallback callback);
-
-  /**
-   * Make an existing interface connect to network.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param callback
-   *        Callback function.
-   */
-  void connect(in DOMString ifname,
-               in nsIEthernetManagerCallback callback);
-
-  /**
-   * Disconnect a connected interface in the interface list.
-   *
-   * @param ifname
-   *        Interface name.
-   * @param callback
-   *        Callback function.
-   */
-  void disconnect(in DOMString ifname,
-                  in nsIEthernetManagerCallback callback);
-};
deleted file mode 100644
--- a/dom/secureelement/SEUtils.jsm
+++ /dev/null
@@ -1,116 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-"use strict";
-
-this.SEUtils = {
-  byteArrayToHexString: function byteArrayToHexString(array) {
-    let hexStr = "";
-
-    let len = array ? array.length : 0;
-    for (let i = 0; i < len; i++) {
-      let hex = (array[i] & 0xff).toString(16);
-      hex = (hex.length === 1) ? "0" + hex : hex;
-      hexStr += hex;
-    }
-
-    return hexStr.toUpperCase();
-  },
-
-  hexStringToByteArray: function hexStringToByteArray(hexStr) {
-    if (typeof hexStr !== "string" || hexStr.length % 2 !== 0) {
-      return [];
-    }
-
-    let array = [];
-    for (let i = 0, len = hexStr.length; i < len; i += 2) {
-      array.push(parseInt(hexStr.substr(i, 2), 16));
-    }
-
-    return array;
-  },
-
-  arraysEqual: function arraysEqual(a1, a2) {
-    if (!a1 || !a2) {
-      return false;
-    }
-
-    if (a1.length !== a2.length) {
-      return false;
-    }
-
-    for (let i = 0, len = a1.length; i < len; i++) {
-      if (a1[i] !== a2[i]) {
-        return false;
-      }
-    }
-
-    return true;
-  },
-
-  ensureIsArray: function ensureIsArray(obj) {
-    return Array.isArray(obj) ? obj : [obj];
-  },
-
-  /**
-   * parseTLV is intended primarily to be used to parse Global Platform Device
-   * Technology secure element access control data.
-   *
-   * The parsed result value is an internal format only.
-   *
-   * All tags will be treated as simple Tag Length Values (TLV), (i.e. with a
-   * plain value, not subject to further unpacking), unless those tags are
-   * listed in the containerTags array.
-   *
-   * @param bytes - byte array
-   * @param containerTags - byte array of tags
-   */
-  parseTLV: function parseTLV(bytes, containerTags) {
-    let result = {};
-
-    if (typeof bytes === "string") {
-      bytes = this.hexStringToByteArray(bytes);
-    }
-
-    if (!Array.isArray(bytes)) {
-      debug("Passed value is not an array nor a string.");
-      return null;
-    }
-
-    for (let pos = 0; pos < bytes.length; ) {
-      let tag = bytes[pos],
-          length = bytes[pos + 1],
-          value = bytes.slice(pos + 2, pos + 2 + length),
-          parsed = null;
-
-      // Support for 0xFF padded files (GPD 7.1.2)
-      if (tag === 0xFF) {
-        break;
-      }
-
-      if (containerTags.indexOf(tag) >= 0) {
-        parsed = this.parseTLV(value, containerTags);
-      } else {
-        parsed = value;
-      }
-
-      // Internal parsed format.
-      if (!result[tag]) {
-        result[tag] = parsed;
-      } else if (Array.isArray(result[tag])) {
-        result[tag].push(parsed);
-      } else {
-        result[tag] = [result[tag], parsed];
-      }
-
-      pos = pos + 2 + length;
-    }
-
-    return result;
-  }
-};
-
-this.EXPORTED_SYMBOLS = ["SEUtils"];
deleted file mode 100644
--- a/dom/secureelement/gonk/ACEService.js
+++ /dev/null
@@ -1,139 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-"use strict";
-
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "SEUtils",
-                                  "resource://gre/modules/SEUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "SE", function() {
-  let obj = {};
-  Cu.import("resource://gre/modules/se_consts.js", obj);
-  return obj;
-});
-
-var DEBUG = SE.DEBUG_ACE;
-function debug(msg) {
-  if (DEBUG) {
-    dump("ACEservice: " + msg + "\n");
-  }
-}
-
-/**
- * Implements decision making algorithm as described in GPD specification,
- * mostly in 3.1, 3.2 and 4.2.3.
- *
- * TODO: Bug 1137533: Implement GPAccessRulesManager APDU filters
- */
-function GPAccessDecision(rules, certHash, aid) {
-  this.rules = rules;
-  this.certHash = certHash;
-  this.aid = aid;
-}
-
-GPAccessDecision.prototype = {
-  isAccessAllowed: function isAccessAllowed() {
-    // GPD SE Access Control v1.1, 3.4.1, Table 3-2: (Conflict resolution)
-    // If a specific rule allows, all other non-specific access is denied.
-    // Conflicting specific rules will resolve to the first Allowed == "true"
-    // match. Given no specific rule, the global "All" rules will determine
-    // access. "Some", skips further processing if access Allowed == "true".
-    //
-    // Access must be decided before the SE connector openChannel, and the
-    // exchangeAPDU call.
-    //
-    // NOTE: This implementation may change with the introduction of APDU
-    //       filters.
-    let decision = this.rules.some(this._decideAppAccess.bind(this));
-    return decision;
-  },
-
-  _decideAppAccess: function _decideAppAccess(rule) {
-    let appMatched, appletMatched;
-
-    // GPD SE AC 4.2.3: Algorithm for Applying Rules
-    // Specific rule overrides global rule.
-    //
-    // DeviceAppID is the application hash, and the AID is SE Applet ID:
-    //
-    // GPD SE AC 4.2.3 A:
-    //   SearchRuleFor(DeviceAppID, AID)
-    // GPD SE AC 4.2.3 B: If no rule fits A:
-    //   SearchRuleFor(<AllDeviceApplications>, AID)
-    // GPD SE AC 4.2.3 C: If no rule fits A or B:
-    //   SearchRuleFor(DeviceAppID, <AllSEApplications>)
-    // GPD SE AC 4.2.3 D: If no rule fits A, B, or C:
-    //   SearchRuleFor(<AllDeviceApplications>, <AllSEApplications>)
-
-    // Device App
-    appMatched = Array.isArray(rule.application) ?
-      // GPD SE AC 4.2.3 A and 4.2.3 C (DeviceAppID rule)
-      this._appCertHashMatches(rule.application) :
-      // GPD SE AC 4.2.3 B and 4.2.3 D (All Device Applications)
-      rule.application === Ci.nsIAccessRulesManager.ALLOW_ALL;
-
-    if (!appMatched) {
-      return false; // bail out early.
-    }
-
-    // SE Applet
-    appletMatched = Array.isArray(rule.applet) ?
-      // GPD SE AC 4.2.3 A and 4.2.3 B (AID rule)
-      SEUtils.arraysEqual(rule.applet, this.aid) :
-      // GPD SE AC 4.2.3 C and 4.2.3 D (All AID)
-      rule.applet === Ci.nsIAccessRulesManager.ALL_APPLET;
-
-    return appletMatched;
-  },
-
-  _appCertHashMatches: function _appCertHashMatches(hashArray) {
-    if (!Array.isArray(hashArray)) {
-      return false;
-    }
-
-    return !!(hashArray.find((hash) => {
-      return SEUtils.arraysEqual(hash, this.certHash);
-    }));
-  }
-};
-
-function ACEService() {
-  this._rulesManagers = new Map();
-
-  this._rulesManagers.set(
-    SE.TYPE_UICC,
-    Cc["@mozilla.org/secureelement/access-control/rules-manager;1"]
-      .createInstance(Ci.nsIAccessRulesManager));
-}
-
-ACEService.prototype = {
-  _rulesManagers: null,
-
-  isAccessAllowed: function isAccessAllowed(localId, seType, aid) {
-    if(!Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps")) {
-      debug("Certified apps debug enabled, allowing access");
-      return Promise.resolve(true);
-    }
-
-    throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
-  _getDevCertHashForApp: function getDevCertHashForApp(manifestURL) {
-    throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
-  classID: Components.ID("{882a7463-2ca7-4d61-a89a-10eb6fd70478}"),
-  contractID: "@mozilla.org/secureelement/access-control/ace;1",
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessControlEnforcer])
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ACEService]);
-
deleted file mode 100644
--- a/dom/secureelement/gonk/ACEService.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {882a7463-2ca7-4d61-a89a-10eb6fd70478} ACEService.js
-contract @mozilla.org/secureelement/access-control/ace;1 {882a7463-2ca7-4d61-a89a-10eb6fd70478}
\ No newline at end of file
deleted file mode 100644
--- a/dom/secureelement/gonk/GPAccessRulesManager.js
+++ /dev/null
@@ -1,436 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-"use strict";
-
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/systemlibs.js");
-
-XPCOMUtils.defineLazyServiceGetter(this, "UiccConnector",
-                                   "@mozilla.org/secureelement/connector/uicc;1",
-                                   "nsISecureElementConnector");
-
-XPCOMUtils.defineLazyModuleGetter(this, "SEUtils",
-                                  "resource://gre/modules/SEUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "SE", function() {
-  let obj = {};
-  Cu.import("resource://gre/modules/se_consts.js", obj);
-  return obj;
-});
-
-XPCOMUtils.defineLazyGetter(this, "GP", function() {
-  let obj = {};
-  Cu.import("resource://gre/modules/gp_consts.js", obj);
-  return obj;
-});
-
-var DEBUG = SE.DEBUG_ACE;
-function debug(msg) {
-  if (DEBUG) {
-    dump("-*- GPAccessRulesManager " + msg);
-  }
-}
-
-/**
- * Based on [1] - "GlobalPlatform Device Technology
- * Secure Element Access Control Version 1.0".
- * GPAccessRulesManager reads and parses access rules from SE file system
- * as defined in section #7 of [1]: "Structure of Access Rule Files (ARF)".
- * Rules retrieval from ARA-M applet is not implmented due to lack of
- * commercial implemenations of ARA-M.
- * @todo Bug 1137537: Implement ARA-M support according to section #4 of [1]
- */
-function GPAccessRulesManager() {}
-
-GPAccessRulesManager.prototype = {
-  // source [1] section 7.1.3 PKCS#15 Selection
-  PKCS_AID: "a000000063504b43532d3135",
-
-  // APDUs (ISO 7816-4) for accessing rules on SE file system
-  // see for more details: http://www.cardwerk.com/smartcards/
-  // smartcard_standard_ISO7816-4_6_basic_interindustry_commands.aspx
-  READ_BINARY:   [GP.CLA_SM, GP.INS_RB, GP.P1_RB, GP.P2_RB],
-  GET_RESPONSE:  [GP.CLA_SM, GP.INS_GR, GP.P1_GR, GP.P2_GR],
-  SELECT_BY_DF:  [GP.CLA_SM, GP.INS_SF, GP.P1_SF_DF, GP.P2_SF_FCP],
-
-  // Non-null if there is a channel open
-  channel: null,
-
-  // Refresh tag path in the acMain file as described in GPD spec,
-  // sections 7.1.5 and C.1.
-  REFRESH_TAG_PATH: [GP.TAG_SEQUENCE, GP.TAG_OCTETSTRING],
-  refreshTag: null,
-
-  // Contains rules as read from the SE
-  rules: [],
-
-  // Returns the latest rules. Results are cached.
-  getAccessRules: function getAccessRules() {
-    debug("getAccessRules");
-
-    return new Promise((resolve, reject) => {
-      this._readAccessRules(() => resolve(this.rules));
-    });
-  },
-
-  _readAccessRules: Task.async(function*(done) {
-    try {
-      yield this._openChannel(this.PKCS_AID);
-
-      let odf = yield this._readODF();
-      let dodf = yield this._readDODF(odf);
-
-      let acmf = yield this._readACMF(dodf);
-      let refreshTag = acmf[this.REFRESH_TAG_PATH[0]]
-                           [this.REFRESH_TAG_PATH[1]];
-
-      // Update cached rules based on refreshTag.
-      if (SEUtils.arraysEqual(this.refreshTag, refreshTag)) {
-        debug("_readAccessRules: refresh tag equals to the one saved.");
-        yield this._closeChannel();
-        return done();
-      }
-
-      this.refreshTag = refreshTag;
-      debug("_readAccessRules: refresh tag saved: " + this.refreshTag);
-
-      let acrf = yield this._readACRules(acmf);
-      let accf = yield this._readACConditions(acrf);
-      this.rules = yield this._parseRules(acrf, accf);
-
-      DEBUG && debug("_readAccessRules: " + JSON.stringify(this.rules, 0, 2));
-
-      yield this._closeChannel();
-      done();
-    } catch (error) {
-      debug("_readAccessRules: " + error);
-      this.rules = [];
-      yield this._closeChannel();
-      done();
-    }
-  }),
-
-  _openChannel: function _openChannel(aid) {
-    if (this.channel !== null) {
-      debug("_openChannel: Channel already opened, rejecting.");
-      return Promise.reject();
-    }
-
-    return new Promise((resolve, reject) => {
-      UiccConnector.openChannel(aid, {
-        notifyOpenChannelSuccess: (channel, openResponse) => {
-          debug("_openChannel/notifyOpenChannelSuccess: Channel " + channel +
-                " opened, open response: " + openResponse);
-          this.channel = channel;
-          resolve();
-        },
-        notifyError: (error) => {
-          debug("_openChannel/notifyError: failed to open channel, error: " +
-                error);
-          reject(error);
-        }
-      });
-    });
-  },
-
-  _closeChannel: function _closeChannel() {
-    if (this.channel === null) {
-      debug("_closeChannel: Channel not opened, rejecting.");
-      return Promise.reject();
-    }
-
-    return new Promise((resolve, reject) => {
-      UiccConnector.closeChannel(this.channel, {
-        notifyCloseChannelSuccess: () => {
-          debug("_closeChannel/notifyCloseChannelSuccess: chanel " +
-                this.channel + " closed");
-          this.channel = null;
-          resolve();
-        },
-        notifyError: (error) => {
-          debug("_closeChannel/notifyError: error closing channel, error" +
-                error);
-          reject(error);
-        }
-      });
-    });
-  },
-
-  _exchangeAPDU: function _exchangeAPDU(bytes) {
-    DEBUG && debug("apdu " + JSON.stringify(bytes));
-
-    let apdu = this._bytesToAPDU(bytes);
-    return new Promise((resolve, reject) => {
-      UiccConnector.exchangeAPDU(this.channel, apdu.cla,
-        apdu.ins, apdu.p1, apdu.p2, apdu.data, apdu.le,
-        {
-          notifyExchangeAPDUResponse: (sw1, sw2, data) => {
-            debug("APDU response is " + sw1.toString(16) + sw2.toString(16) +
-                  " data: " + data);
-
-            // 90 00 is "success"
-            if (sw1 !== 0x90 && sw2 !== 0x00) {
-              debug("rejecting APDU response");
-              reject(new Error("Response " + sw1 + "," + sw2));
-              return;
-            }
-
-            resolve(this._parseTLV(data));
-          },
-
-          notifyError: (error) => {
-            debug("_exchangeAPDU/notifyError " + error);
-            reject(error);
-          }
-        }
-      );
-    });
-  },
-
-  _readBinaryFile: function _readBinaryFile(selectResponse) {
-    DEBUG && debug("Select response: " + JSON.stringify(selectResponse));
-    // 0x80 tag parameter - get the elementary file (EF) length
-    // without structural information.
-    let fileLength = selectResponse[GP.TAG_FCP][0x80];
-
-    // If file is empty, no need to attempt to read it.
-    if (fileLength[0] === 0 && fileLength[1] === 0) {
-      return Promise.resolve(null);
-    }
-
-    // TODO READ BINARY with filelength not supported
-    // let readApdu = this.READ_BINARY.concat(fileLength);
-    return this._exchangeAPDU(this.READ_BINARY);
-  },
-
-  _selectAndRead: function _selectAndRead(df) {
-    return this._exchangeAPDU(this.SELECT_BY_DF.concat(df.length & 0xFF, df))
-           .then((resp) => this._readBinaryFile(resp));
-  },
-
-  _readODF: function _readODF() {
-    debug("_readODF");
-    return this._selectAndRead(GP.ODF_DF);
-  },
-
-  _readDODF: function _readDODF(odfFile) {
-    debug("_readDODF, ODF file: " + odfFile);
-
-    // Data Object Directory File (DODF) is used as an entry point to the
-    // Access Control data. It is specified in PKCS#15 section 6.7.6.
-    // DODF is referenced by the ODF file, which looks as follows:
-    //   A7 06
-    //      30 04
-    //         04 02 XY WZ
-    // where [0xXY, 0xWZ] is a DF of DODF file.
-    let DODF_DF = odfFile[GP.TAG_EF_ODF][GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING];
-    return this._selectAndRead(DODF_DF);
-  },
-
-  _readACMF: function _readACMF(dodfFile) {
-    debug("_readACMF, DODF file: " + dodfFile);
-
-    // ACMF file DF is referenced in DODF file, which looks like this:
-    //
-    //  A1 29
-    //     30 00
-    //     30 0F
-    //        0C 0D 47 50 20 53 45 20 41 63 63 20 43 74 6C
-    //     A1 14
-    //        30 12
-    //           06 0A 2A 86 48 86 FC 6B 81 48 01 01  <-- GPD registered OID
-    //           30 04
-    //              04 02 AB CD  <-- ACMF DF
-    //  A1 2B
-    //     30 00
-    //     30 0F
-    //        0C 0D 53 41 54 53 41 20 47 54 4F 20 31 2E 31
-    //     A1 16
-    //        30 14
-    //           06 0C 2B 06 01 04 01 2A 02 6E 03 01 01 01  <-- some other OID
-    //           30 04
-    //              04 02 XY WZ  <-- some other file's DF
-    //
-    // DODF file consists of DataTypes with oidDO entries. Entry with OID
-    // equal to "1.2.840.114283.200.1.1" ("2A 86 48 86 FC 6B 81 48 01 01")
-    // contains DF of the ACMF. In the file above, it means that ACMF DF
-    // equals to [0xAB, 0xCD], and not [0xXY, 0xWZ].
-    //
-    // Algorithm used to encode OID to an byte array:
-    //   http://www.snmpsharpnet.com/?p=153
-
-    let gpdOid = [0x2A,                 // 1.2
-                  0x86, 0x48,           // 840
-                  0x86, 0xFC, 0x6B,     // 114283
-                  0x81, 0x48,           // 129
-                  0x01,                 // 1
-                  0x01];                // 1
-
-    let records = SEUtils.ensureIsArray(dodfFile[GP.TAG_EXTERNALDO]);
-
-    // Look for the OID registered for GPD SE.
-    let gpdRecords = records.filter((record) => {
-      let oid = record[GP.TAG_EXTERNALDO][GP.TAG_SEQUENCE][GP.TAG_OID];
-      return SEUtils.arraysEqual(oid, gpdOid);
-    });
-
-    // [1] 7.1.5: "There shall be only one ACMF file per Secure Element.
-    // If a Secure Element contains several ACMF files, then the security shall
-    // be considered compromised and the Access Control enforcer shall forbid
-    // access to all (...) apps."
-    if (gpdRecords.length !== 1) {
-      return Promise.reject(new Error(gpdRecords.length + " ACMF files found"));
-    }
-
-    let ACMain_DF = gpdRecords[0][GP.TAG_EXTERNALDO][GP.TAG_SEQUENCE]
-                                 [GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING];
-    return this._selectAndRead(ACMain_DF);
-  },
-
-  _readACRules: function _readACRules(acMainFile) {
-    debug("_readACRules, ACMain file: " + acMainFile);
-
-    // ACMF looks like this:
-    //
-    //  30 10
-    //    04 08 XX XX XX XX XX XX XX XX
-    //    30 04
-    //       04 02 XY WZ
-    //
-    // where [XY, WZ] is a DF of ACRF, and XX XX XX XX XX XX XX XX is a refresh
-    // tag.
-
-    let ACRules_DF = acMainFile[GP.TAG_SEQUENCE][GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING];
-    return this._selectAndRead(ACRules_DF);
-  },
-
-  _readACConditions: function _readACConditions(acRulesFile) {
-    debug("_readACCondition, ACRules file: " + acRulesFile);
-
-    let acRules = SEUtils.ensureIsArray(acRulesFile[GP.TAG_SEQUENCE]);
-    if (acRules.length === 0) {
-      debug("No rules found in ACRules file.");
-      return Promise.reject(new Error("No rules found in ACRules file"));
-    }
-
-    // We first read all the condition files referenced in the ACRules file,
-    // because ACRules file might reference one ACCondition file more than
-    // once. Since reading it isn't exactly fast, we optimize here.
-    let acReadQueue = Promise.resolve({});
-
-    acRules.forEach((ruleEntry) => {
-      let df = ruleEntry[GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING];
-
-      // Promise chain read condition entries:
-      let readAcCondition = (acConditionFiles) => {
-        if (acConditionFiles[df] !== undefined) {
-          debug("Skipping previously read acCondition df: " + df);
-          return acConditionFiles;
-        }
-
-        return this._selectAndRead(df)
-               .then((acConditionFileContents) => {
-                 acConditionFiles[df] = acConditionFileContents;
-                 return acConditionFiles;
-               });
-      }
-
-      acReadQueue = acReadQueue.then(readAcCondition);
-    });
-
-    return acReadQueue;
-  },
-
-  _parseRules: function _parseRules(acRulesFile, acConditionFiles) {
-    DEBUG && debug("_parseRules: acConditionFiles " + JSON.stringify(acConditionFiles));
-    let rules = [];
-
-    let acRules = SEUtils.ensureIsArray(acRulesFile[GP.TAG_SEQUENCE]);
-    acRules.forEach((ruleEntry) => {
-      DEBUG && debug("Parsing one rule: " + JSON.stringify(ruleEntry));
-      let rule = {};
-
-      // 0xA0 and 0x82 tags as per GPD spec sections C.1 - C.3. 0xA0 means
-      // that rule describes access to one SE applet only (and its AID is
-      // given). 0x82 means that rule describes acccess to all SE applets.
-      let oneApplet = ruleEntry[GP.TAG_GPD_AID];
-      let allApplets = ruleEntry[GP.TAG_GPD_ALL];
-
-      if (oneApplet) {
-        rule.applet = oneApplet[GP.TAG_OCTETSTRING];
-      } else if (allApplets) {
-        rule.applet = Ci.nsIAccessRulesManager.ALL_APPLET;
-      } else {
-        throw Error("Unknown applet definition");
-      }
-
-      let df = ruleEntry[GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING];
-      let condition = acConditionFiles[df];
-      if (condition === null) {
-        rule.application = Ci.nsIAccessRulesManager.DENY_ALL;
-      } else if (condition[GP.TAG_SEQUENCE]) {
-        if (!Array.isArray(condition[GP.TAG_SEQUENCE]) &&
-            !condition[GP.TAG_SEQUENCE][GP.TAG_OCTETSTRING]) {
-          rule.application = Ci.nsIAccessRulesManager.ALLOW_ALL;
-        } else {
-          rule.application = SEUtils.ensureIsArray(condition[GP.TAG_SEQUENCE])
-                             .map((conditionEntry) => {
-            return conditionEntry[GP.TAG_OCTETSTRING];
-          });
-        }
-      } else {
-        throw Error("Unknown application definition");
-      }
-
-      DEBUG && debug("Rule parsed, adding to the list: " + JSON.stringify(rule));
-      rules.push(rule);
-    });
-
-    DEBUG && debug("All rules parsed, we have those in total: " + JSON.stringify(rules));
-    return rules;
-  },
-
-  _parseTLV: function _parseTLV(bytes) {
-    let containerTags = [
-      GP.TAG_SEQUENCE,
-      GP.TAG_FCP,
-      GP.TAG_GPD_AID,
-      GP.TAG_EXTERNALDO,
-      GP.TAG_INDIRECT,
-      GP.TAG_EF_ODF
-    ];
-    return SEUtils.parseTLV(bytes, containerTags);
-  },
-
-  // TODO consider removing if better format for storing
-  // APDU consts will be introduced
-  _bytesToAPDU: function _bytesToAPDU(arr) {
-    let apdu = {
-      cla: arr[0] & 0xFF,
-      ins: arr[1] & 0xFF,
-      p1: arr[2] & 0xFF,
-      p2: arr[3] & 0xFF,
-      p3: arr[4] & 0xFF,
-      le: 0
-    };
-
-    let data = (apdu.p3 > 0) ? (arr.slice(5)) : [];
-    apdu.data = (data.length) ? SEUtils.byteArrayToHexString(data) : null;
-    return apdu;
-  },
-
-  classID: Components.ID("{3e046b4b-9e66-439a-97e0-98a69f39f55f}"),
-  contractID: "@mozilla.org/secureelement/access-control/rules-manager;1",
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessRulesManager])
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GPAccessRulesManager]);
deleted file mode 100644
--- a/dom/secureelement/gonk/GPAccessRulesManager.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {3e046b4b-9e66-439a-97e0-98a69f39f55f} GPAccessRulesManager.js
-contract @mozilla.org/secureelement/access-control/rules-manager;1 {3e046b4b-9e66-439a-97e0-98a69f39f55f}
deleted file mode 100644
--- a/dom/secureelement/gonk/SecureElement.js
+++ /dev/null
@@ -1,508 +0,0 @@
-/* Copyright 2012 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Copyright © 2014, Deutsche Telekom, Inc. */
-
-"use strict";
-
-/* globals dump, Components, XPCOMUtils, SE, Services, UiccConnector,
-   SEUtils, ppmm, gMap, UUIDGenerator */
-
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/systemlibs.js");
-
-XPCOMUtils.defineLazyGetter(this, "SE", () => {
-  let obj = {};
-  Cu.import("resource://gre/modules/se_consts.js", obj);
-  return obj;
-});
-
-// set to true in se_consts.js to see debug messages
-var DEBUG = SE.DEBUG_SE;
-function debug(s) {
-  if (DEBUG) {
-    dump("-*- SecureElement: " + s + "\n");
-  }
-}
-
-const SE_IPC_SECUREELEMENT_MSG_NAMES = [
-  "SE:GetSEReaders",
-  "SE:OpenChannel",
-  "SE:CloseChannel",
-  "SE:TransmitAPDU"
-];
-
-const SECUREELEMENTMANAGER_CONTRACTID =
-  "@mozilla.org/secureelement/parent-manager;1";
-const SECUREELEMENTMANAGER_CID =
-  Components.ID("{48f4e650-28d2-11e4-8c21-0800200c9a66}");
-const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
-
-XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
-                                   "@mozilla.org/parentprocessmessagemanager;1",
-                                   "nsIMessageBroadcaster");
-
-XPCOMUtils.defineLazyServiceGetter(this, "UUIDGenerator",
-                                   "@mozilla.org/uuid-generator;1",
-                                   "nsIUUIDGenerator");
-
-XPCOMUtils.defineLazyModuleGetter(this, "SEUtils",
-                                  "resource://gre/modules/SEUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "UiccConnector", () => {
-  let uiccClass = Cc["@mozilla.org/secureelement/connector/uicc;1"];
-  return uiccClass ? uiccClass.getService(Ci.nsISecureElementConnector) : null;
-});
-
-function getConnector(type) {
-  switch (type) {
-    case SE.TYPE_UICC:
-      return UiccConnector;
-    case SE.TYPE_ESE:
-    default:
-      debug("Unsupported SEConnector : " + type);
-      return null;
-  }
-}
-
-/**
- * 'gMap' is a nested dictionary object that manages all the information
- * pertaining to channels for a given application (appId). It manages the
- * relationship between given application and its opened channels.
- */
-XPCOMUtils.defineLazyGetter(this, "gMap", function() {
-  return {
-    // example structure of AppInfoMap
-    // {
-    //   "appId1": {
-    //     target: target1,
-    //     channels: {
-    //       "channelToken1": {
-    //         seType: "uicc",
-    //         aid: "aid1",
-    //         channelNumber: 1
-    //       },
-    //       "channelToken2": { ... }
-    //     }
-    //   },
-    //  "appId2": { ... }
-    // }
-    appInfoMap: {},
-
-    registerSecureElementTarget: function(appId, target) {
-      if (this.isAppIdRegistered(appId)) {
-        debug("AppId: " + appId + "already registered");
-        return;
-      }
-
-      this.appInfoMap[appId] = {
-        target: target,
-        channels: {}
-      };
-
-      debug("Registered a new SE target " + appId);
-    },
-
-    unregisterSecureElementTarget: function(target) {
-      let appId = Object.keys(this.appInfoMap).find((id) => {
-        return this.appInfoMap[id].target === target;
-      });
-
-      if (!appId) {
-        return;
-      }
-
-      debug("Unregistered SE Target for AppId: " + appId);
-      delete this.appInfoMap[appId];
-    },
-
-    isAppIdRegistered: function(appId) {
-      return this.appInfoMap[appId] !== undefined;
-    },
-
-    getChannelCountByAppIdType: function(appId, type) {
-      return Object.keys(this.appInfoMap[appId].channels)
-                   .reduce((cnt, ch) => ch.type === type ? ++cnt : cnt, 0);
-    },
-
-    // Add channel to the appId. Upon successfully adding the entry
-    // this function will return the 'token'
-    addChannel: function(appId, type, aid, channelNumber) {
-      let token = UUIDGenerator.generateUUID().toString();
-      this.appInfoMap[appId].channels[token] = {
-        seType: type,
-        aid: aid,
-        channelNumber: channelNumber
-      };
-      return token;
-    },
-
-    removeChannel: function(appId, channelToken) {
-      if (this.appInfoMap[appId].channels[channelToken]) {
-        debug("Deleting channel with token : " + channelToken);
-        delete this.appInfoMap[appId].channels[channelToken];
-      }
-    },
-
-    getChannel: function(appId, channelToken) {
-      if (!this.appInfoMap[appId].channels[channelToken]) {
-        return null;
-      }
-
-      return this.appInfoMap[appId].channels[channelToken];
-    },
-
-    getChannelsByTarget: function(target) {
-      let appId = Object.keys(this.appInfoMap).find((id) => {
-        return this.appInfoMap[id].target === target;
-      });
-
-      if (!appId) {
-        return [];
-      }
-
-      return Object.keys(this.appInfoMap[appId].channels)
-                   .map(token => this.appInfoMap[appId].channels[token]);
-    },
-
-    getTargets: function() {
-      return Object.keys(this.appInfoMap)
-                   .map(appId => this.appInfoMap[appId].target);
-    },
-  };
-});
-
-/**
- * 'SecureElementManager' is the main object that handles IPC messages from
- * child process. It interacts with other objects such as 'gMap' & 'Connector
- * instances (UiccConnector, eSEConnector)' to perform various
- * SE-related (open, close, transmit) operations.
- * @TODO: Bug 1118097 Support slot based SE/reader names
- * @TODO: Bug 1118101 Introduce SE type specific permissions
- */
-function SecureElementManager() {
-  this._registerMessageListeners();
-  this._registerSEListeners();
-  Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
-  this._acEnforcer =
-    Cc["@mozilla.org/secureelement/access-control/ace;1"]
-    .getService(Ci.nsIAccessControlEnforcer);
-}
-
-SecureElementManager.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([
-    Ci.nsIMessageListener,
-    Ci.nsISEListener,
-    Ci.nsIObserver]),
-  classID: SECUREELEMENTMANAGER_CID,
-  classInfo: XPCOMUtils.generateCI({
-    classID:          SECUREELEMENTMANAGER_CID,
-    classDescription: "SecureElementManager",
-    interfaces:       [Ci.nsIMessageListener,
-                       Ci.nsISEListener,
-                       Ci.nsIObserver]
-  }),
-
-  // Stores information about supported SE types and their presence.
-  // key: secure element type, value: (Boolean) is present/accessible
-  _sePresence: {},
-
-  _acEnforcer: null,
-
-  _shutdown: function() {
-    this._acEnforcer = null;
-    this.secureelement = null;
-    Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
-    this._unregisterMessageListeners();
-    this._unregisterSEListeners();
-  },
-
-  _registerMessageListeners: function() {
-    ppmm.addMessageListener("child-process-shutdown", this);
-    for (let msgname of SE_IPC_SECUREELEMENT_MSG_NAMES) {
-      ppmm.addMessageListener(msgname, this);
-    }
-  },
-
-  _unregisterMessageListeners: function() {
-    ppmm.removeMessageListener("child-process-shutdown", this);
-    for (let msgname of SE_IPC_SECUREELEMENT_MSG_NAMES) {
-      ppmm.removeMessageListener(msgname, this);
-    }
-    ppmm = null;
-  },
-
-  _registerSEListeners: function() {
-    let connector = getConnector(SE.TYPE_UICC);
-    if (!connector) {
-      return;
-    }
-
-    this._sePresence[SE.TYPE_UICC] = false;
-    connector.registerListener(this);
-  },
-
-  _unregisterSEListeners: function() {
-    Object.keys(this._sePresence).forEach((type) => {
-      let connector = getConnector(type);
-      if (connector) {
-        connector.unregisterListener(this);
-      }
-    });
-
-    this._sePresence = {};
-  },
-
-  notifySEPresenceChanged: function(type, isPresent) {
-    // we need to notify all targets, even those without open channels,
-    // app could've stored the reader without actually using it
-    debug("notifying DOM about SE state change");
-    this._sePresence[type] = isPresent;
-    gMap.getTargets().forEach(target => {
-      let result = { type: type, isPresent: isPresent };
-      target.sendAsyncMessage("SE:ReaderPresenceChanged", { result: result });
-    });
-  },
-
-  _canOpenChannel: function(appId, type) {
-    let opened = gMap.getChannelCountByAppIdType(appId, type);
-    let limit = SE.MAX_CHANNELS_ALLOWED_PER_SESSION;
-    // UICC basic channel is not accessible see comment in se_consts.js
-    limit = type === SE.TYPE_UICC ? limit - 1 : limit;
-    return opened < limit;
-  },
-
-  _handleOpenChannel: function(msg, callback) {
-    if (!this._canOpenChannel(msg.appId, msg.type)) {
-      debug("Max channels per session exceed");
-      callback({ error: SE.ERROR_GENERIC });
-      return;
-    }
-
-    let connector = getConnector(msg.type);
-    if (!connector) {
-      debug("No SE connector available");
-      callback({ error: SE.ERROR_NOTPRESENT });
-      return;
-    }
-
-    this._acEnforcer.isAccessAllowed(msg.appId, msg.type, msg.aid)
-    .then((allowed) => {
-      if (!allowed) {
-        callback({ error: SE.ERROR_SECURITY });
-        return;
-      }
-      connector.openChannel(SEUtils.byteArrayToHexString(msg.aid), {
-
-        notifyOpenChannelSuccess: (channelNumber, openResponse) => {
-          // Add the new 'channel' to the map upon success
-          let channelToken =
-            gMap.addChannel(msg.appId, msg.type, msg.aid, channelNumber);
-          if (channelToken) {
-            callback({
-              error: SE.ERROR_NONE,
-              channelToken: channelToken,
-              isBasicChannel: (channelNumber === SE.BASIC_CHANNEL),
-              openResponse: SEUtils.hexStringToByteArray(openResponse)
-            });
-          } else {
-            callback({ error: SE.ERROR_GENERIC });
-          }
-        },
-
-        notifyError: (reason) => {
-          debug("Failed to open the channel to AID : " +
-                SEUtils.byteArrayToHexString(msg.aid) +
-                ", Rejected with Reason : " + reason);
-          callback({ error: SE.ERROR_GENERIC, reason: reason, response: [] });
-        }
-      });
-    })
-    .catch((error) => {
-      debug("Failed to get info from accessControlEnforcer " + error);
-      callback({ error: SE.ERROR_SECURITY });
-    });
-  },
-
-  _handleTransmit: function(msg, callback) {
-    let channel = gMap.getChannel(msg.appId, msg.channelToken);
-    if (!channel) {
-      debug("Invalid token:" + msg.channelToken + ", appId: " + msg.appId);
-      callback({ error: SE.ERROR_GENERIC });
-      return;
-    }
-
-    let connector = getConnector(channel.seType);
-    if (!connector) {
-      debug("No SE connector available");
-      callback({ error: SE.ERROR_NOTPRESENT });
-      return;
-    }
-
-    // Bug 1137533 - ACE GPAccessRulesManager APDU filters
-    connector.exchangeAPDU(channel.channelNumber, msg.apdu.cla, msg.apdu.ins,
-                           msg.apdu.p1, msg.apdu.p2,
-                           SEUtils.byteArrayToHexString(msg.apdu.data),
-                           msg.apdu.le, {
-      notifyExchangeAPDUResponse: (sw1, sw2, response) => {
-        callback({
-          error: SE.ERROR_NONE,
-          sw1: sw1,
-          sw2: sw2,
-          response: SEUtils.hexStringToByteArray(response)
-        });
-      },
-
-      notifyError: (reason) => {
-        debug("Transmit failed, rejected with Reason : " + reason);
-        callback({ error: SE.ERROR_INVALIDAPPLICATION, reason: reason });
-      }
-    });
-  },
-
-  _handleCloseChannel: function(msg, callback) {
-    let channel = gMap.getChannel(msg.appId, msg.channelToken);
-    if (!channel) {
-      debug("Invalid token:" + msg.channelToken + ", appId:" + msg.appId);
-      callback({ error: SE.ERROR_GENERIC });
-      return;
-    }
-
-    let connector = getConnector(channel.seType);
-    if (!connector) {
-      debug("No SE connector available");
-      callback({ error: SE.ERROR_NOTPRESENT });
-      return;
-    }
-
-    connector.closeChannel(channel.channelNumber, {
-      notifyCloseChannelSuccess: () => {
-        gMap.removeChannel(msg.appId, msg.channelToken);
-        callback({ error: SE.ERROR_NONE });
-      },
-
-      notifyError: (reason) => {
-        debug("Failed to close channel with token: " + msg.channelToken +
-              ", reason: "+ reason);
-        callback({ error: SE.ERROR_BADSTATE, reason: reason });
-      }
-    });
-  },
-
-  _handleGetSEReadersRequest: function(msg, target, callback) {
-    gMap.registerSecureElementTarget(msg.appId, target);
-    let readers = Object.keys(this._sePresence).map(type => {
-      return { type: type, isPresent: this._sePresence[type] };
-    });
-    callback({ readers: readers, error: SE.ERROR_NONE });
-  },
-
-  _handleChildProcessShutdown: function(target) {
-    let channels = gMap.getChannelsByTarget(target);
-
-    let createCb = (seType, channelNumber) => {
-      return {
-        notifyCloseChannelSuccess: () => {
-          debug("closed " + seType + ", channel " + channelNumber);
-        },
-
-        notifyError: (reason) => {
-          debug("Failed to close  " + seType + " channel " +
-                channelNumber + ", reason: " + reason);
-        }
-      };
-    };
-
-    channels.forEach((channel) => {
-      let connector = getConnector(channel.seType);
-      if (!connector) {
-        return;
-      }
-
-      connector.closeChannel(channel.channelNumber,
-                             createCb(channel.seType, channel.channelNumber));
-    });
-
-    gMap.unregisterSecureElementTarget(target);
-  },
-
-  _sendSEResponse: function(msg, result) {
-    let promiseStatus = (result.error === SE.ERROR_NONE) ? "Resolved" : "Rejected";
-    result.resolverId = msg.data.resolverId;
-    msg.target.sendAsyncMessage(msg.name + promiseStatus, {result: result});
-  },
-
-  _isValidMessage: function(msg) {
-    let appIdValid = gMap.isAppIdRegistered(msg.data.appId);
-    return msg.name === "SE:GetSEReaders" ? true : appIdValid;
-  },
-
-  /**
-   * nsIMessageListener interface methods.
-   */
-
-  receiveMessage: function(msg) {
-    DEBUG && debug("Received '" + msg.name + "' message from content process" +
-                   ": " + JSON.stringify(msg.data));
-
-    if (msg.name === "child-process-shutdown") {
-      this._handleChildProcessShutdown(msg.target);
-      return null;
-    }
-
-    if (SE_IPC_SECUREELEMENT_MSG_NAMES.indexOf(msg.name) === -1) {
-      debug("Ignoring unknown message type: " + msg.name);
-      return null;
-    }
-
-    let callback = (result) => this._sendSEResponse(msg, result);
-    if (!this._isValidMessage(msg)) {
-      debug("Message not valid");
-      callback({ error: SE.ERROR_GENERIC });
-      return null;
-    }
-
-    switch (msg.name) {
-      case "SE:GetSEReaders":
-        this._handleGetSEReadersRequest(msg.data, msg.target, callback);
-        break;
-      case "SE:OpenChannel":
-        this._handleOpenChannel(msg.data, callback);
-        break;
-      case "SE:CloseChannel":
-        this._handleCloseChannel(msg.data, callback);
-        break;
-      case "SE:TransmitAPDU":
-        this._handleTransmit(msg.data, callback);
-        break;
-    }
-    return null;
-  },
-
-  /**
-   * nsIObserver interface methods.
-   */
-
-  observe: function(subject, topic, data) {
-    if (topic === NS_XPCOM_SHUTDOWN_OBSERVER_ID) {
-      this._shutdown();
-    }
-  }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SecureElementManager]);
deleted file mode 100644
--- a/dom/secureelement/gonk/SecureElement.manifest
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2012 Mozilla Foundation and Mozilla contributors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# SecureElementManager
-component {48f4e650-28d2-11e4-8c21-0800200c9a66} SecureElement.js
-contract @mozilla.org/secureelement/parent-manager;1 {48f4e650-28d2-11e4-8c21-0800200c9a66}
-category profile-after-change SecureElementManager @mozilla.org/secureelement/parent-manager;1
deleted file mode 100644
--- a/dom/secureelement/gonk/UiccConnector.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/* Copyright 2012 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Copyright © 2014, Deutsche Telekom, Inc. */
-
-"use strict";
-
-/* globals Components, XPCOMUtils, SE, dump, libcutils, Services,
-   iccService, SEUtils */
-
-const { interfaces: Ci, utils: Cu, results: Cr } = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/systemlibs.js");
-
-XPCOMUtils.defineLazyGetter(this, "SE", function() {
-  let obj = {};
-  Cu.import("resource://gre/modules/se_consts.js", obj);
-  return obj;
-});
-
-// set to true in se_consts.js to see debug messages
-var DEBUG = SE.DEBUG_CONNECTOR;
-function debug(s) {
-  if (DEBUG) {
-    dump("-*- UiccConnector: " + s + "\n");
-  }
-}
-
-XPCOMUtils.defineLazyModuleGetter(this, "SEUtils",
-                                  "resource://gre/modules/SEUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "iccService",
-                                   "@mozilla.org/icc/iccservice;1",
-                                   "nsIIccService");
-
-const UICCCONNECTOR_CONTRACTID =
-  "@mozilla.org/secureelement/connector/uicc;1";
-const UICCCONNECTOR_CID =
-  Components.ID("{8e040e5d-c8c3-4c1b-ac82-c00d25d8c4a4}");
-const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
-
-// TODO: Bug 1118099  - Add multi-sim support.
-// In the Multi-sim, there is more than one client.
-// For now, use default clientID as 0. Ideally, SE parent process would like to
-// know which clients (uicc slot) are connected to CLF over SWP interface.
-const PREFERRED_UICC_CLIENTID =
-  libcutils.property_get("ro.moz.se.def_client_id", "0");
-
-/**
- * 'UiccConnector' object is a wrapper over iccService's channel management
- * related interfaces that implements nsISecureElementConnector interface.
- */
-function UiccConnector() {
-  this._init();
-}
-
-UiccConnector.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISecureElementConnector,
-                                         Ci.nsIIccListener]),
-  classID: UICCCONNECTOR_CID,
-  classInfo: XPCOMUtils.generateCI({
-    classID: UICCCONNECTOR_CID,
-    contractID: UICCCONNECTOR_CONTRACTID,
-    classDescription: "UiccConnector",
-    interfaces: [Ci.nsISecureElementConnector,
-                 Ci.nsIIccListener,
-                 Ci.nsIObserver]
-  }),
-
-  _SEListeners: [],
-  _isPresent: false,
-
-  _init: function() {
-    Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
-    let icc = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID);
-    icc.registerListener(this);
-
-    // Update the state in order to avoid race condition.
-    // By this time, 'notifyCardStateChanged (with proper card state)'
-    // may have occurred already before this module initialization.
-    this._updatePresenceState();
-  },
-
-  _shutdown: function() {
-    Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
-    let icc = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID);
-    icc.unregisterListener(this);
-  },
-
-  _updatePresenceState: function() {
-    let uiccNotReadyStates = [
-      Ci.nsIIcc.CARD_STATE_UNKNOWN,
-      Ci.nsIIcc.CARD_STATE_ILLEGAL,
-      Ci.nsIIcc.CARD_STATE_PERSONALIZATION_IN_PROGRESS,
-      Ci.nsIIcc.CARD_STATE_PERMANENT_BLOCKED,
-      Ci.nsIIcc.CARD_STATE_UNDETECTED
-    ];
-
-    let cardState = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID).cardState;
-    let uiccPresent = cardState !== null &&
-                      uiccNotReadyStates.indexOf(cardState) == -1;
-
-    if (this._isPresent === uiccPresent) {
-      return;
-    }
-
-    debug("Uicc presence changed " + this._isPresent + " -> " + uiccPresent);
-    this._isPresent = uiccPresent;
-    this._SEListeners.forEach((listener) => {
-      listener.notifySEPresenceChanged(SE.TYPE_UICC, this._isPresent);
-    });
-  },
-
-  // See GP Spec, 11.1.4 Class Byte Coding
-  _setChannelToCLAByte: function(cla, channel) {
-    if (channel < SE.LOGICAL_CHANNEL_NUMBER_LIMIT) {
-      // b7 = 0 indicates the first interindustry class byte coding
-      cla = (cla & 0x9C) & 0xFF | channel;
-    } else if (channel < SE.SUPPLEMENTARY_LOGICAL_CHANNEL_NUMBER_LIMIT) {
-      // b7 = 1 indicates the further interindustry class byte coding
-      cla = (cla & 0xB0) & 0xFF | 0x40 | (channel - SE.LOGICAL_CHANNEL_NUMBER_LIMIT);
-    } else {
-      debug("Channel number must be within [0..19]");
-      return SE.ERROR_GENERIC;
-    }
-    return cla;
-  },
-
-  _doGetOpenResponse: function(channel, length, callback) {
-    // Le value is set. It means that this is a request for all available
-    // response bytes.
-    let cla = this._setChannelToCLAByte(SE.CLA_GET_RESPONSE, channel);
-    this.exchangeAPDU(channel, cla, SE.INS_GET_RESPONSE, 0x00, 0x00,
-                      null, length, {
-      notifyExchangeAPDUResponse: function(sw1, sw2, response) {
-        debug("GET Response : " + response);
-        if (callback) {
-          callback({
-            error: SE.ERROR_NONE,
-            sw1: sw1,
-            sw2: sw2,
-            response: response
-          });
-        }
-      },
-
-      notifyError: function(reason) {
-        debug("Failed to get open response: " +
-              ", Rejected with Reason : " + reason);
-        if (callback) {
-          callback({ error: SE.ERROR_INVALIDAPPLICATION, reason: reason });
-        }
-      }
-    });
-  },
-
-  _doIccExchangeAPDU: function(channel, cla, ins, p1, p2, p3,
-                               data, appendResp, callback) {
-    let icc = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID);
-    icc.iccExchangeAPDU(channel, cla & 0xFC, ins, p1, p2, p3, data, {
-      notifyExchangeAPDUResponse: (sw1, sw2, response) => {
-        debug("sw1 : " + sw1 + ", sw2 : " + sw2 + ", response : " + response);
-
-        // According to ETSI TS 102 221 , Section 7.2.2.3.1,
-        // Enforce 'Procedure bytes' checks before notifying the callback.
-        // Note that 'Procedure bytes'are special cases.
-        // There is no need to handle '0x60' procedure byte as it implies
-        // no-action from SE stack perspective. This procedure byte is not
-        // notified to application layer.
-        if (sw1 === 0x6C) {
-          // Use the previous command header with length as second procedure
-          // byte (SW2) as received and repeat the procedure.
-
-          // Recursive! and Pass empty response '' as args, since '0x6C'
-          // procedure does not have to deal with appended responses.
-          this._doIccExchangeAPDU(channel, cla, ins, p1, p2,
-                                  sw2, data, "", callback);
-        } else if (sw1 === 0x61) {
-          // Since the terminal waited for a second procedure byte and
-          // received it (sw2), send a GET RESPONSE command header to the UICC
-          // with a maximum length of 'XX', where 'XX' is the value of the
-          // second procedure byte (SW2).
-
-          let claWithChannel = this._setChannelToCLAByte(SE.CLA_GET_RESPONSE,
-                                                         channel);
-
-          // Recursive, with GET RESPONSE bytes and '0x61' procedure IS interested
-          // in appended responses. Pass appended response and note that p3=sw2.
-          this._doIccExchangeAPDU(channel, claWithChannel, SE.INS_GET_RESPONSE,
-                                  0x00, 0x00, sw2, null,
-                                  (response ? response + appendResp : appendResp),
-                                  callback);
-        } else if (callback) {
-          callback.notifyExchangeAPDUResponse(sw1, sw2, response);
-        }
-      },
-
-      notifyError: (reason) => {
-        debug("Failed to trasmit C-APDU over the channel #  : " + channel +
-              ", Rejected with Reason : " + reason);
-        if (callback) {
-          callback.notifyError(reason);
-        }
-      }
-    });
-  },
-
-  /**
-   * nsISecureElementConnector interface methods.
-   */
-
-  /**
-   * Opens a channel on a default clientId
-   */
-  openChannel: function(aid, callback) {
-    if (!this._isPresent) {
-      callback.notifyError(SE.ERROR_NOTPRESENT);
-      return;
-    }
-
-    // TODO: Bug 1118106: Handle Resource management / leaks by persisting
-    // the newly opened channel in some persistent storage so that when this
-    // module gets restarted (say after opening a channel) in the event of
-    // some erroneous conditions such as gecko restart /, crash it can read
-    // the persistent storage to check if there are any held resources
-    // (opened channels) and close them.
-    let icc = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID);
-    icc.iccOpenChannel(aid, {
-      notifyOpenChannelSuccess: (channel) => {
-        this._doGetOpenResponse(channel, 0x00, function(result) {
-          if (callback) {
-            callback.notifyOpenChannelSuccess(channel, result.response);
-          }
-        });
-      },
-
-      notifyError: (reason) => {
-        debug("Failed to open the channel to AID : " + aid +
-              ", Rejected with Reason : " + reason);
-        if (callback) {
-          callback.notifyError(reason);
-        }
-      }
-    });
-  },
-
-  /**
-   * Transmit the C-APDU (command) on default clientId.
-   */
-  exchangeAPDU: function(channel, cla, ins, p1, p2, data, le, callback) {
-    if (!this._isPresent) {
-      callback.notifyError(SE.ERROR_NOTPRESENT);
-      return;
-    }
-
-    if (data && data.length % 2 !== 0) {
-      callback.notifyError("Data should be a hex string with length % 2 === 0");
-      return;
-    }
-
-    cla = this._setChannelToCLAByte(cla, channel);
-    let lc = data ? data.length / 2 : 0;
-    let p3 = lc || le;
-
-    if (lc && (le !== -1)) {
-      data += SEUtils.byteArrayToHexString([le]);
-    }
-
-    // Pass empty response '' as args as we are not interested in appended
-    // responses yet!
-    debug("exchangeAPDU on Channel # " + channel);
-    this._doIccExchangeAPDU(channel, cla, ins, p1, p2, p3, data, "",
-                            callback);
-  },
-
-  /**
-   * Closes the channel on default clientId.
-   */
-  closeChannel: function(channel, callback) {
-    if (!this._isPresent) {
-      callback.notifyError(SE.ERROR_NOTPRESENT);
-      return;
-    }
-
-    let icc = iccService.getIccByServiceId(PREFERRED_UICC_CLIENTID);
-    icc.iccCloseChannel(channel, {
-      notifyCloseChannelSuccess: function() {
-        debug("closeChannel successfully closed the channel # : " + channel);
-        if (callback) {
-          callback.notifyCloseChannelSuccess();
-        }
-      },
-
-      notifyError: function(reason) {
-        debug("Failed to close the channel #  : " + channel +
-              ", Rejected with Reason : " + reason);
-        if (callback) {
-          callback.notifyError(reason);
-        }
-      }
-    });
-  },
-
-  registerListener: function(listener) {
-    if (this._SEListeners.indexOf(listener) !== -1) {
-      throw Cr.NS_ERROR_UNEXPECTED;
-    }
-
-    this._SEListeners.push(listener);
-    // immediately notify listener about the current state
-    listener.notifySEPresenceChanged(SE.TYPE_UICC, this._isPresent);
-  },
-
-  unregisterListener: function(listener) {
-    let idx = this._SEListeners.indexOf(listener);
-    if (idx !== -1) {
-      this._SEListeners.splice(idx, 1);
-    }
-  },
-
-  /**
-   * nsIIccListener interface methods.
-   */
-  notifyStkCommand: function() {},
-
-  notifyStkSessionEnd: function() {},
-
-  notifyIccInfoChanged: function() {},
-
-  notifyCardStateChanged: function() {
-    debug("Card state changed, updating UICC presence.");
-    this._updatePresenceState();
-  },
-
-  /**
-   * nsIObserver interface methods.
-   */
-
-  observe: function(subject, topic, data) {
-    if (topic === NS_XPCOM_SHUTDOWN_OBSERVER_ID) {
-      this._shutdown();
-    }
-  }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UiccConnector]);
deleted file mode 100644
--- a/dom/secureelement/gonk/UiccConnector.manifest
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2012 Mozilla Foundation and Mozilla contributors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# UiccConnector
-component {8e040e5d-c8c3-4c1b-ac82-c00d25d8c4a4} UiccConnector.js
-contract @mozilla.org/secureelement/connector/uicc;1 {8e040e5d-c8c3-4c1b-ac82-c00d25d8c4a4}
deleted file mode 100644
--- a/dom/secureelement/gonk/gp_consts.js
+++ /dev/null
@@ -1,62 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-/* Object Directory File (ODF) is an elementary file which contain
-   pointers to other EFs. It is specified in PKCS#15 section 6.7. */
-this.ODF_DF = [0x50, 0x31];
-
-/* ISO 7816-4: secure messaging */
-this.CLA_SM = 0x00;
-
-/* ISO 7816-4, 5.4.1 table 11 */
-this.INS_SF = 0xA4; // select file
-this.INS_GR = 0xC0; // get response
-this.INS_RB = 0xB0; // read binary
-
-/* ISO 7816-4: select file, see 6.11.3, table 58 & 59 */
-this.P1_SF_DF = 0x00; // select DF
-this.P2_SF_FCP = 0x04; // return FCP
-
-/* ISO 7816-4: read binary, 6.1.3. P1 and P2 describe offset of the first byte
-   to be read. We always read the whole files at the moment. */
-this.P1_RB = 0x00;
-this.P2_RB = 0x00;
-
-/* ISO 7816-4: get response, 7.1.3 table 74,  P1-P2 '0000' (other values RFU) */
-this.P1_GR = 0x00;
-this.P2_GR = 0x00;
-
-/* ISO 7816-4: 5.1.5 File Control Information, Table 1. For FCP and FMD. */
-this.TAG_PROPRIETARY = 0x00;
-this.TAG_NON_TLV = 0x53;
-this.TAG_BER_TLV = 0x73;
-
-/* ASN.1 tags */
-this.TAG_SEQUENCE = 0x30;
-this.TAG_OCTETSTRING = 0x04;
-this.TAG_OID = 0x06; // Object Identifier
-
-/* ISO 7816-4: 5.1.5 File Control Information, Templates. */
-this.TAG_FCP = 0x62; // File control parameters template
-this.TAG_FMD = 0x64; // File management data template
-this.TAG_FCI = 0x6F; // File control information template
-
-/* EF_DIR tags */
-this.TAG_APPLTEMPLATE = 0x61;
-this.TAG_APPLIDENTIFIER = 0x4F;
-this.TAG_APPLLABEL = 0x50;
-this.TAG_APPLPATH = 0x51;
-
-this.TAG_GPD_ALL = 0x82; // EF-ACRules - GPD spec. "all applets"
-
-/* Generic TLVs that are parsed */
-this.TAG_GPD_AID = 0xA0; // AID in the EF-ACRules - GPD spec, "one applet"
-this.TAG_EXTERNALDO = 0xA1; // External data objects - PKCS#15
-this.TAG_INDIRECT = 0xA5; // Indirect value.
-this.TAG_EF_ODF = 0xA7; // Elemenetary File Object Directory File
-
-// Allow this file to be imported via Components.utils.import().
-this.EXPORTED_SYMBOLS = Object.keys(this);
deleted file mode 100644
--- a/dom/secureelement/gonk/nsIAccessControlEnforcer.idl
+++ /dev/null
@@ -1,32 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-#include "nsISupports.idl"
-
-interface nsIVariant;
-
-[scriptable, uuid(4994a960-26d9-4d71-82dd-4505bd97bf2a)]
-interface nsIAccessControlEnforcer : nsISupports
-{
-  /**
-   * Determines whether application identified by its ID should be allowed
-   * to access Secure Element's applet identified by its AID. Decision
-   * is made according to the GPD specification.
-   *
-   * @param  localId
-   *         ID of an application accessing SE
-   * @param  seType
-   *         Type of the SE.
-   * @param  aid
-   *         AID of a SE applet
-   * @return Promise which is resolved to true if access should be allowed,
-   *         false otherwise, and rejected if the application contains
-   *         no developer certificate.
-   */
-  jsval isAccessAllowed(in unsigned long localId,
-                        in DOMString seType,
-                        in DOMString aid);
-};
deleted file mode 100644
--- a/dom/secureelement/gonk/nsIAccessRulesManager.idl
+++ /dev/null
@@ -1,50 +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/. */
-
-/* Copyright © 2015, Deutsche Telekom, Inc. */
-
-#include "nsISupports.idl"
-
-[scriptable, uuid(7baedd2a-3189-4b03-b2a3-34016043b5e2)]
-interface nsIAccessRulesManager : nsISupports
-{
-  /* Wildcard: rule allows all applications to access an SE applet */
-  const unsigned short ALLOW_ALL = 1;
-  /* Wildcard: rule denies all applications to access an SE applet */
-  const unsigned short DENY_ALL = 2;
-  /* Wildcard: rule allows application(s) access to all SE applets */
-  const unsigned short ALL_APPLET = 3;
-
-  /**
-   * Initiates Access Rules Manager, this should perform the initial
-   * reading of rules from access rule source
-   * @return Promise which is resolved if init is successful or rejected
-   *         otherwise
-   */
-  jsval init();
-
-  /**
-   * Retrieves all access rules.
-   *
-   * Rules are stored in an array. Each rule contains the following properties:
-   *  - applet - describes an SE applet referenced by this rule. Might equal
-   *             to an applet AID (as a byte array), or to a wildcard "all"
-   *             meaning all applets.
-   *  - application - describes an application referenced by this rule. Might
-   *                  be an array of developer certificate hashes (each as
-   *                  a byte array) in which case it lists all applications
-   *                  allowed access. Alternatively, might equal to wildcard
-   *                  "allowed-all" or "denied-all".
-   *
-   * Example rule format:
-   *   [{ applet: ALL_APPLET,
-   *      application: [[0x01, 0x02, ..., 0x20],
-   *                    [0x20, 0x19, ...., 0x01]],
-   *    { applet: [0x00, 0x01, ..., 0x05],
-   *      application: ALLOW_ALL}}]
-   *
-   * @return Promise which resolves with Array containing parsed access rules
-   */
-  jsval getAccessRules();
-};
deleted file mode 100644
--- a/dom/secureelement/gonk/nsISecureElementConnector.idl
+++ /dev/null
@@ -1,124 +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"
-
-[scriptable, uuid(1ff3f35a-1b6f-4e65-a89e-a363b8604cd7)]
-interface nsISEChannelCallback : nsISupports
-{
-  /**
-   * Callback function to notify on successfully opening a logical channel.
-   *
-   * @param channel
-   *        The Channel Number/Handle that is successfully opened.
-   * @param openResponse
-   *        Response from SE for OpenChannel operation.
-   */
-  void notifyOpenChannelSuccess(in long channel, in DOMString openResponse);
-
-  /**
-   * Callback function to notify on successfully closing the logical channel.
-   *
-   */
-  void notifyCloseChannelSuccess();
-
-  /**
-   * Callback function to notify the status of 'seExchangeAPDU' command.
-   *
-   * @param sw1
-   *        Response's First Status Byte
-   * @param sw2
-   *        Response's Second Status Byte
-   * @param data
-   *        Response's data
-   */
-  void notifyExchangeAPDUResponse(in octet sw1,
-                                  in octet sw2,
-                                  in DOMString data);
-
-  /**
-   * Callback function to notify error
-   *
-   * @param error
-   *        Error describing the reason for failure.
-   */
-  void notifyError(in DOMString error);
-};
-
-[scriptable, uuid(417f59ee-f582-45b9-9a4e-e9dcefecb4f7)]
-interface nsISEListener : nsISupports
-{
-  void notifySEPresenceChanged(in DOMString seType, in boolean isPresent);
-};
-
-[scriptable, uuid(3cef313a-1d01-432d-9cd2-6610a80911f3)]
-interface nsISecureElementConnector : nsISupports
-{
-   /**
-    * Open a logical communication channel with the specific secure element type
-    *
-    * @param aid
-    *        Application Identifier of the Card Applet on the secure element.
-    * @param callback
-    *        callback to notify the result of the operation.
-    */
-    void openChannel(in DOMString aid,
-                     in nsISEChannelCallback callback);
-
-   /**
-    * Exchanges APDU channel with the specific secure element type
-    *
-    * @param channel
-    *        Channel on which C-APDU to be transmitted.
-    * @param cla
-             Class Byte.
-    * @param ins
-             Instruction Byte
-    * @param p1
-             Reference parameter first byte
-    * @param p2
-             Reference parameter second byte
-    *        Refer to 3G TS 31.101 , 10.2 'Command APDU Structure' for all the cases.
-    * @param data
-             Sequence of C-APDU data octets
-    * @param le [optional]
-    *        le is the length of expected response. If the response is not expected,
-             it should be explicitly set to -1.
-    * @param callback
-    *        callback to notify the result of the operation.
-    */
-    void exchangeAPDU(in long channel,
-                      in octet cla,
-                      in octet ins,
-                      in octet p1,
-                      in octet p2,
-                      in DOMString data,
-                      in short le,
-                      in nsISEChannelCallback callback);
-
-   /**
-    * Closes the logical communication channel to the specific secure element type
-    *
-    * @param channel
-    *        Channel to be closed.
-    * @param callback
-    *        callback to notify the result of the operation.
-    */
-   void closeChannel(in long channel,
-                     in nsISEChannelCallback callback);
-
-   /**
-    * Register a Secure Element listener
-    *
-    * @param listener
-    */
-   void registerListener(in nsISEListener listener);
-
-   /**
-    * Unregister a Secure Element listener
-    *
-    * @param listener
-    */
-   void unregisterListener(in nsISEListener listener);
-};
deleted file mode 100644
--- a/dom/secureelement/gonk/se_consts.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright 2012 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Copyright © 2014, Deutsche Telekom, Inc. */
-
-// Set to true to debug SecureElement (SE) stack
-this.DEBUG_ALL = false;
-
-// Set individually to debug specific layers
-this.DEBUG_CONNECTOR = DEBUG_ALL || false;
-this.DEBUG_ACE = DEBUG_ALL || false ;
-this.DEBUG_SE = DEBUG_ALL || false ;
-
-// Maximun logical channels per session.
-// For 'uicc' SE type this value is 3, as opening a basic channel' : 0
-// is not allowed for security reasons. In such scenarios, possible
-// supplementary logical channels available are : [1, 2, or 3].
-// However,Other SE types may support upto max 4 (including '0').
-this.MAX_CHANNELS_ALLOWED_PER_SESSION = 4;
-
-this.BASIC_CHANNEL = 0;
-
-// According GPCardSpec 2.2
-this.MAX_APDU_LEN = 255; // including APDU header
-
-// CLA (1 byte) + INS (1 byte) + P1 (1 byte) + P2 (1 byte)
-this.APDU_HEADER_LEN = 4;
-
-this.LOGICAL_CHANNEL_NUMBER_LIMIT = 4;
-this.SUPPLEMENTARY_LOGICAL_CHANNEL_NUMBER_LIMIT = 20;
-
-this.MIN_AID_LEN = 5;
-this.MAX_AID_LEN = 16;
-
-this.CLA_GET_RESPONSE = 0x00;
-
-this.INS_SELECT = 0xA4;
-this.INS_MANAGE_CHANNEL = 0x70;
-this.INS_GET_RESPONSE = 0xC0;
-
-// Match the following errors with SecureElement.webidl's SEError enum values
-this.ERROR_NONE               = "";
-this.ERROR_SECURITY           = "SESecurityError";
-this.ERROR_IO                 = "SEIoError";
-this.ERROR_BADSTATE           = "SEBadStateError";
-this.ERROR_INVALIDCHANNEL     = "SEInvalidChannelError";
-this.ERROR_INVALIDAPPLICATION = "SEInvalidApplicationError";
-this.ERROR_GENERIC            = "SEGenericError";
-this.ERROR_NOTPRESENT         = "SENotPresentError";
-this.ERROR_ILLEGALPARAMETER   = "SEIllegalParameterError";
-
-this.TYPE_UICC = "uicc";
-this.TYPE_ESE = "eSE";
-
-// Allow this file to be imported via Components.utils.import().
-this.EXPORTED_SYMBOLS = Object.keys(this);
deleted file mode 100644
--- a/dom/secureelement/tests/unit/header_helper.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Strips spaces, and returns a byte array.
- */
-function formatHexAndCreateByteArray(hexStr) {
-  return SEUtils.hexStringToByteArray(hexStr.replace(/\s+/g, ""));
-}
deleted file mode 100644
--- a/dom/secureelement/tests/unit/test_SEUtils.js
+++ /dev/null
@@ -1,228 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* globals run_next_test, add_test, ok, Components, SEUtils */
-/* exported run_test */
-
-Components.utils.import("resource://gre/modules/SEUtils.jsm");
-var GP = {};
-Components.utils.import("resource://gre/modules/gp_consts.js", GP);
-
-const VALID_HEX_STR = "0123456789ABCDEF";
-const VALID_BYTE_ARR = [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF];
-
-// This set should be what the actual ACE uses.
-var containerTags = [
-  GP.TAG_SEQUENCE,
-  GP.TAG_FCP,
-  GP.TAG_GPD_AID,
-  GP.TAG_EXTERNALDO,
-  GP.TAG_INDIRECT,
-  GP.TAG_EF_ODF
-];
-
-function run_test() {
-  ok(!!SEUtils, "SEUtils should be available");
-  run_next_test();
-}
-
-add_test(function test_byteArrayToHexString() {
-  let hexStr = SEUtils.byteArrayToHexString(VALID_BYTE_ARR);
-  ok(hexStr === VALID_HEX_STR,
-     "should convert byte Array to uppercased hex string");
-
-  [[], null, undefined].forEach((input) => {
-    hexStr = SEUtils.byteArrayToHexString(input);
-    ok(hexStr === "", "invalid arg:" + input + " should return empty string");
-  });
-
-  run_next_test();
-});
-
-add_test(function test_hexStringToByteArray() {
-  let byteArr = SEUtils.hexStringToByteArray(VALID_HEX_STR);
-  ok(SEUtils.arraysEqual(byteArr, VALID_BYTE_ARR),
-     "should convert uppercased string to byte Array");
-
-  byteArr = SEUtils.hexStringToByteArray(VALID_HEX_STR.toLowerCase());
-  ok(SEUtils.arraysEqual(byteArr, VALID_BYTE_ARR),
-     "should convert lowercased string to byte Array");
-
-  ["", null, undefined, "123"].forEach((input) => {
-    byteArr = SEUtils.hexStringToByteArray(input);
-    ok(Array.isArray(byteArr) && byteArr.length === 0,
-       "invalid arg: " + input + " should be empty Array");
-  });
-
-  run_next_test();
-});
-
-add_test(function test_arraysEqual() {
-  ok(SEUtils.arraysEqual([1, 2, 3], [1, 2, 3]),
-     "should return true on equal Arrays");
-
-  [[1], [1, 2, 4], [3, 2, 1]].forEach((input) => {
-    ok(!SEUtils.arraysEqual([1, 2, 3], input),
-       "should return false when Arrays not equal");
-  });
-
-  [null, undefined].forEach((input) => {
-    ok(!SEUtils.arraysEqual([1, 2, 3], input),
-       "should return false when comparing Array with invalid argument");
-
-    ok(!SEUtils.arraysEqual(input, input),
-       "should return false when both args are invalid");
-  });
-
-  run_next_test();
-});
-
-add_test(function test_ensureIsArray() {
-  let obj = {a: "a"};
-  let targetArray = [obj];
-  let result = null;
-
-  result = SEUtils.ensureIsArray(obj);
-  ok(targetArray[0].a === result[0].a,
-     "should return true if array element contains the same value");
-  deepEqual(result, targetArray,
-            "result should be deeply equal to targetArray");
-
-  result = SEUtils.ensureIsArray(targetArray);
-  deepEqual(result, targetArray,
-            "ensureIsAray with an array should return same array value.");
-
-  run_next_test();
-});
-
-add_test(function test_parseTLV_empty() {
-  let containerTags = [];
-  let result = null;
-
-  // Base:
-  result = SEUtils.parseTLV([], []);
-  deepEqual({}, result,
-     "empty parse input should result in an " +
-     "empty object (internal SEUtils format only).");
-  run_next_test();
-});
-
-add_test(function test_parseTLV_selectResponse() {
-  let result = null;
-  let hexStr = "62 27 82 02 78 21 83 02 7F 50 A5 06 83 04 00 04 C1 DC 8A" +
-               "01 05 8B 06 2F 06 01 16 00 14 C6 06 90 01 00 83 01 01 81" +
-               "02 FF FF";
-
-  let expected = {
-    0x62: {
-      0x82: [0x78, 0x21],
-      0x83: [0x7F, 0x50],
-      0xA5: {
-        0x83: [0x00, 0x04, 0xC1, 0xDC]
-      },
-      0x8A: [0x05],
-      0x8B: [0x2F, 0x06, 0x01, 0x16, 0x00, 0x14],
-      0xC6: [0x90, 0x01, 0x00, 0x83, 0x01, 0x01],
-      0x81: [0xFF, 0xFF]
-    }
-  };
-
-  result = SEUtils.parseTLV(formatHexAndCreateByteArray(hexStr), containerTags);
-  deepEqual(result, expected,
-            "parsed real selectResponse should equal the expected rules");
-  run_next_test();
-});
-
-add_test(function test_parseTLV_DODF() {
-  let result = null;
-  let hexStr = "A1 29 30 00 30 0F 0C 0D 47 50 20 53 45 20 41 63 63 20 43" +
-               "74 6C A1 14 30 12 06 0A 2A 86 48 86 FC 6B 81 48 01 01 30" +
-               "04 04 02 43 00 A1 2B 30 00 30 0F 0C 0D 53 41 54 53 41 20" +
-               "47 54 4F 20 31 2E 31 A1 16 30 14 06 0C 2B 06 01 04 01 2A" +
-               "02 6E 03 01 01 01 30 04 04 02 45 31 FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF";
-
-  let expected = {
-    0xA1: [
-      {
-        0x30: [
-          {},
-          {
-            0x0C: [0x47, 0x50, 0x20, 0x53, 0x45, 0x20, 0x41, 0x63, 0x63,
-                   0x20, 0x43, 0x74, 0x6C]
-          }
-        ],
-        0xA1: {
-          0x30: {
-            0x06: [0x2A, 0x86, 0x48, 0x86, 0xFC, 0x6B, 0x81, 0x48, 0x01,
-                   0x01],
-            0x30: {
-              0x04: [0x43, 0x00]
-            }
-          }
-        }
-      },
-      {
-        0x30: [
-          {},
-          {
-            0x0C: [0x53, 0x41, 0x54, 0x53, 0x41, 0x20, 0x47, 0x54, 0x4F,
-                   0x20, 0x31, 0x2E, 0x31]
-          }
-        ],
-        0xA1: {
-          0x30: {
-            0x06: [0x2B, 0x06, 0x01, 0x04, 0x01, 0x2A, 0x02, 0x6E, 0x03,
-                   0x01, 0x01, 0x01],
-            0x30: {
-              0x04: [0x45, 0x31]
-            }
-          }
-        }
-      }
-    ]
-  };
-
-  result = SEUtils.parseTLV(formatHexAndCreateByteArray(hexStr), containerTags);
-  deepEqual(result, expected,
-            "Real Access Control Enforcer DODF file, with 0xFF padding. " +
-            "Should equal expected rules.");
-  run_next_test();
-});
-
-add_test(function test_parseTLV_acRules() {
-  let result = null;
-  let hexStr = "30 08 82 00 30 04 04 02 43 11 FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" +
-               "FF FF FF FF FF FF FF FF FF";
-
-  let expected = {
-    0x30: {
-      0x82: [],
-      0x30: {
-        0x04: [0x43, 0x11]
-      }
-    }
-  };
-
-  result = SEUtils.parseTLV(formatHexAndCreateByteArray(hexStr), containerTags);
-  deepEqual(result, expected,
-            "Parsed Access Control Rules should equal the expected rules");
-  run_next_test();
-});
deleted file mode 100644
--- a/dom/secureelement/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[DEFAULT]
-head = header_helper.js
-
-[test_SEUtils.js]
deleted file mode 100644
--- a/dom/system/gonk/AudioChannelManager.cpp
+++ /dev/null
@@ -1,181 +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 "nsIDocument.h"
-#include "nsIDOMClassInfo.h"
-#include "nsIDOMEvent.h"
-#include "nsIDOMEventListener.h"
-#include "nsPIDOMWindow.h"
-#include "nsIDocShell.h"
-#include "nsIPermissionManager.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "AudioChannelManager.h"
-#include "mozilla/dom/AudioChannelManagerBinding.h"
-#include "mozilla/dom/nsBrowserElement.h"
-#include "mozilla/Services.h"
-
-namespace mozilla {
-namespace dom {
-namespace system {
-
-NS_IMPL_QUERY_INTERFACE_INHERITED(AudioChannelManager, DOMEventTargetHelper,
-                                  nsIDOMEventListener)
-NS_IMPL_ADDREF_INHERITED(AudioChannelManager, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(AudioChannelManager, DOMEventTargetHelper)
-
-AudioChannelManager::AudioChannelManager()
-  : mVolumeChannel(-1)
-{
-  hal::RegisterSwitchObserver(hal::SWITCH_HEADPHONES, this);
-}
-
-AudioChannelManager::~AudioChannelManager()
-{
-  hal::UnregisterSwitchObserver(hal::SWITCH_HEADPHONES, this);
-
-  nsCOMPtr<EventTarget> target = do_QueryInterface(GetOwner());
-  NS_ENSURE_TRUE_VOID(target);
-
-  target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
-                                    this,
-                                    /* useCapture = */ true);
-}
-
-void
-AudioChannelManager::Init(nsPIDOMWindowInner* aWindow)
-{
-  BindToOwner(aWindow);
-
-  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
-  NS_ENSURE_TRUE_VOID(target);
-
-  target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
-                                 this,
-                                 /* useCapture = */ true,
-                                 /* wantsUntrusted = */ false);
-}
-
-JSObject*
-AudioChannelManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return AudioChannelManagerBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-AudioChannelManager::Notify(const hal::SwitchEvent& aEvent)
-{
-  mState = Some(aEvent.status());
-
-  DispatchTrustedEvent(NS_LITERAL_STRING("headphoneschange"));
-}
-
-bool
-AudioChannelManager::SetVolumeControlChannel(const nsAString& aChannel)
-{
-  if (aChannel.EqualsASCII("publicnotification")) {
-    return false;
-  }
-
-  AudioChannel newChannel = AudioChannelService::GetAudioChannel(aChannel);
-
-  // Only normal channel doesn't need permission.
-  if (newChannel != AudioChannel::Normal) {
-    nsCOMPtr<nsIPermissionManager> permissionManager =
-      services::GetPermissionManager();
-    if (!permissionManager) {
-      return false;
-    }
-    uint32_t perm = nsIPermissionManager::UNKNOWN_ACTION;
-    permissionManager->TestPermissionFromWindow(GetOwner(),
-      nsCString(NS_LITERAL_CSTRING("audio-channel-") +
-      NS_ConvertUTF16toUTF8(aChannel)).get(), &perm);
-    if (perm != nsIPermissionManager::ALLOW_ACTION) {
-      return false;
-    }
-  }
-
-  if (mVolumeChannel == (int32_t)newChannel) {
-    return true;
-  }
-
-  mVolumeChannel = (int32_t)newChannel;
-
-  NotifyVolumeControlChannelChanged();
-  return true;
-}
-
-bool
-AudioChannelManager::GetVolumeControlChannel(nsAString & aChannel)
-{
-  if (mVolumeChannel >= 0) {
-    AudioChannelService::GetAudioChannelString(
-                                      static_cast<AudioChannel>(mVolumeChannel),
-                                      aChannel);
-  } else {
-    aChannel.AssignASCII("");
-  }
-
-  return true;
-}
-
-void
-AudioChannelManager::NotifyVolumeControlChannelChanged()
-{
-  nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
-  NS_ENSURE_TRUE_VOID(docshell);
-
-  bool isActive = false;
-  docshell->GetIsActive(&isActive);
-
-  RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
-  if (!service) {
-    return;
-  }
-
-  if (isActive) {
-    service->SetDefaultVolumeControlChannel(mVolumeChannel, isActive);
-  } else {
-    service->SetDefaultVolumeControlChannel(-1, isActive);
-  }
-}
-
-NS_IMETHODIMP
-AudioChannelManager::HandleEvent(nsIDOMEvent* aEvent)
-{
-  nsAutoString type;
-  aEvent->GetType(type);
-
-  if (type.EqualsLiteral("visibilitychange")) {
-    NotifyVolumeControlChannelChanged();
-  }
-  return NS_OK;
-}
-
-void
-AudioChannelManager::GetAllowedAudioChannels(
-                 nsTArray<RefPtr<BrowserElementAudioChannel>>& aAudioChannels,
-                 ErrorResult& aRv)
-{
-  MOZ_ASSERT(aAudioChannels.IsEmpty());
-
-  // Only main process is supported.
-  if (XRE_GetProcessType() != GeckoProcessType_Default) {