Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit c34871a

Browse files
committed
Bug 1402957 - Removed URI based nsIPermissionManager methods. r=johannh,Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D47254 --HG-- extra : moz-landing-system : lando
1 parent 0f115bb commit c34871a

2 files changed

Lines changed: 0 additions & 158 deletions

File tree

extensions/permissions/nsPermissionManager.cpp

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,20 +1723,6 @@ nsresult nsPermissionManager::CreateTable() {
17231723
")"));
17241724
}
17251725

1726-
NS_IMETHODIMP
1727-
nsPermissionManager::Add(nsIURI* aURI, const nsACString& aType,
1728-
uint32_t aPermission, uint32_t aExpireType,
1729-
int64_t aExpireTime) {
1730-
NS_ENSURE_ARG_POINTER(aURI);
1731-
1732-
nsCOMPtr<nsIPrincipal> principal;
1733-
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
1734-
NS_ENSURE_SUCCESS(rv, rv);
1735-
1736-
return AddFromPrincipal(principal, aType, aPermission, aExpireType,
1737-
aExpireTime);
1738-
}
1739-
17401726
NS_IMETHODIMP
17411727
nsPermissionManager::AddFromPrincipal(nsIPrincipal* aPrincipal,
17421728
const nsACString& aType,
@@ -2072,17 +2058,6 @@ nsresult nsPermissionManager::AddInternal(
20722058
return NS_OK;
20732059
}
20742060

2075-
NS_IMETHODIMP
2076-
nsPermissionManager::Remove(nsIURI* aURI, const nsACString& aType) {
2077-
NS_ENSURE_ARG_POINTER(aURI);
2078-
2079-
nsCOMPtr<nsIPrincipal> principal;
2080-
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
2081-
NS_ENSURE_SUCCESS(rv, rv);
2082-
2083-
return RemoveFromPrincipal(principal, aType);
2084-
}
2085-
20862061
NS_IMETHODIMP
20872062
nsPermissionManager::RemoveFromPrincipal(nsIPrincipal* aPrincipal,
20882063
const nsACString& aType) {
@@ -2274,14 +2249,6 @@ nsresult nsPermissionManager::RemoveAllInternal(bool aNotifyObservers) {
22742249
return NS_OK;
22752250
}
22762251

2277-
NS_IMETHODIMP
2278-
nsPermissionManager::TestExactPermission(nsIURI* aURI, const nsACString& aType,
2279-
uint32_t* aPermission) {
2280-
return CommonTestPermission(aURI, -1, aType, aPermission,
2281-
nsIPermissionManager::UNKNOWN_ACTION, false, true,
2282-
true);
2283-
}
2284-
22852252
NS_IMETHODIMP
22862253
nsPermissionManager::TestExactPermissionFromPrincipal(nsIPrincipal* aPrincipal,
22872254
const nsACString& aType,
@@ -2300,14 +2267,6 @@ nsPermissionManager::TestExactPermanentPermission(nsIPrincipal* aPrincipal,
23002267
false);
23012268
}
23022269

2303-
NS_IMETHODIMP
2304-
nsPermissionManager::TestPermission(nsIURI* aURI, const nsACString& aType,
2305-
uint32_t* aPermission) {
2306-
return CommonTestPermission(aURI, -1, aType, aPermission,
2307-
nsIPermissionManager::UNKNOWN_ACTION, false,
2308-
false, true);
2309-
}
2310-
23112270
nsresult nsPermissionManager::LegacyTestPermissionFromURI(
23122271
nsIURI* aURI, const mozilla::OriginAttributes* aOriginAttributes,
23132272
const nsACString& aType, uint32_t* aPermission) {
@@ -2340,18 +2299,6 @@ nsPermissionManager::TestPermissionFromPrincipal(nsIPrincipal* aPrincipal,
23402299
false, true);
23412300
}
23422301

2343-
NS_IMETHODIMP
2344-
nsPermissionManager::GetPermissionObjectForURI(nsIURI* aURI,
2345-
const nsACString& aType,
2346-
bool aExactHostMatch,
2347-
nsIPermission** aResult) {
2348-
nsCOMPtr<nsIPrincipal> principal;
2349-
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
2350-
NS_ENSURE_SUCCESS(rv, rv);
2351-
2352-
return GetPermissionObject(principal, aType, aExactHostMatch, aResult);
2353-
}
2354-
23552302
NS_IMETHODIMP
23562303
nsPermissionManager::GetPermissionObject(nsIPrincipal* aPrincipal,
23572304
const nsACString& aType,
@@ -2647,15 +2594,6 @@ NS_IMETHODIMP nsPermissionManager::GetAllWithTypePrefix(
26472594
return NS_OK;
26482595
}
26492596

2650-
NS_IMETHODIMP nsPermissionManager::GetAllForURI(nsIURI* aURI,
2651-
nsISimpleEnumerator** aEnum) {
2652-
nsCOMPtr<nsIPrincipal> principal;
2653-
nsresult rv = GetPrincipal(aURI, getter_AddRefs(principal));
2654-
NS_ENSURE_SUCCESS(rv, rv);
2655-
2656-
return GetAllForPrincipal(principal, aEnum);
2657-
}
2658-
26592597
NS_IMETHODIMP
26602598
nsPermissionManager::GetAllForPrincipal(nsIPrincipal* aPrincipal,
26612599
nsISimpleEnumerator** aEnum) {

netwerk/base/nsIPermissionManager.idl

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include "nsISupports.idl"
3232

33-
interface nsIURI;
3433
interface nsIObserver;
3534
interface nsIPrincipal;
3635
interface mozIDOMWindow;
@@ -75,46 +74,6 @@ interface nsIPermissionManager : nsISupports
7574
const uint32_t EXPIRE_TIME = 2;
7675
const uint32_t EXPIRE_POLICY = 3;
7776

78-
/**
79-
* Add permission information for a given URI and permission type. This
80-
* operation will cause the type string to be registered if it does not
81-
* currently exist. If a permission already exists for a given type, it
82-
* will be modified.
83-
*
84-
* @param uri the uri to add the permission for
85-
* @param type a case-sensitive ASCII string, identifying the consumer.
86-
* Consumers should choose this string to be unique, with
87-
* respect to other consumers.
88-
* @param permission an integer representing the desired action (e.g. allow
89-
* or deny). The interpretation of this number is up to the
90-
* consumer, and may represent different actions for different
91-
* types. Consumers may use one of the enumerated permission
92-
* actions defined above, for convenience.
93-
* NOTE: UNKNOWN_ACTION (0) is reserved to represent the
94-
* default permission when no entry is found for a host, and
95-
* should not be used by consumers to indicate otherwise.
96-
* @param expiretype a constant defining whether this permission should
97-
* never expire (EXPIRE_NEVER), expire at the end of the
98-
* session (EXPIRE_SESSION), or expire at a specified time
99-
* (EXPIRE_TIME).
100-
* @param expiretime an integer representation of when this permission
101-
* should be forgotten (milliseconds since Jan 1 1970 0:00:00).
102-
*/
103-
void add(in nsIURI uri,
104-
in ACString type,
105-
in uint32_t permission,
106-
[optional] in uint32_t expireType,
107-
[optional] in int64_t expireTime);
108-
109-
/**
110-
* Deprecated! Use getAllForPrincipal!
111-
* Get all custom permissions for a given URI. This will return
112-
* an enumerator of all permissions which are not set to default
113-
* and which belong to the matching principal of the given URI.
114-
*
115-
* @param uri the URI to get all permissions for
116-
*/
117-
nsISimpleEnumerator getAllForURI(in nsIURI uri);
11877

11978
/**
12079
* Get all custom permissions for a given nsIPrincipal. This will return an
@@ -147,19 +106,6 @@ interface nsIPermissionManager : nsISupports
147106
[optional] in uint32_t expireType,
148107
[optional] in int64_t expireTime);
149108

150-
/**
151-
* Remove permission information for a given URI and permission type. This will
152-
* remove the permission for the entire host described by the uri, acting as the
153-
* opposite operation to the add() method.
154-
*
155-
* @param uri the uri to remove the permission for
156-
* @param type a case-sensitive ASCII string, identifying the consumer.
157-
* The type must have been previously registered using the
158-
* add() method.
159-
*/
160-
void remove(in nsIURI uri,
161-
in ACString type);
162-
163109
/**
164110
* Remove permission information for a given principal.
165111
* This is internally calling remove() with the host from the principal's URI.
@@ -198,18 +144,6 @@ interface nsIPermissionManager : nsISupports
198144
*/
199145
void removeByTypeSince(in ACString type, in int64_t since);
200146

201-
/**
202-
* Test whether a website has permission to perform the given action.
203-
* This function will perform a pref lookup to permissions.default.<type>
204-
* if the specific permission type is part of the whitelist for that functionality.
205-
* @param uri the uri to be tested
206-
* @param type a case-sensitive ASCII string, identifying the consumer
207-
* @param return see add(), param permission. returns UNKNOWN_ACTION when
208-
* there is no stored permission for this uri and / or type.
209-
*/
210-
uint32_t testPermission(in nsIURI uri,
211-
in ACString type);
212-
213147
/**
214148
* Test whether the principal has the permission to perform a given action.
215149
* System principals will always have permissions granted.
@@ -229,19 +163,6 @@ interface nsIPermissionManager : nsISupports
229163
uint32_t testPermissionFromWindow(in mozIDOMWindow window,
230164
in ACString type);
231165

232-
/**
233-
* Test whether a website has permission to perform the given action.
234-
* This requires an exact hostname match, subdomains are not a match.
235-
* This function will perform a pref lookup to permissions.default.<type>
236-
* if the specific permission type is part of the whitelist for that functionality.
237-
* @param uri the uri to be tested
238-
* @param type a case-sensitive ASCII string, identifying the consumer
239-
* @param return see add(), param permission. returns UNKNOWN_ACTION when
240-
* there is no stored permission for this uri and / or type.
241-
*/
242-
uint32_t testExactPermission(in nsIURI uri,
243-
in ACString type);
244-
245166
/**
246167
* See testExactPermission() above.
247168
* System principals will always have permissions granted.
@@ -266,23 +187,6 @@ interface nsIPermissionManager : nsISupports
266187
uint32_t testExactPermanentPermission(in nsIPrincipal principal,
267188
in ACString type);
268189

269-
/**
270-
* Get the permission object associated with the given URI and action.
271-
* @param uri The URI
272-
* @param type A case-sensitive ASCII string identifying the consumer
273-
* @param exactHost If true, only the specific host will be matched,
274-
* @see testExactPermission. If false, subdomains will
275-
* also be searched, @see testPermission.
276-
* @returns The matching permission object, or null if no matching object
277-
* was found. No matching object is equivalent to UNKNOWN_ACTION.
278-
* @note Clients in general should prefer the test* methods unless they
279-
* need to know the specific stored details.
280-
* @note This method will always return null for the system principal.
281-
*/
282-
nsIPermission getPermissionObjectForURI(in nsIURI uri,
283-
in ACString type,
284-
in boolean exactHost);
285-
286190
/**
287191
* Get the permission object associated with the given principal and action.
288192
* @param principal The principal

0 commit comments

Comments
 (0)