nsIPermission.idl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include "nsISupports.idl"
  7. interface nsIPrincipal;
  8. interface nsIURI;
  9. [scriptable, uuid(bb409a51-2371-4fea-9dc9-b7286a458b8c)]
  10. /**
  11. * This interface defines a "permission" object,
  12. * used to specify allowed/blocked objects from
  13. * user-specified sites (cookies, images etc).
  14. */
  15. interface nsIPermission : nsISupports
  16. {
  17. /**
  18. * The principal for which this permission applies.
  19. */
  20. readonly attribute nsIPrincipal principal;
  21. /**
  22. * a case-sensitive ASCII string, indicating the type of permission
  23. * (e.g., "cookie", "image", etc).
  24. * This string is specified by the consumer when adding a permission
  25. * via nsIPermissionManager.
  26. * @see nsIPermissionManager
  27. */
  28. readonly attribute ACString type;
  29. /**
  30. * The permission (see nsIPermissionManager.idl for allowed values)
  31. */
  32. readonly attribute uint32_t capability;
  33. /**
  34. * The expiration type of the permission (session, time-based or none).
  35. * Constants are EXPIRE_*, defined in nsIPermissionManager.
  36. * @see nsIPermissionManager
  37. */
  38. readonly attribute uint32_t expireType;
  39. /**
  40. * The expiration time of the permission (milliseconds since Jan 1 1970
  41. * 0:00:00).
  42. */
  43. readonly attribute int64_t expireTime;
  44. /**
  45. * Test whether a principal would be affected by this permission.
  46. *
  47. * @param principal the principal to test
  48. * @param exactHost If true, only the specific host will be matched,
  49. * @see nsIPermissionManager::testExactPermission.
  50. * If false, subdomains will also be searched,
  51. * @see nsIPermissionManager::testPermission.
  52. */
  53. boolean matches(in nsIPrincipal principal,
  54. in boolean exactHost);
  55. /**
  56. * Test whether a URI would be affected by this permission.
  57. * NOTE: This performs matches with default origin attribute values.
  58. *
  59. * @param uri the uri to test
  60. * @param exactHost If true, only the specific host will be matched,
  61. * @see nsIPermissionManager::testExactPermission.
  62. * If false, subdomains will also be searched,
  63. * @see nsIPermissionManager::testPermission.
  64. */
  65. boolean matchesURI(in nsIURI uri,
  66. in boolean exactHost);
  67. };