nsIDomainPolicy.idl (2426B)
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 6 #include "nsISupports.idl" 7 8 interface nsIURI; 9 interface nsIDomainSet; 10 11 %{ C++ 12 namespace mozilla { 13 namespace dom { 14 class DomainPolicyClone; 15 } 16 } 17 %} 18 19 [ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone); 20 [ptr] native DomainPolicyCloneConstPtr(const mozilla::dom::DomainPolicyClone); 21 22 /* 23 * When a domain policy is instantiated by invoking activateDomainPolicy() on 24 * nsIScriptSecurityManager, these domain sets are consulted when each new 25 * global is created (they have no effect on already-created globals). 26 * If javascript is globally enabled with |javascript.enabled|, the blocklists 27 * are consulted. If globally disabled, the allowlists are consulted. Lookups 28 * on blocklist and allowlist happen with contains(), and lookups on 29 * superBlocklist and superAllowlist happen with containsSuperDomain(). 30 * 31 * When deactivate() is invoked, the domain sets are emptied, and the 32 * nsIDomainPolicy ceases to have any effect on the system. 33 */ 34 [scriptable, builtinclass, uuid(82b24a20-6701-4d40-a0f9-f5dc7321b555)] 35 interface nsIDomainPolicy : nsISupports 36 { 37 readonly attribute nsIDomainSet blocklist; 38 readonly attribute nsIDomainSet superBlocklist; 39 readonly attribute nsIDomainSet allowlist; 40 readonly attribute nsIDomainSet superAllowlist; 41 42 void deactivate(); 43 44 [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone); 45 [noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone); 46 }; 47 48 [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)] 49 interface nsIDomainSet : nsISupports 50 { 51 /* 52 * Add a domain to the set. No-op if it already exists. 53 */ 54 void add(in nsIURI aDomain); 55 56 /* 57 * Remove a domain from the set. No-op if it doesn't exist. 58 */ 59 void remove(in nsIURI aDomain); 60 61 /* 62 * Remove all entries from the set. 63 */ 64 void clear(); 65 66 /* 67 * Returns true if a given domain is in the set. 68 */ 69 boolean contains(in nsIURI aDomain); 70 71 /* 72 * Returns true if a given domain is a subdomain of one of the entries in 73 * the set. 74 */ 75 boolean containsSuperDomain(in nsIURI aDomain); 76 };