nsIPermission.idl (2804B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * 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/. */ 6 7 #include "nsISupports.idl" 8 9 interface nsIPrincipal; 10 interface nsIURI; 11 12 /** 13 * This interface defines a "permission" object, 14 * used to specify allowed/blocked objects from 15 * user-specified sites (cookies, images etc). 16 */ 17 [scriptable, uuid(bb409a51-2371-4fea-9dc9-b7286a458b8c)] 18 interface nsIPermission : nsISupports 19 { 20 /** 21 * The principal for which this permission applies. 22 */ 23 readonly attribute nsIPrincipal principal; 24 25 /** 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 31 */ 32 readonly attribute ACString type; 33 34 /** 35 * The permission (see nsIPermissionManager.idl for allowed values) 36 */ 37 readonly attribute uint32_t capability; 38 39 /** 40 * The expiration type of the permission (session, time-based or none). 41 * Constants are EXPIRE_*, defined in nsIPermissionManager. 42 * @see nsIPermissionManager 43 */ 44 readonly attribute uint32_t expireType; 45 46 /** 47 * The expiration time of the permission (milliseconds since Jan 1 1970 48 * 0:00:00). 49 */ 50 readonly attribute int64_t expireTime; 51 52 /** 53 * The last modification time of the permission (milliseconds since Jan 1 1970 54 * 0:00:00). 55 */ 56 readonly attribute int64_t modificationTime; 57 58 /** 59 * Test whether a principal would be affected by this permission. 60 * 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. 66 */ 67 boolean matches(in nsIPrincipal principal, 68 in boolean exactHost); 69 70 /** 71 * Test whether a URI would be affected by this permission. 72 * NOTE: This performs matches with default origin attribute values. 73 * 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. 79 */ 80 boolean matchesURI(in nsIURI uri, 81 in boolean exactHost); 82 };