nsIDomainPolicy.idl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. interface nsIURI;
  7. interface nsIDomainSet;
  8. %{ C++
  9. namespace mozilla {
  10. namespace dom {
  11. class DomainPolicyClone;
  12. }
  13. }
  14. %}
  15. [ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone);
  16. /*
  17. * When a domain policy is instantiated by invoking activateDomainPolicy() on
  18. * nsIScriptSecurityManager, these domain sets are consulted when each new
  19. * global is created (they have no effect on already-created globals).
  20. * If javascript is globally enabled with |javascript.enabled|, the blacklists
  21. * are consulted. If globally disabled, the whitelists are consulted. Lookups
  22. * on blacklist and whitelist happen with contains(), and lookups on
  23. * superBlacklist and superWhitelist happen with containsSuperDomain().
  24. *
  25. * When deactivate() is invoked, the domain sets are emptied, and the
  26. * nsIDomainPolicy ceases to have any effect on the system.
  27. */
  28. [scriptable, builtinclass, uuid(82b24a20-6701-4d40-a0f9-f5dc7321b555)]
  29. interface nsIDomainPolicy : nsISupports
  30. {
  31. readonly attribute nsIDomainSet blacklist;
  32. readonly attribute nsIDomainSet superBlacklist;
  33. readonly attribute nsIDomainSet whitelist;
  34. readonly attribute nsIDomainSet superWhitelist;
  35. void deactivate();
  36. [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone);
  37. [noscript, notxpcom] void applyClone(in DomainPolicyClonePtr aClone);
  38. };
  39. [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)]
  40. interface nsIDomainSet : nsISupports
  41. {
  42. /*
  43. * The type of the set. See: DomainSetType
  44. */
  45. [noscript] readonly attribute uint32_t type;
  46. /*
  47. * Add a domain to the set. No-op if it already exists.
  48. */
  49. void add(in nsIURI aDomain);
  50. /*
  51. * Remove a domain from the set. No-op if it doesn't exist.
  52. */
  53. void remove(in nsIURI aDomain);
  54. /*
  55. * Remove all entries from the set.
  56. */
  57. void clear();
  58. /*
  59. * Returns true if a given domain is in the set.
  60. */
  61. bool contains(in nsIURI aDomain);
  62. /*
  63. * Returns true if a given domain is a subdomain of one of the entries in
  64. * the set.
  65. */
  66. bool containsSuperDomain(in nsIURI aDomain);
  67. };