Bug 1596843 - Part 1: Remove the unused nsIPermissionManager.testPermissionFromWindow() method; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 17 Nov 2019 22:22:21 +0000
changeset 502410 83096c9e152d28d7cdda1542eb6bf3452f739da0
parent 502409 edb4de0b8fdc194a95c837eaec8bc53b1df1a08d
child 502411 70e1692d29f55b8c0ec50c7b82dc37cf05b31640
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1596843
milestone72.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 1596843 - Part 1: Remove the unused nsIPermissionManager.testPermissionFromWindow() method; r=baku Differential Revision: https://phabricator.services.mozilla.com/D53237
extensions/permissions/nsPermissionManager.cpp
netwerk/base/nsIPermissionManager.idl
--- a/extensions/permissions/nsPermissionManager.cpp
+++ b/extensions/permissions/nsPermissionManager.cpp
@@ -2245,31 +2245,16 @@ nsresult nsPermissionManager::LegacyTest
     nsIURI* aURI, const mozilla::OriginAttributes* aOriginAttributes,
     const nsACString& aType, uint32_t* aPermission) {
   return CommonTestPermission(aURI, aOriginAttributes, -1, aType, aPermission,
                               nsIPermissionManager::UNKNOWN_ACTION, false,
                               false, true);
 }
 
 NS_IMETHODIMP
-nsPermissionManager::TestPermissionFromWindow(mozIDOMWindow* aWindow,
-                                              const nsACString& aType,
-                                              uint32_t* aPermission) {
-  NS_ENSURE_ARG(aWindow);
-  nsCOMPtr<nsPIDOMWindowInner> window = nsPIDOMWindowInner::From(aWindow);
-
-  // Get the document for security check
-  RefPtr<Document> document = window->GetExtantDoc();
-  NS_ENSURE_TRUE(document, NS_NOINTERFACE);
-
-  nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
-  return TestPermissionFromPrincipal(principal, aType, aPermission);
-}
-
-NS_IMETHODIMP
 nsPermissionManager::TestPermissionFromPrincipal(nsIPrincipal* aPrincipal,
                                                  const nsACString& aType,
                                                  uint32_t* aPermission) {
   return CommonTestPermission(aPrincipal, -1, aType, aPermission,
                               nsIPermissionManager::UNKNOWN_ACTION, false,
                               false, true);
 }
 
--- a/netwerk/base/nsIPermissionManager.idl
+++ b/netwerk/base/nsIPermissionManager.idl
@@ -27,17 +27,16 @@
  *          "cleared"
  *          the entire permission list was cleared. the subject is null.
  */
 
 #include "nsISupports.idl"
 
 interface nsIObserver;
 interface nsIPrincipal;
-interface mozIDOMWindow;
 interface nsIPermission;
 interface nsIRunnable;
 
 %{ C++
 namespace IPC {
 struct Permission;
 }
 #include "nsTArrayForwardDeclare.h"
@@ -148,26 +147,16 @@ interface nsIPermissionManager : nsISupp
    * System principals will always have permissions granted.
    * This function will perform a pref lookup to permissions.default.<type>
    * if the specific permission type is part of the whitelist for that functionality.
    */
   uint32_t testPermissionFromPrincipal(in nsIPrincipal principal,
                                        in ACString type);
 
   /**
-   * Test whether the principal associated with the window's document has the
-   * permission to perform a given action.  System principals will always
-   * have permissions granted.
-   * This function will perform a pref lookup to permissions.default.<type>
-   * if the specific permission type is part of the whitelist for that functionality.
-   */
-  uint32_t testPermissionFromWindow(in mozIDOMWindow window,
-                                    in ACString type);
-
-  /**
    * See testExactPermission() above.
    * System principals will always have permissions granted.
    * This function will perform a pref lookup to permissions.default.<type>
    * if the specific permission type is part of the whitelist for that functionality.
    */
   uint32_t testExactPermissionFromPrincipal(in nsIPrincipal principal,
                                             in ACString type);