Bug 1284535 - Remove dependencies to the mozApps-related APIs from the audio channel code r=gsvelto
authorGabriele Svelto <gsvelto@mozilla.com>
Thu, 14 Apr 2016 15:19:41 +0200
changeset 343867 04420d139399af4028668203fbb4f0bcaf121411
parent 343866 f564cb1eb300136eb6f6dfe70b924d99b668da34
child 343868 d7f98208809f14e30b5c560b8f372f1d8585dd99
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1284535
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1284535 - Remove dependencies to the mozApps-related APIs from the audio channel code r=gsvelto MozReview-Commit-ID: 9XKMKBkvlfR
dom/audiochannel/AudioChannelAgent.cpp
dom/browser-element/BrowserElementAudioChannel.cpp
dom/browser-element/BrowserElementAudioChannel.h
dom/browser-element/BrowserElementParent.js
dom/browser-element/mochitest/browserElement_ActiveStateChange.js
dom/browser-element/mochitest/browserElement_AudioChannel.js
dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
dom/browser-element/mochitest/browserElement_AudioPlayback.js
dom/browser-element/mochitest/browserElement_MultipleAudioChannels.js
dom/browser-element/mochitest/browserElement_NoAudioTrack.js
dom/browser-element/mochitest/browserElement_NotifyChannel.js
dom/browser-element/mochitest/chrome.ini
dom/browser-element/mochitest/file_browserElement_NotifyChannel.html
dom/browser-element/mochitest/manifest.webapp
dom/browser-element/mochitest/manifest.webapp^headers^
dom/browser-element/mochitest/test_browserElement_NotifyChannel.html
dom/browser-element/nsIBrowserElementAPI.idl
dom/html/nsBrowserElement.cpp
dom/html/nsBrowserElement.h
dom/system/gonk/AudioChannelManager.cpp
dom/webidl/BrowserElementAudioChannel.webidl
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -2,22 +2,21 @@
 /* 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 "AudioChannelAgent.h"
 #include "AudioChannelService.h"
 #include "mozilla/Preferences.h"
-#include "nsIAppsService.h"
+#include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsIDOMWindow.h"
-#include "nsIPrincipal.h"
 #include "nsPIDOMWindow.h"
-#include "nsXULAppAPI.h"
+#include "nsIURI.h"
 
 using namespace mozilla::dom;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(AudioChannelAgent)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioChannelAgent)
   tmp->Shutdown();
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
@@ -107,48 +106,37 @@ AudioChannelAgent::FindCorrectWindow(nsP
     return NS_OK;
   }
 
   nsCOMPtr<nsIDocument> doc = parent->GetExtantDoc();
   if (!doc) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
-
-  uint32_t appId;
-  nsresult rv = principal->GetAppId(&appId);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
+  if (nsContentUtils::IsChromeDoc(doc)) {
+    return NS_OK;
   }
 
-  if (appId == nsIScriptSecurityManager::NO_APP_ID ||
-      appId == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
+  nsAdoptingCString systemAppUrl =
+    mozilla::Preferences::GetCString("b2g.system_startup_url");
+  if (!systemAppUrl) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
-  if (NS_WARN_IF(!appsService)) {
-    return NS_ERROR_FAILURE;
-  }
+  nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
+  nsCOMPtr<nsIURI> uri;
+  principal->GetURI(getter_AddRefs(uri));
 
-  nsAdoptingString systemAppManifest =
-    mozilla::Preferences::GetString("b2g.system_manifest_url");
-  if (!systemAppManifest) {
-    return NS_OK;
-  }
+  if (uri) {
+    nsAutoCString spec;
+    uri->GetSpec(spec);
 
-  uint32_t systemAppId;
-  rv = appsService->GetAppLocalIdByManifestURL(systemAppManifest, &systemAppId);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  if (systemAppId == appId) {
-    return NS_OK;
+    if (spec.Equals(systemAppUrl)) {
+      return NS_OK;
+    }
   }
 
   return FindCorrectWindow(parent);
 }
 
 nsresult
 AudioChannelAgent::InitInternal(nsPIDOMWindowInner* aWindow,
                                 int32_t aChannelType,
--- a/dom/browser-element/BrowserElementAudioChannel.cpp
+++ b/dom/browser-element/BrowserElementAudioChannel.cpp
@@ -5,35 +5,26 @@
 #include "BrowserElementAudioChannel.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/BrowserElementAudioChannelBinding.h"
 #include "mozilla/dom/DOMRequest.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/TabParent.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "AudioChannelService.h"
-#include "nsIAppsService.h"
+#include "nsContentUtils.h"
 #include "nsIBrowserElementAPI.h"
 #include "nsIDocShell.h"
-#include "nsIDOMDocument.h"
 #include "nsIDOMDOMRequest.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
-#ifdef MOZ_B2G
-#include "nsISystemMessagesInternal.h"
-#endif
 #include "nsITabParent.h"
-#include "nsNetUtil.h"
 #include "nsPIDOMWindow.h"
-#include "nsServiceManagerUtils.h"
-#include "nsContentUtils.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ADDREF_INHERITED(BrowserElementAudioChannel, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(BrowserElementAudioChannel, DOMEventTargetHelper)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BrowserElementAudioChannel)
@@ -48,22 +39,20 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(Brows
                                    mTabParent,
                                    mBrowserElementAPI)
 
 /* static */ already_AddRefed<BrowserElementAudioChannel>
 BrowserElementAudioChannel::Create(nsPIDOMWindowInner* aWindow,
                                    nsIFrameLoader* aFrameLoader,
                                    nsIBrowserElementAPI* aAPI,
                                    AudioChannel aAudioChannel,
-                                   const nsAString& aManifestURL,
                                    ErrorResult& aRv)
 {
   RefPtr<BrowserElementAudioChannel> ac =
-    new BrowserElementAudioChannel(aWindow, aFrameLoader, aAPI,
-                                   aAudioChannel, aManifestURL);
+    new BrowserElementAudioChannel(aWindow, aFrameLoader, aAPI, aAudioChannel);
 
   aRv = ac->Initialize();
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
   MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
          ("BrowserElementAudioChannel, Create, channel = %p, type = %d\n",
@@ -71,23 +60,21 @@ BrowserElementAudioChannel::Create(nsPID
 
   return ac.forget();
 }
 
 BrowserElementAudioChannel::BrowserElementAudioChannel(
 						nsPIDOMWindowInner* aWindow,
 						nsIFrameLoader* aFrameLoader,
                                                 nsIBrowserElementAPI* aAPI,
-                                                AudioChannel aAudioChannel,
-                                                const nsAString& aManifestURL)
+                                                AudioChannel aAudioChannel)
   : DOMEventTargetHelper(aWindow)
   , mFrameLoader(aFrameLoader)
   , mBrowserElementAPI(aAPI)
   , mAudioChannel(aAudioChannel)
-  , mManifestURL(aManifestURL)
   , mState(eStateUnknown)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
     nsAutoString name;
     AudioChannelService::GetAudioChannelString(aAudioChannel, name);
@@ -312,53 +299,16 @@ public:
 protected:
   virtual void DoWork(AudioChannelService* aService, JSContext* aCx) override
   {
     JS::Rooted<JS::Value> value(aCx);
     mRequest->FireSuccess(value);
   }
 };
 
-class RespondSuccessHandler final : public PromiseNativeHandler
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  explicit RespondSuccessHandler(DOMRequest* aRequest)
-    : mDomRequest(aRequest)
-  {};
-
-  virtual void
-  ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
-
-  virtual void
-  RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
-
-private:
-  ~RespondSuccessHandler() {};
-
-  RefPtr<DOMRequest> mDomRequest;
-};
-NS_IMPL_ISUPPORTS0(RespondSuccessHandler);
-
-void
-RespondSuccessHandler::ResolvedCallback(JSContext* aCx,
-                                        JS::Handle<JS::Value> aValue)
-{
-  JS::Rooted<JS::Value> value(aCx);
-  mDomRequest->FireSuccess(value);
-}
-
-void
-RespondSuccessHandler::RejectedCallback(JSContext* aCx,
-                                        JS::Handle<JS::Value> aValue)
-{
-  mDomRequest->FireError(NS_ERROR_FAILURE);
-}
-
 } // anonymous namespace
 
 already_AddRefed<dom::DOMRequest>
 BrowserElementAudioChannel::GetVolume(ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!mFrameWindow) {
@@ -501,72 +451,16 @@ BrowserElementAudioChannel::IsActive(Err
 
   nsCOMPtr<nsIRunnable> runnable =
     new IsActiveRunnable(GetOwner(), mFrameWindow, domRequest, mAudioChannel);
   NS_DispatchToMainThread(runnable);
 
   return domRequest.forget();
 }
 
-already_AddRefed<dom::DOMRequest>
-BrowserElementAudioChannel::NotifyChannel(const nsAString& aEvent,
-                                          ErrorResult& aRv)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(XRE_IsParentProcess());
-
-  if (!mFrameWindow) {
-    nsCOMPtr<nsIDOMDOMRequest> request;
-    aRv = mBrowserElementAPI->NotifyChannel(aEvent, mManifestURL,
-                                            (uint32_t)mAudioChannel,
-                                            getter_AddRefs(request));
-    if (NS_WARN_IF(aRv.Failed())) {
-      return nullptr;
-    }
-
-    return request.forget().downcast<DOMRequest>();
-  }
-
-// TODO: We need this until bug 1254282 reaches m-c
-#ifdef MOZ_B2G
-  nsCOMPtr<nsISystemMessagesInternal> systemMessenger =
-    do_GetService("@mozilla.org/system-message-internal;1");
-  MOZ_ASSERT(systemMessenger);
-
-  JS::Rooted<JS::Value> value(nsContentUtils::RootingCxForThread());
-  value.setInt32((uint32_t)mAudioChannel);
-
-  nsCOMPtr<nsIURI> manifestURI;
-  nsresult rv = NS_NewURI(getter_AddRefs(manifestURI), mManifestURL);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return nullptr;
-  }
-
-  // Since the pageURI of the app has been registered to the system messager,
-  // when the app was installed. The system messager can only use the manifest
-  // to send the message to correct page.
-  nsCOMPtr<nsISupports> promise;
-  rv = systemMessenger->SendMessage(aEvent, value, nullptr, manifestURI,
-                                    JS::UndefinedHandleValue,
-                                    getter_AddRefs(promise));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return nullptr;
-  }
-
-  RefPtr<Promise> promiseIns = static_cast<Promise*>(promise.get());
-  RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-  RefPtr<RespondSuccessHandler> handler = new RespondSuccessHandler(request);
-  promiseIns->AppendNativeHandler(handler);
-#else
-  RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-#endif
-
-  return request.forget();
-}
-
 NS_IMETHODIMP
 BrowserElementAudioChannel::Observe(nsISupports* aSubject, const char* aTopic,
                                     const char16_t* aData)
 {
   nsAutoString name;
   AudioChannelService::GetAudioChannelString(mAudioChannel, name);
 
   nsAutoCString topic;
@@ -630,44 +524,37 @@ BrowserElementAudioChannel::ProcessState
 bool
 BrowserElementAudioChannel::IsSystemAppWindow(nsPIDOMWindowOuter* aWindow) const
 {
   nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
   if (!doc) {
     return false;
   }
 
-  uint32_t appId;
-  nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
-  nsresult rv = principal->GetAppId(&appId);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return false;
+  if (nsContentUtils::IsChromeDoc(doc)) {
+    return true;
   }
 
-  if (appId == nsIScriptSecurityManager::NO_APP_ID ||
-      appId == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
+  nsAdoptingCString systemAppUrl =
+    mozilla::Preferences::GetCString("b2g.system_startup_url");
+  if (!systemAppUrl) {
     return false;
   }
 
-  nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
-  if (NS_WARN_IF(!appsService)) {
-    return false;
-  }
+  nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
+  nsCOMPtr<nsIURI> uri;
+  principal->GetURI(getter_AddRefs(uri));
 
-  nsAdoptingString systemAppManifest =
-    mozilla::Preferences::GetString("b2g.system_manifest_url");
-  if (!systemAppManifest) {
-    return false;
-  }
+  if (uri) {
+    nsAutoCString spec;
+    uri->GetSpec(spec);
 
-  uint32_t systemAppId;
-  appsService->GetAppLocalIdByManifestURL(systemAppManifest, &systemAppId);
-
-  if (systemAppId == appId) {
-    return true;
+    if (spec.Equals(systemAppUrl)) {
+      return true;
+    }
   }
 
   return false;
 }
 
 nsresult
 BrowserElementAudioChannel::IsFromNestedFrame(nsISupports* aSubject,
                                               bool& aIsNested) const
--- a/dom/browser-element/BrowserElementAudioChannel.h
+++ b/dom/browser-element/BrowserElementAudioChannel.h
@@ -35,17 +35,16 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BrowserElementAudioChannel,
                                            DOMEventTargetHelper)
 
   static already_AddRefed<BrowserElementAudioChannel>
   Create(nsPIDOMWindowInner* aWindow,
          nsIFrameLoader* aFrameLoader,
          nsIBrowserElementAPI* aAPI,
          AudioChannel aAudioChannel,
-         const nsAString& aManifestURL,
          ErrorResult& aRv);
 
   // WebIDL methods
 
   virtual JSObject* WrapObject(JSContext *aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
 
   AudioChannel Name() const;
@@ -53,27 +52,23 @@ public:
   already_AddRefed<dom::DOMRequest> GetVolume(ErrorResult& aRv);
   already_AddRefed<dom::DOMRequest> SetVolume(float aVolume, ErrorResult& aRv);
 
   already_AddRefed<dom::DOMRequest> GetMuted(ErrorResult& aRv);
   already_AddRefed<dom::DOMRequest> SetMuted(bool aMuted, ErrorResult& aRv);
 
   already_AddRefed<dom::DOMRequest> IsActive(ErrorResult& aRv);
 
-  already_AddRefed<dom::DOMRequest> NotifyChannel(const nsAString& aEvent,
-                                                  ErrorResult& aRv);
-
   IMPL_EVENT_HANDLER(activestatechanged);
 
 private:
   BrowserElementAudioChannel(nsPIDOMWindowInner* aWindow,
                              nsIFrameLoader* aFrameLoader,
                              nsIBrowserElementAPI* aAPI,
-                             AudioChannel aAudioChannel,
-                             const nsAString& aManifestURL);
+                             AudioChannel aAudioChannel);
 
   bool IsSystemAppWindow(nsPIDOMWindowOuter* aWindow) const;
 
   // This method is used to check whether we're in the nested-mozbrower-frame
   // situation, see bug1214148.
   nsresult IsFromNestedFrame(nsISupports* aSubject,
                              bool& aIsNested) const;
 
@@ -83,17 +78,16 @@ private:
 
   void ProcessStateChanged(const char16_t* aData);
 
   nsCOMPtr<nsIFrameLoader> mFrameLoader;
   nsCOMPtr<nsIBrowserElementAPI> mBrowserElementAPI;
   nsCOMPtr<nsITabParent> mTabParent;
   nsCOMPtr<nsPIDOMWindowOuter> mFrameWindow;
   AudioChannel mAudioChannel;
-  nsString mManifestURL;
 
   enum {
     eStateActive,
     eStateInactive,
     eStateUnknown
   } mState;
 };
 
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -19,20 +19,16 @@ Cu.import("resource://gre/modules/NetUti
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "DOMApplicationRegistry", function () {
   Cu.import("resource://gre/modules/Webapps.jsm");
   return DOMApplicationRegistry;
 });
 
-XPCOMUtils.defineLazyServiceGetter(this, "systemMessenger",
-                                   "@mozilla.org/system-message-internal;1",
-                                   "nsISystemMessagesInternal");
-
 function debug(msg) {
   //dump("BrowserElementParent - " + msg + "\n");
 }
 
 function getIntPref(prefName, def) {
   try {
     return Services.prefs.getIntPref(prefName);
   }
@@ -1182,36 +1178,16 @@ BrowserElementParent.prototype = {
                                  muted: aMuted});
   },
 
   isAudioChannelActive: function(aAudioChannel) {
     return this._sendDOMRequest('get-is-audio-channel-active',
                                 {audioChannel: aAudioChannel});
   },
 
-  notifyChannel: function(aEvent, aManifest, aAudioChannel) {
-    var self = this;
-    var req = Services.DOMRequest.createRequest(self._window);
-
-    // Since the pageURI of the app has been registered to the system messager,
-    // when the app was installed. The system messager can only use the manifest
-    // to send the message to correct page.
-    let manifestURL = Services.io.newURI(aManifest, null, null);
-    systemMessenger.sendMessage(aEvent, aAudioChannel, null, manifestURL)
-      .then(function() {
-        Services.DOMRequest.fireSuccess(req,
-          Cu.cloneInto(true, self._window));
-      }, function() {
-        debug("Error : NotifyChannel fail.");
-        Services.DOMRequest.fireErrorAsync(req,
-          Cu.cloneInto("NotifyChannel fail.", self._window));
-      });
-    return req;
-  },
-
   getWebManifest: defineDOMRequestMethod('get-web-manifest'),
   /**
    * Called when the visibility of the window which owns this iframe changes.
    */
   _ownerVisibilityChange: function() {
     this._sendAsyncMsg('owner-visibility-change',
                        {visible: !this._window.document.hidden});
   },
--- a/dom/browser-element/mochitest/browserElement_ActiveStateChange.js
+++ b/dom/browser-element/mochitest/browserElement_ActiveStateChange.js
@@ -67,17 +67,16 @@ function runTests() {
 
   finish();
   yield undefined;
 }
 
 function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
-  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
     is(channels.length, 1, "1 audio channel by default");
 
@@ -97,14 +96,14 @@ function setupTestFrame() {
   }
 
   testFrame.addEventListener('mozbrowserloadend', loadend);
   testFrame.addEventListener('mozbrowsershowmodalprompt', alertError);
   document.body.appendChild(testFrame);
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(setupTestFrame);
   });
 });
 
--- a/dom/browser-element/mochitest/browserElement_AudioChannel.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel.js
@@ -8,17 +8,16 @@
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.addPermission();
 
 function noaudio() {
   info("Test : no-audio");
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_empty.html';
 
   function noaudio_loadend() {
     ok("mute" in iframe, "iframe.mute exists");
     ok("unmute" in iframe, "iframe.unmute exists");
     ok("getMuted" in iframe, "iframe.getMuted exists");
     ok("getVolume" in iframe, "iframe.getVolume exists");
     ok("setVolume" in iframe, "iframe.setVolume exists");
@@ -142,17 +141,16 @@ function noaudio() {
   iframe.addEventListener('mozbrowserloadend', noaudio_loadend);
   document.body.appendChild(iframe);
 }
 
 function audio() {
   info("Test : audio");
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/iframe_file_audio.html';
 
   function audio_loadend() {
     ok("mute" in iframe, "iframe.mute exists");
     ok("unmute" in iframe, "iframe.unmute exists");
     ok("getMuted" in iframe, "iframe.getMuted exists");
     ok("getVolume" in iframe, "iframe.getVolume exists");
     ok("setVolume" in iframe, "iframe.setVolume exists");
@@ -166,17 +164,17 @@ function audio() {
     ok(ac instanceof BrowserElementAudioChannel, "Correct class");
     ok("getVolume" in ac, "ac.getVolume exists");
     ok("setVolume" in ac, "ac.setVolume exists");
     ok("getMuted" in ac, "ac.getMuted exists");
     ok("setMuted" in ac, "ac.setMuted exists");
     ok("isActive" in ac, "ac.isActive exists");
 
     ac.onactivestatechanged = function() {
-      ok("activestatechanged event received.");
+      ok(true, "activestatechanged event received.");
       ac.onactivestatechanged = null;
       document.body.removeChild(iframe);
       runTests();
     }
   }
 
   iframe.addEventListener('mozbrowserloadend', audio_loadend);
   document.body.appendChild(iframe);
@@ -190,13 +188,13 @@ function runTests() {
     return;
   }
 
   var test = tests.shift();
   test();
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(runTests);
   });
 });
--- a/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannelMutedByDefault.js
@@ -67,17 +67,16 @@ function setCommand(aArg) {
 
 function runTests() {
   setCommand('play');
 }
 
 function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
-  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
     is(channels.length, 1, "1 audio channel by default");
 
@@ -92,14 +91,14 @@ function setupTestFrame() {
 
   info("Set EventListeners.");
   testFrame.addEventListener('mozbrowsershowmodalprompt', alertListener);
   testFrame.addEventListener('mozbrowserloadend', loadend);
   document.body.appendChild(testFrame);
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"],
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href],
                                      ["dom.audiochannel.mutedByDefault", true]]},
                             function() {
     SimpleTest.executeSoon(setupTestFrame);
   });
-});
\ No newline at end of file
+});
--- a/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannelSeeking.js
@@ -93,17 +93,16 @@ function runTests() {
 
   finish();
   yield undefined;
 }
 
 function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
-  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
     is(channels.length, 1, "1 audio channel by default");
 
@@ -118,13 +117,13 @@ function setupTestFrame() {
   testFrame.addEventListener('mozbrowserloadend', loadend);
   ok(true, "Add event-listeners.");
 
   document.body.appendChild(testFrame);
   ok(true, "Append test-frame to document.");
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(setupTestFrame);
   });
-});
\ No newline at end of file
+});
--- a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
@@ -7,17 +7,16 @@
 
 SimpleTest.waitForExplicitFinish();
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.addPermission();
 
 function runTests() {
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
-  iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
 
   var listener = function(e) {
     var message = e.detail.message;
     if (/^OK/.exec(message)) {
       ok(true, "Message from app: " + message);
     } else if (/^KO/.exec(message)) {
       ok(false, "Message from app: " + message);
     } else if (/DONE/.exec(message)) {
@@ -67,13 +66,13 @@ function runTests() {
     {'type': 'browser', 'allow': 1, 'context': context},
     {'type': 'embed-apps', 'allow': 1, 'context': context}
   ], function() {
     iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html';
   });
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(runTests);
   });
 });
--- a/dom/browser-element/mochitest/browserElement_AudioPlayback.js
+++ b/dom/browser-element/mochitest/browserElement_AudioPlayback.js
@@ -64,13 +64,13 @@ function runTest() {
        'mozbrowseraudioplaybackchange should dispatch to the correct browser');
   });
 
   // Load a simple page to get the process started.
   iframe.src = browserElementTestHelpers.emptyPage1;
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(runTest);
   });
 });
--- a/dom/browser-element/mochitest/browserElement_MultipleAudioChannels.js
+++ b/dom/browser-element/mochitest/browserElement_MultipleAudioChannels.js
@@ -14,18 +14,18 @@ addLoadEvent(() => {
   SpecialPowers.pushPermissions(
     [{ "type": "webapps-manage", "allow": 1, "context": document },
      { "type": "browser", "allow": 1, "context": document },
      { "type": "embed-apps", "allow": 1, "context": document }],
     function() {
       SpecialPowers.pushPrefEnv(
         {'set': [["dom.mozBrowserFramesEnabled", true],
                  ["dom.webapps.useCurrentProfile", true],
-                 ["media.useAudioChannelAPI", true],
-                 ["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+                 ["b2g.system_startup_url", window.location.href],
+                 ["media.useAudioChannelAPI", true]]},
         () => { generator.next(); })
     });
 });
 
 function error(message) {
   ok(false, message);
   SimpleTest.finish();
 }
@@ -69,17 +69,16 @@ function runTest(aOOPCEnabled) {
   request.onsuccess = () => {
     app = request.result;
     ok(app, "App is installed.");
     is(app.manifestURL, manifestURI, "App manifest url is correct.");
 
     var iframe = document.createElement('iframe');
     iframe.setAttribute('mozbrowser', true);
     iframe.setAttribute('remote', aOOPCEnabled);
-    iframe.setAttribute('mozapp', manifestURI);
     iframe.src = srcURI;
 
     iframe.addEventListener('mozbrowserloadend', () => {
       var channels = iframe.allowedAudioChannels;
       is(channels.length, channelsNum, "Have two channels.");
 
       var activeCounter = 0;
       for (var idx = 0; idx < channelsNum; idx++) {
--- a/dom/browser-element/mochitest/browserElement_NoAudioTrack.js
+++ b/dom/browser-element/mochitest/browserElement_NoAudioTrack.js
@@ -56,17 +56,16 @@ function runTests() {
 
   finish();
   yield undefined;
 }
 
 function setupTestFrame() {
   testFrame = document.createElement('iframe');
   testFrame.setAttribute('mozbrowser', 'true');
-  testFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
   testFrame.src = fileURL;
 
   function loadend() {
     testFrame.removeEventListener('mozbrowserloadend', loadend);
     ok("allowedAudioChannels" in testFrame, "allowedAudioChannels exist");
     var channels = testFrame.allowedAudioChannels;
     is(channels.length, 1, "1 audio channel by default");
 
@@ -86,13 +85,13 @@ function setupTestFrame() {
   testFrame.addEventListener('mozbrowsershowmodalprompt', alertListener);
   ok(true, "Add event-listeners.");
 
   document.body.appendChild(testFrame);
   ok(true, "Append test-frame to document.");
 }
 
 addEventListener('testready', function() {
-  SpecialPowers.pushPrefEnv({'set': [["b2g.system_manifest_url", "http://mochi.test:8888/manifest.webapp"]]},
+  SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
                             function() {
     SimpleTest.executeSoon(setupTestFrame);
   });
 });
deleted file mode 100644
--- a/dom/browser-element/mochitest/browserElement_NotifyChannel.js
+++ /dev/null
@@ -1,128 +0,0 @@
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-
-const { classes: Cc, interfaces: Ci } = Components;
-const systemMessenger = Cc["@mozilla.org/system-message-internal;1"]
-                          .getService(Ci.nsISystemMessagesInternal);
-const ioService = Cc["@mozilla.org/network/io-service;1"]
-                    .getService(Ci.nsIIOService);
-
-var tests = [false /* INPROC */, true /* OOP */];
-var rootURI = "http://test/chrome/dom/browser-element/mochitest/";
-var manifestURI = rootURI + "manifest.webapp";
-var srcURI = rootURI +  "file_browserElement_NotifyChannel.html";
-var generator = runTests();
-var app = null;
-
-addLoadEvent(() => {
-  SpecialPowers.pushPermissions(
-    [{ "type": "webapps-manage", "allow": 1, "context": document },
-     { "type": "browser", "allow": 1, "context": document },
-     { "type": "embed-apps", "allow": 1, "context": document }],
-    function() {
-      SpecialPowers.pushPrefEnv(
-        {'set': [["dom.mozBrowserFramesEnabled", true],
-                 ["dom.sysmsg.enabled", true]]},
-        () => { generator.next(); })
-    });
-});
-
-function error(message) {
-  ok(false, message);
-  SimpleTest.finish();
-}
-
-function continueTest() {
-  try {
-    generator.next();
-  } catch (e if e instanceof StopIteration) {
-    error("Stop test because of exception!");
-  }
-}
-
-function registerPage(aEvent) {
-  systemMessenger.registerPage(aEvent,
-                               ioService.newURI(srcURI, null, null),
-                               ioService.newURI(manifestURI, null, null));
-}
-
-function uninstallApp() {
-  if (app) {
-    var request = navigator.mozApps.mgmt.uninstall(app);
-    app = null;
-    request.onerror = () => {
-      error("Uninstall app failed!");
-    };
-    request.onsuccess = () => {
-      is(request.result, manifestURI, "App uninstalled.");
-      runNextTest();
-    }
-  }
-}
-
-function runTest(aEnable) {
-  var request = navigator.mozApps.install(manifestURI, {});
-  request.onerror = () => {
-    error("Install app failed!");
-  };
-
-  request.onsuccess = () => {
-    app = request.result;
-    ok(app, "App is installed. remote = " + aEnable);
-    is(app.manifestURL, manifestURI, "App manifest url is correct.");
-
-    var iframe = document.createElement('iframe');
-    iframe.setAttribute('mozbrowser', true);
-    iframe.setAttribute('remote', aEnable);
-    iframe.setAttribute('mozapp', manifestURI);
-    iframe.src = srcURI;
-
-    function loadend() {
-      iframe.removeEventListener('mozbrowserloadend', loadend);
-      iframe.addEventListener("mozbrowsershowmodalprompt", getInterruption);
-      var channels = iframe.allowedAudioChannels;
-      is(channels.length, 1, "1 audio channel by default");
-
-      var ac = channels[0];
-      ok(ac instanceof BrowserElementAudioChannel, "Correct class");
-      ok("notifyChannel" in ac, "ac.notifyChannel exists");
-
-      var message = "audiochannel-interruption-begin";
-      registerPage(message);
-      ac.notifyChannel(message);
-
-      function getInterruption(e) {
-        e.target.removeEventListener("mozbrowsershowmodalprompt", getInterruption);
-        is(e.detail.message, message,
-           "App got audiochannel-interruption-begin.");
-
-        document.body.removeChild(iframe);
-        uninstallApp();
-      }
-    };
-
-    iframe.addEventListener("mozbrowserloadend", loadend);
-    document.body.appendChild(iframe);
-  };
-}
-
-function runNextTest() {
-  if (tests.length) {
-    var isEnabledOOP = tests.shift();
-    runTest(isEnabledOOP);
-  } else {
-    SimpleTest.finish();
-  }
-}
-
-function runTests() {
-  SpecialPowers.autoConfirmAppInstall(continueTest);
-  yield undefined;
-
-  SpecialPowers.autoConfirmAppUninstall(continueTest);
-  yield undefined;
-
-  runNextTest();
-  yield undefined;
-}
--- a/dom/browser-element/mochitest/chrome.ini
+++ b/dom/browser-element/mochitest/chrome.ini
@@ -1,18 +1,12 @@
 [DEFAULT]
 skip-if = (buildapp != 'b2g' && buildapp != 'mulet') || (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
 
 support-files =
   audio.ogg
   browserElement_MultipleAudioChannels.js
-  browserElement_NotifyChannel.js
   file_browserElement_MultipleAudioChannels.html
-  file_browserElement_NotifyChannel.html
-  manifest.webapp
-  manifest.webapp^headers^
   multipleAudioChannels_manifest.webapp
   multipleAudioChannels_manifest.webapp^headers^
 
 [test_browserElement_MultipleAudioChannels.html]
 tags = audiochannel
-[test_browserElement_NotifyChannel.html]
-tags = audiochannel
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_browserElement_NotifyChannel.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test of browser element audio channel method, notifyChannel</title>
-</head>
-<body>
-<script type="application/javascript;version=1.8">
-  "use strict";
-  navigator.mozSetMessageHandler('audiochannel-interruption-begin',
-    function (e) {
-      alert("audiochannel-interruption-begin");
-  });
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/browser-element/mochitest/manifest.webapp
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "name": "NotifyChannel Test",
-  "launch_path": "/index.html",
-  "messages": [
-    { "audiochannel-interruption-begin": "./file_browserElement_NotifyChannel.html" }
-  ]
-}
deleted file mode 100644
--- a/dom/browser-element/mochitest/manifest.webapp^headers^
+++ /dev/null
@@ -1,1 +0,0 @@
-Content-Type: application/manifest+json
\ No newline at end of file
deleted file mode 100644
--- a/dom/browser-element/mochitest/test_browserElement_NotifyChannel.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test BrowserElementAudioChannel function : notifyChannel().</title>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/chrome-harness.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<script type="application/javascript;version=1.7" src="browserElement_NotifyChannel.js">
-</script>
-</body>
-</html>
--- a/dom/browser-element/nsIBrowserElementAPI.idl
+++ b/dom/browser-element/nsIBrowserElementAPI.idl
@@ -92,20 +92,16 @@ interface nsIBrowserElementAPI : nsISupp
   nsIDOMDOMRequest getAudioChannelVolume(in uint32_t audioChannel);
   nsIDOMDOMRequest setAudioChannelVolume(in uint32_t audioChannel, in float volume);
 
   nsIDOMDOMRequest getAudioChannelMuted(in uint32_t audioChannel);
   nsIDOMDOMRequest setAudioChannelMuted(in uint32_t audioChannel, in bool muted);
 
   nsIDOMDOMRequest isAudioChannelActive(in uint32_t audioChannel);
 
-  nsIDOMDOMRequest notifyChannel(in DOMString event,
-                                 in DOMString manifest,
-                                 in uint32_t audioChannel);
-
   void setNFCFocus(in boolean isFocus);
 
   nsIDOMDOMRequest executeScript(in DOMString script, in jsval options);
 
   /**
    * Returns an object that represents a Web Manifest:
    * http://w3c.github.io/manifest/
    */
--- a/dom/html/nsBrowserElement.cpp
+++ b/dom/html/nsBrowserElement.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/dom/DOMRequest.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ToJSValue.h"
 
 #include "AudioChannelService.h"
 
 #include "mozIApplication.h"
 #include "nsComponentManagerUtils.h"
-#include "nsContentUtils.h"
 #include "nsFrameLoader.h"
 #include "nsIAppsService.h"
 #include "nsIDOMDOMRequest.h"
 #include "nsIDOMElement.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsINode.h"
 #include "nsIPrincipal.h"
 
@@ -550,120 +549,73 @@ nsBrowserElement::GetAllowedAudioChannel
 
     nsCOMPtr<nsIMozBrowserFrame> mozBrowserFrame =
       do_QueryInterface(frameElement);
     if (NS_WARN_IF(!mozBrowserFrame)) {
       aRv.Throw(NS_ERROR_FAILURE);
       return;
     }
 
-    nsAutoString manifestURL;
-    aRv = mozBrowserFrame->GetAppManifestURL(manifestURL);
-    if (NS_WARN_IF(aRv.Failed())) {
-      return;
-    }
-
-    nsCOMPtr<mozIApplication> parentApp;
-    aRv = GetParentApplication(getter_AddRefs(parentApp));
-    if (NS_WARN_IF(aRv.Failed())) {
-      return;
-    }
-
     MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
             ("nsBrowserElement, GetAllowedAudioChannels, this = %p\n", this));
 
     GenerateAllowedAudioChannels(innerWindow, frameLoader, mBrowserElementAPI,
-                                 manifestURL, parentApp,
                                  mBrowserElementAudioChannels, aRv);
     if (NS_WARN_IF(aRv.Failed())) {
       return;
     }
   }
 
   aAudioChannels.AppendElements(mBrowserElementAudioChannels);
 }
 
 /* static */ void
 nsBrowserElement::GenerateAllowedAudioChannels(
                  nsPIDOMWindowInner* aWindow,
                  nsIFrameLoader* aFrameLoader,
                  nsIBrowserElementAPI* aAPI,
-                 const nsAString& aManifestURL,
-                 mozIApplication* aParentApp,
                  nsTArray<RefPtr<BrowserElementAudioChannel>>& aAudioChannels,
                  ErrorResult& aRv)
 {
   MOZ_ASSERT(aAudioChannels.IsEmpty());
 
-  nsCOMPtr<nsIAppsService> appsService =
-    do_GetService("@mozilla.org/AppsService;1");
-  if (NS_WARN_IF(!appsService)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  nsCOMPtr<mozIApplication> app;
-  aRv = appsService->GetAppByManifestURL(aManifestURL, getter_AddRefs(app));
-  if (NS_WARN_IF(aRv.Failed())) {
-    return;
-  }
-
   // Normal is always allowed.
   nsTArray<RefPtr<BrowserElementAudioChannel>> channels;
 
   RefPtr<BrowserElementAudioChannel> ac =
     BrowserElementAudioChannel::Create(aWindow, aFrameLoader, aAPI,
-                                       AudioChannel::Normal,
-                                       aManifestURL, aRv);
+                                       AudioChannel::Normal, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   channels.AppendElement(ac);
 
-  if (app) {
+  nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
+  if (NS_WARN_IF(!doc)) {
+    aRv.Throw(NS_ERROR_FAILURE);
+    return;
+  }
+
+  // Since we don't have permissions anymore let only chrome windows pick a
+  // non-default channel
+  if (nsContentUtils::IsChromeDoc(doc)) {
     const nsAttrValue::EnumTable* audioChannelTable =
       AudioChannelService::GetAudioChannelTable();
 
-    bool allowed;
-    nsAutoCString permissionName;
-
     for (uint32_t i = 0; audioChannelTable && audioChannelTable[i].tag; ++i) {
-      permissionName.AssignASCII("audio-channel-");
-      permissionName.AppendASCII(audioChannelTable[i].tag);
-
-      // In case of nested iframes we want to check if the parent has the
-      // permission to use this AudioChannel.
-      if (aParentApp) {
-        aRv = aParentApp->HasPermission(permissionName.get(), &allowed);
-        if (NS_WARN_IF(aRv.Failed())) {
-          return;
-        }
-
-        if (!allowed) {
-          continue;
-        }
-      }
-
-      aRv = app->HasPermission(permissionName.get(), &allowed);
+      AudioChannel value = (AudioChannel)audioChannelTable[i].value;
+      RefPtr<BrowserElementAudioChannel> ac =
+        BrowserElementAudioChannel::Create(aWindow, aFrameLoader, aAPI,
+                                           value, aRv);
       if (NS_WARN_IF(aRv.Failed())) {
         return;
       }
 
-      if (allowed) {
-        RefPtr<BrowserElementAudioChannel> ac =
-          BrowserElementAudioChannel::Create(aWindow, aFrameLoader, aAPI,
-                                             (AudioChannel)audioChannelTable[i].value,
-                                             aManifestURL, aRv);
-        if (NS_WARN_IF(aRv.Failed())) {
-          return;
-        }
-
-        channels.AppendElement(ac);
-      }
+      channels.AppendElement(ac);
     }
   }
 
   aAudioChannels.SwapElements(channels);
 }
 
 already_AddRefed<DOMRequest>
 nsBrowserElement::GetMuted(ErrorResult& aRv)
--- a/dom/html/nsBrowserElement.h
+++ b/dom/html/nsBrowserElement.h
@@ -117,18 +117,16 @@ public:
   void SetNFCFocus(bool isFocus,
                    ErrorResult& aRv);
 
   // Helper
   static void GenerateAllowedAudioChannels(
                  nsPIDOMWindowInner* aWindow,
                  nsIFrameLoader* aFrameLoader,
                  nsIBrowserElementAPI* aAPI,
-                 const nsAString& aManifestURL,
-                 mozIApplication* aParentApp,
                  nsTArray<RefPtr<dom::BrowserElementAudioChannel>>& aAudioChannels,
                  ErrorResult& aRv);
 
 protected:
   NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
   NS_IMETHOD GetParentApplication(mozIApplication** aApplication) = 0;
 
   void InitBrowserElementAPI();
--- a/dom/system/gonk/AudioChannelManager.cpp
+++ b/dom/system/gonk/AudioChannelManager.cpp
@@ -1,13 +1,12 @@
 /* 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 "nsIAppsService.h"
 #include "nsIDocument.h"
 #include "nsIDOMClassInfo.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIPermissionManager.h"
 #include "nsIInterfaceRequestorUtils.h"
@@ -167,56 +166,16 @@ AudioChannelManager::GetAllowedAudioChan
   }
 
   nsCOMPtr<nsPIDOMWindowInner> window = GetOwner();
   if (NS_WARN_IF(!window)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
-  if (NS_WARN_IF(!doc)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
-  MOZ_ASSERT(principal);
-
-  uint16_t status;
-  if (NS_WARN_IF(NS_FAILED(principal->GetAppStatus(&status)))) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  if (status != nsIPrincipal::APP_STATUS_CERTIFIED) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  uint32_t appId;
-  aRv = principal->GetAppId(&appId);
-  if (NS_WARN_IF(aRv.Failed())) {
-    return;
-  }
-
-  nsCOMPtr<nsIAppsService> appsService =
-    do_GetService("@mozilla.org/AppsService;1");
-  if (NS_WARN_IF(!appsService)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  nsAutoString manifestURL;
-  aRv = appsService->GetManifestURLByLocalId(appId, manifestURL);
-  if (NS_WARN_IF(aRv.Failed())) {
-    return;
-  }
-
   nsBrowserElement::GenerateAllowedAudioChannels(window, nullptr, nullptr,
-                                                 manifestURL, nullptr,
                                                  aAudioChannels, aRv);
   NS_WARN_IF(aRv.Failed());
 }
 
 } // namespace system
 } // namespace dom
 } // namespace mozilla
--- a/dom/webidl/BrowserElementAudioChannel.webidl
+++ b/dom/webidl/BrowserElementAudioChannel.webidl
@@ -22,19 +22,16 @@ interface BrowserElementAudioChannel : E
   [Throws]
   DOMRequest getMuted();
 
   [Throws]
   DOMRequest setMuted(boolean aMuted);
 
   [Throws]
   DOMRequest isActive();
-
-  [Throws]
-  DOMRequest notifyChannel(DOMString aEvent);
 };
 
 partial interface BrowserElementPrivileged {
   [Pure, Cached, Throws,
    Pref="dom.mozBrowserFramesEnabled",
    CheckAnyPermissions="browser"]
   readonly attribute sequence<BrowserElementAudioChannel> allowedAudioChannels;