Bug 1513039 - part6 : remove AutoplayPermissionManager and AutoplayPermissionRequest. r=cpearce,smaug
authoralwu <alwu@mozilla.com>
Mon, 07 Jan 2019 18:35:30 +0000
changeset 512758 54817f010dde7ba75d4b506be0e55eac3a890471
parent 512757 0e229bbdaae5c8fa9f83796c628a4fdf88f057ba
child 512759 1a70b4c3fc0ec88667508ebb87deefc2923693a7
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, smaug
bugs1513039
milestone66.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 1513039 - part6 : remove AutoplayPermissionManager and AutoplayPermissionRequest. r=cpearce,smaug Depends on D14330 Differential Revision: https://phabricator.services.mozilla.com/D14331
dom/base/nsGlobalWindowInner.cpp
dom/base/nsPIDOMWindow.h
dom/html/AutoplayPermissionManager.cpp
dom/html/AutoplayPermissionManager.h
dom/html/AutoplayPermissionRequest.cpp
dom/html/AutoplayPermissionRequest.h
dom/html/moz.build
dom/media/AutoplayPolicy.cpp
dom/media/AutoplayPolicy.h
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -12,17 +12,16 @@
 
 // Local Includes
 #include "Navigator.h"
 #include "nsContentSecurityManager.h"
 #include "nsScreen.h"
 #include "nsHistory.h"
 #include "nsDOMNavigationTiming.h"
 #include "nsIDOMStorageManager.h"
-#include "mozilla/AutoplayPermissionManager.h"
 #include "mozilla/dom/ContentFrameMessageManager.h"
 #include "mozilla/dom/DOMJSProxyHandler.h"
 #include "mozilla/dom/DOMPrefs.h"
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/LocalStorage.h"
 #include "mozilla/dom/LocalStorageCommon.h"
 #include "mozilla/dom/LSObject.h"
 #include "mozilla/dom/PartitionedLocalStorage.h"
@@ -1009,22 +1008,16 @@ nsGlobalWindowInner::~nsGlobalWindowInne
   FreeInnerObjects();
 
   if (sInnerWindowsById) {
     MOZ_ASSERT(sInnerWindowsById->Get(mWindowID),
                "This window should be in the hash table");
     sInnerWindowsById->Remove(mWindowID);
   }
 
-  // If AutoplayPermissionManager is going to be destroyed before getting the
-  // request's result, we would treat it as user deny.
-  if (mAutoplayPermissionManager) {
-    mAutoplayPermissionManager->DenyPlayRequestIfExists();
-  }
-
   nsContentUtils::InnerOrOuterWindowDestroyed();
 
 #ifdef DEBUG
   if (!PR_GetEnv("MOZ_QUIET")) {
     nsAutoCString url;
     if (mLastOpenedURI) {
       url = mLastOpenedURI->GetSpecOrDefault();
 
@@ -7325,48 +7318,16 @@ mozilla::dom::DocGroup* nsPIDOMWindowInn
 nsIGlobalObject* nsPIDOMWindowInner::AsGlobal() {
   return nsGlobalWindowInner::Cast(this);
 }
 
 const nsIGlobalObject* nsPIDOMWindowInner::AsGlobal() const {
   return nsGlobalWindowInner::Cast(this);
 }
 
-static nsPIDOMWindowInner* GetTopLevelInnerWindow(nsPIDOMWindowInner* aWindow) {
-  if (!aWindow) {
-    return nullptr;
-  }
-  nsIDocShell* docShell = aWindow->GetDocShell();
-  if (!docShell) {
-    return nullptr;
-  }
-  nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
-  docShell->GetSameTypeRootTreeItem(getter_AddRefs(rootTreeItem));
-  if (!rootTreeItem || !rootTreeItem->GetDocument()) {
-    return nullptr;
-  }
-  return rootTreeItem->GetDocument()->GetInnerWindow();
-}
-
-already_AddRefed<mozilla::AutoplayPermissionManager>
-nsPIDOMWindowInner::GetAutoplayPermissionManager() {
-  // The AutoplayPermissionManager is stored on the top level window.
-  nsPIDOMWindowInner* window = GetTopLevelInnerWindow(this);
-  if (!window) {
-    return nullptr;
-  }
-  if (!window->mAutoplayPermissionManager) {
-    window->mAutoplayPermissionManager =
-        new AutoplayPermissionManager(nsGlobalWindowInner::Cast(window));
-  }
-  RefPtr<mozilla::AutoplayPermissionManager> manager =
-      window->mAutoplayPermissionManager;
-  return manager.forget();
-}
-
 void nsPIDOMWindowInner::SaveStorageAccessGranted(
     const nsACString& aPermissionKey) {
   if (!HasStorageAccessGranted(aPermissionKey)) {
     mStorageAccessGranted.AppendElement(aPermissionKey);
   }
 }
 
 bool nsPIDOMWindowInner::HasStorageAccessGranted(
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -39,17 +39,16 @@ class nsIURI;
 class nsPIDOMWindowInner;
 class nsPIDOMWindowOuter;
 class nsPIWindowRoot;
 class nsXBLPrototypeHandler;
 
 typedef uint32_t SuspendTypes;
 
 namespace mozilla {
-class AutoplayPermissionManager;
 namespace dom {
 class AudioContext;
 class BrowsingContext;
 class ClientInfo;
 class ClientState;
 class ContentFrameMessageManager;
 class DocGroup;
 class Document;
@@ -559,21 +558,16 @@ class nsPIDOMWindowInner : public mozIDO
 
   virtual nsresult Focus() = 0;
   virtual nsresult Close() = 0;
 
   mozilla::dom::DocGroup* GetDocGroup() const;
   virtual nsISerialEventTarget* EventTargetFor(
       mozilla::TaskCategory aCategory) const = 0;
 
-  // Returns the AutoplayPermissionManager that documents in this window should
-  // use to request permission to autoplay.
-  already_AddRefed<mozilla::AutoplayPermissionManager>
-  GetAutoplayPermissionManager();
-
   void RegisterReportingObserver(mozilla::dom::ReportingObserver* aObserver,
                                  bool aBuffered);
 
   void UnregisterReportingObserver(mozilla::dom::ReportingObserver* aObserver);
 
   void BroadcastReport(mozilla::dom::Report* aReport);
 
   void NotifyReportingObservers();
@@ -662,21 +656,16 @@ class nsPIDOMWindowInner : public mozIDO
   bool mHasTriedToCacheTopInnerWindow;
 
   // The number of active IndexedDB databases.
   uint32_t mNumOfIndexedDBDatabases;
 
   // The number of open WebSockets.
   uint32_t mNumOfOpenWebSockets;
 
-  // If we're in the process of requesting permission for this window to
-  // play audible media, or we've already been granted permission by the
-  // user, this is non-null, and encapsulates the request.
-  RefPtr<mozilla::AutoplayPermissionManager> mAutoplayPermissionManager;
-
   // The event dispatch code sets and unsets this while keeping
   // the event object alive.
   mozilla::dom::Event* mEvent;
 
   // List of Report objects for ReportingObservers.
   nsTArray<RefPtr<mozilla::dom::ReportingObserver>> mReportingObservers;
   nsTArray<RefPtr<mozilla::dom::Report>> mReportRecords;
 
deleted file mode 100644
--- a/dom/html/AutoplayPermissionManager.cpp
+++ /dev/null
@@ -1,85 +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 "mozilla/AutoplayPermissionManager.h"
-#include "mozilla/AutoplayPermissionRequest.h"
-
-#include "nsGlobalWindowInner.h"
-#include "nsISupportsImpl.h"
-#include "mozilla/Logging.h"
-#include "nsContentPermissionHelper.h"
-
-extern mozilla::LazyLogModule gAutoplayPermissionLog;
-
-#define PLAY_REQUEST_LOG(msg, ...) \
-  MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
-
-namespace mozilla {
-
-RefPtr<GenericNonExclusivePromise>
-AutoplayPermissionManager::RequestWithPrompt() {
-  // If we've already requested permission, we'll just return the promise,
-  // as we don't want to show multiple permission requests at once.
-  // The promise is non-exclusive, so if the request has already completed,
-  // the ThenValue will run immediately.
-  if (mRequestDispatched) {
-    PLAY_REQUEST_LOG(
-        "AutoplayPermissionManager %p RequestWithPrompt() request "
-        "already dispatched",
-        this);
-    return mPromiseHolder.Ensure(__func__);
-  }
-
-  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
-  if (!window) {
-    return GenericNonExclusivePromise::CreateAndReject(
-        NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR, __func__);
-  }
-
-  RefPtr<AutoplayPermissionRequest> request = AutoplayPermissionRequest::Create(
-      nsGlobalWindowInner::Cast(window), this);
-  if (!request) {
-    return GenericNonExclusivePromise::CreateAndReject(
-        NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR, __func__);
-  }
-
-  // Dispatch the request.
-  request->RequestDelayedTask(
-      window->EventTargetFor(TaskCategory::Other),
-      AutoplayPermissionRequest::DelayedTaskType::Request);
-
-  mRequestDispatched = true;
-  return mPromiseHolder.Ensure(__func__);
-}
-
-AutoplayPermissionManager::AutoplayPermissionManager(
-    nsGlobalWindowInner* aWindow)
-    : mWindow(do_GetWeakReference(aWindow)) {
-  PLAY_REQUEST_LOG("AutoplayPermissionManager %p Create()", this);
-}
-
-AutoplayPermissionManager::~AutoplayPermissionManager() {
-  // If we made a request, it should have been resolved.
-  MOZ_ASSERT(!mRequestDispatched);
-}
-
-void AutoplayPermissionManager::DenyPlayRequestIfExists() {
-  if (mRequestDispatched) {
-    PLAY_REQUEST_LOG("AutoplayPermissionManager %p DenyPlayRequest()", this);
-    mRequestDispatched = false;
-    mPromiseHolder.RejectIfExists(NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR, __func__);
-  }
-}
-
-void AutoplayPermissionManager::ApprovePlayRequestIfExists() {
-  if (mRequestDispatched) {
-    PLAY_REQUEST_LOG("AutoplayPermissionManager %p ApprovePlayRequest()", this);
-    mRequestDispatched = false;
-    mPromiseHolder.ResolveIfExists(true, __func__);
-  }
-}
-
-}  // namespace mozilla
deleted file mode 100644
--- a/dom/html/AutoplayPermissionManager.h
+++ /dev/null
@@ -1,68 +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/. */
-
-#ifndef __AutoplayPermissionRequestManager_h__
-#define __AutoplayPermissionRequestManager_h__
-
-#include "mozilla/MozPromise.h"
-#include "mozilla/WeakPtr.h"
-#include "nsIContentPermissionPrompt.h"
-#include "nsISupports.h"
-#include "nsIWeakReferenceUtils.h"
-
-class nsGlobalWindowInner;
-class nsIEventTarget;
-
-namespace mozilla {
-
-// Encapsulates requesting permission from the user to autoplay with a
-// doorhanger. The AutoplayPermissionManager is stored on the top level window,
-// and all documents in the tab use the top level window's
-// AutoplayPermissionManager. The AutoplayPermissionManager ensures that
-// multiple requests are merged into one, in order to avoid showing multiple
-// doorhangers on one tab at once.
-class AutoplayPermissionManager final
-    : public SupportsWeakPtr<AutoplayPermissionManager> {
- public:
-  MOZ_DECLARE_WEAKREFERENCE_TYPENAME(AutoplayPermissionManager)
-  NS_INLINE_DECL_REFCOUNTING(AutoplayPermissionManager)
-
-  // Creates a new AutoplayPermissionManager. Don't call this directly, use
-  // AutoplayPolicy::RequestFor() to retrieve the appropriate
-  // AutoplayPermissionManager to use for a document/window.
-  explicit AutoplayPermissionManager(nsGlobalWindowInner* aWindow);
-
-  // Requests permission to autoplay via a user prompt. The returned MozPromise
-  // resolves/rejects when the user grants/denies permission to autoplay.
-  // If the request doorhanger is dismissed, i.e. tab closed, ESC pressed,
-  // etc, the MozPromise is rejected. If there is a stored permission for this
-  // window's origin, the parent process will approve/deny the
-  // autoplay request using the stored permission immediately (so the MozPromise
-  // rejects in the content process after an IPC round trip).
-  RefPtr<GenericNonExclusivePromise> RequestWithPrompt();
-
-  // Called by AutoplayPermissionRequest to approve the play request,
-  // and resolve the MozPromise returned by RequestWithPrompt().
-  void ApprovePlayRequestIfExists();
-  // Called by AutoplayPermissionRequest to deny the play request or the inner
-  // window is going to be destroyed, this function would reject the MozPromise
-  // returned by RequestWithPrompt().
-  void DenyPlayRequestIfExists();
-
- private:
-  ~AutoplayPermissionManager();
-
-  nsWeakPtr mWindow;
-  MozPromiseHolder<GenericNonExclusivePromise> mPromiseHolder;
-  // Tracks whether we've dispatched a request to chrome in the parent process
-  // to prompt for user permission to autoplay. This flag ensures we don't
-  // request multiple times concurrently.
-  bool mRequestDispatched = false;
-};
-
-}  // namespace mozilla
-
-#endif  // __AutoplayPermissionRequestManager_h__
deleted file mode 100644
--- a/dom/html/AutoplayPermissionRequest.cpp
+++ /dev/null
@@ -1,69 +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 "mozilla/AutoplayPermissionRequest.h"
-#include "mozilla/AutoplayPermissionManager.h"
-
-#include "mozilla/Logging.h"
-
-extern mozilla::LazyLogModule gAutoplayPermissionLog;
-
-#define PLAY_REQUEST_LOG(msg, ...) \
-  MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
-
-namespace mozilla {
-
-NS_IMPL_CYCLE_COLLECTION_INHERITED(AutoplayPermissionRequest,
-                                   ContentPermissionRequestBase)
-
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(AutoplayPermissionRequest,
-                                               ContentPermissionRequestBase)
-
-AutoplayPermissionRequest::AutoplayPermissionRequest(
-    AutoplayPermissionManager* aManager, nsGlobalWindowInner* aWindow,
-    nsIPrincipal* aNodePrincipal)
-    : ContentPermissionRequestBase(
-          aNodePrincipal, false, aWindow,
-          NS_LITERAL_CSTRING(""),  // No testing pref used in this class
-          NS_LITERAL_CSTRING("autoplay-media")),
-      mManager(aManager) {}
-
-AutoplayPermissionRequest::~AutoplayPermissionRequest() { Cancel(); }
-
-NS_IMETHODIMP
-AutoplayPermissionRequest::Cancel() {
-  if (mManager) {
-    mManager->DenyPlayRequestIfExists();
-    // Clear reference to manager, so we can't double report a result.
-    // This could happen in particular if we call Cancel() in the destructor.
-    mManager = nullptr;
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AutoplayPermissionRequest::Allow(JS::HandleValue aChoices) {
-  if (mManager) {
-    mManager->ApprovePlayRequestIfExists();
-    // Clear reference to manager, so we can't double report a result.
-    // This could happen in particular if we call Cancel() in the destructor.
-    mManager = nullptr;
-  }
-  return NS_OK;
-}
-
-already_AddRefed<AutoplayPermissionRequest> AutoplayPermissionRequest::Create(
-    nsGlobalWindowInner* aWindow, AutoplayPermissionManager* aManager) {
-  if (!aWindow || !aWindow->GetPrincipal()) {
-    return nullptr;
-  }
-  RefPtr<AutoplayPermissionRequest> request =
-      new AutoplayPermissionRequest(aManager, aWindow, aWindow->GetPrincipal());
-  PLAY_REQUEST_LOG("AutoplayPermissionRequest %p Create()", request.get());
-  return request.forget();
-}
-
-}  // namespace mozilla
deleted file mode 100644
--- a/dom/html/AutoplayPermissionRequest.h
+++ /dev/null
@@ -1,55 +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/. */
-
-#ifndef AutoplayPermissionRequest_h_
-#define AutoplayPermissionRequest_h_
-
-#include "nsGlobalWindowInner.h"
-#include "nsISupportsImpl.h"
-#include "nsContentPermissionHelper.h"
-
-namespace mozilla {
-
-class AutoplayPermissionManager;
-
-// The AutoplayPermissionRequest is the object we pass off to the chrome JS
-// code to represent a request for permission to autoplay. Unfortunately the
-// front end code doesn't guarantee to give us an approve/cancel callback in
-// all cases. If chrome JS dismisses the permission request for whatever
-// reason (tab closed, user presses ESC, navigation, etc), the permission UI
-// code will drop its reference to the AutoplayPermissionRequest and it will
-// be destroyed. The AutoplayPermissionRequest keeps a weak reference to
-// the AutoplayPermissionManager. If the AutoplayPermissionManager is still
-// alive when the AutoplayPermissionRequest's destructor runs, the
-// AutoplayPermissionRequest's destructor calls the AutoplayPermissionManager
-// back with a cancel operation. Thus the AutoplayPermissionManager can
-// guarantee to always approve or cancel requests to play.
-class AutoplayPermissionRequest final
-    : public dom::ContentPermissionRequestBase {
- public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AutoplayPermissionRequest,
-                                           ContentPermissionRequestBase)
-
-  // nsIContentPermissionRequest
-  NS_IMETHOD Cancel(void) override;
-  NS_IMETHOD Allow(JS::HandleValue choices) override;
-
-  static already_AddRefed<AutoplayPermissionRequest> Create(
-      nsGlobalWindowInner* aWindow, AutoplayPermissionManager* aManager);
-
- private:
-  AutoplayPermissionRequest(AutoplayPermissionManager* aManager,
-                            nsGlobalWindowInner* aWindow,
-                            nsIPrincipal* aNodePrincipal);
-  ~AutoplayPermissionRequest();
-
-  WeakPtr<AutoplayPermissionManager> mManager;
-};
-
-}  // namespace mozilla
-
-#endif  // AutoplayPermissionRequest_h_
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -45,18 +45,16 @@ EXPORTS += [
     'nsIHTMLDocument.h',
     'nsIRadioGroupContainer.h',
     'nsIRadioVisitor.h',
     'nsITextControlElement.h',
     'nsTextEditorState.h',
 ]
 
 EXPORTS.mozilla += [
-    'AutoplayPermissionManager.h',
-    'AutoplayPermissionRequest.h',
     'TextInputListener.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'HTMLAllCollection.h',
     'HTMLAnchorElement.h',
     'HTMLAreaElement.h',
     'HTMLAudioElement.h',
@@ -223,18 +221,16 @@ UNIFIED_SOURCES += [
     'RadioNodeList.cpp',
     'TextTrackManager.cpp',
     'TimeRanges.cpp',
     'ValidityState.cpp',
     'VideoDocument.cpp',
 ]
 
 SOURCES += [
-    'AutoplayPermissionManager.cpp',
-    'AutoplayPermissionRequest.cpp',
     # Includes npapi.h.
     'PluginDocument.cpp',
 ]
 
 EXTRA_COMPONENTS += [
     'htmlMenuBuilder.js',
     'htmlMenuBuilder.manifest'
 ]
--- a/dom/media/AutoplayPolicy.cpp
+++ b/dom/media/AutoplayPolicy.cpp
@@ -5,17 +5,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AutoplayPolicy.h"
 
 #include "mozilla/EventStateManager.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/AudioContext.h"
-#include "mozilla/AutoplayPermissionManager.h"
 #include "mozilla/dom/FeaturePolicyUtils.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/HTMLMediaElementBinding.h"
 #include "nsGlobalWindowInner.h"
 #include "nsIAutoplay.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/Document.h"
 #include "MediaManager.h"
@@ -107,30 +106,16 @@ static bool IsWindowAllowedToPlay(nsPIDO
   if (approver->IsExtensionPage()) {
     AUTOPLAY_LOG("Allow autoplay as in extension document.");
     return true;
   }
 
   return false;
 }
 
-/* static */
-already_AddRefed<AutoplayPermissionManager> AutoplayPolicy::RequestFor(
-    const Document& aDocument) {
-  Document* document = ApproverDocOf(aDocument);
-  if (!document) {
-    return nullptr;
-  }
-  nsPIDOMWindowInner* window = document->GetInnerWindow();
-  if (!window) {
-    return nullptr;
-  }
-  return window->GetAutoplayPermissionManager();
-}
-
 static uint32_t DefaultAutoplayBehaviour() {
   int prefValue =
       Preferences::GetInt("media.autoplay.default", nsIAutoplay::ALLOWED);
   if (prefValue < nsIAutoplay::ALLOWED || prefValue > nsIAutoplay::PROMPT) {
     // Invalid pref values are just converted to ALLOWED.
     return nsIAutoplay::ALLOWED;
   }
   return prefValue;
--- a/dom/media/AutoplayPolicy.h
+++ b/dom/media/AutoplayPolicy.h
@@ -5,19 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(AutoplayPolicy_h_)
 #define AutoplayPolicy_h_
 
 #include "mozilla/NotNull.h"
 
 namespace mozilla {
-
-class AutoplayPermissionManager;
-
 namespace dom {
 
 class HTMLMediaElement;
 class AudioContext;
 class Document;
 
 /**
  * AutoplayPolicy is used to manage autoplay logic for all kinds of media,
@@ -41,19 +38,14 @@ class AutoplayPolicy {
 
   // Returns true if a given media element would be allowed to play
   // if block autoplay was enabled. If this returns false, it means we would
   // either block or ask for permission.
   // Note: this is for telemetry purposes, and doesn't check the prefs
   // which enable/disable block autoplay. Do not use for blocking logic!
   static bool WouldBeAllowedToPlayIfAutoplayDisabled(
       const HTMLMediaElement& aElement);
-
-  // Returns the AutoplayPermissionManager that a given document must request on
-  // for autoplay permission.
-  static already_AddRefed<AutoplayPermissionManager> RequestFor(
-      const Document& aDocument);
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif