1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
9 interface nsIPrincipal
;
13 * This interface defines a "permission" object,
14 * used to specify allowed/blocked objects from
15 * user-specified sites (cookies, images etc).
17 [scriptable
, uuid(bb409a51
-2371-4fea
-9dc9
-b7286a458b8c
)]
18 interface nsIPermission
: nsISupports
21 * The principal for which this permission applies.
23 readonly attribute nsIPrincipal principal
;
26 * a case-sensitive ASCII string, indicating the type of permission
27 * (e.g., "cookie", "image", etc).
28 * This string is specified by the consumer when adding a permission
29 * via nsIPermissionManager.
30 * @see nsIPermissionManager
32 readonly attribute ACString type
;
35 * The permission (see nsIPermissionManager.idl for allowed values)
37 readonly attribute uint32_t capability
;
40 * The expiration type of the permission (session, time-based or none).
41 * Constants are EXPIRE_*, defined in nsIPermissionManager.
42 * @see nsIPermissionManager
44 readonly attribute uint32_t expireType
;
47 * The expiration time of the permission (milliseconds since Jan 1 1970
50 readonly attribute int64_t expireTime
;
53 * The last modification time of the permission (milliseconds since Jan 1 1970
56 readonly attribute int64_t modificationTime
;
59 * Test whether a principal would be affected by this permission.
61 * @param principal the principal to test
62 * @param exactHost If true, only the specific host will be matched,
63 * @see nsIPermissionManager::testExactPermission.
64 * If false, subdomains will also be searched,
65 * @see nsIPermissionManager::testPermission.
67 boolean matches
(in nsIPrincipal principal
,
68 in boolean exactHost
);
71 * Test whether a URI would be affected by this permission.
72 * NOTE: This performs matches with default origin attribute values.
74 * @param uri the uri to test
75 * @param exactHost If true, only the specific host will be matched,
76 * @see nsIPermissionManager::testExactPermission.
77 * If false, subdomains will also be searched,
78 * @see nsIPermissionManager::testPermission.
80 boolean matchesURI
(in nsIURI uri
,
81 in boolean exactHost
);