1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/caps/idl/nsIDomainPolicy.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIURI; 1.12 +interface nsIDomainSet; 1.13 + 1.14 +/* 1.15 + * When a domain policy is instantiated by invoking activateDomainPolicy() on 1.16 + * nsIScriptSecurityManager, these domain sets are consulted when each new 1.17 + * global is created (they have no effect on already-created globals). 1.18 + * If javascript is globally enabled with |javascript.enabled|, the blacklists 1.19 + * are consulted. If globally disabled, the whitelists are consulted. Lookups 1.20 + * on blacklist and whitelist happen with contains(), and lookups on 1.21 + * superBlacklist and superWhitelist happen with containsSuperDomain(). 1.22 + * 1.23 + * When deactivate() is invoked, the domain sets are emptied, and the 1.24 + * nsIDomainPolicy ceases to have any effect on the system. 1.25 + */ 1.26 +[scriptable, builtinclass, uuid(27b10f54-f34b-42b7-8594-4348d3ad7953)] 1.27 +interface nsIDomainPolicy : nsISupports 1.28 +{ 1.29 + readonly attribute nsIDomainSet blacklist; 1.30 + readonly attribute nsIDomainSet superBlacklist; 1.31 + readonly attribute nsIDomainSet whitelist; 1.32 + readonly attribute nsIDomainSet superWhitelist; 1.33 + 1.34 + void deactivate(); 1.35 +}; 1.36 + 1.37 +[scriptable, builtinclass, uuid(946a01ff-6525-4007-a2c2-447ebe1875d3)] 1.38 +interface nsIDomainSet : nsISupports 1.39 +{ 1.40 + /* 1.41 + * Add a domain to the set. No-op if it already exists. 1.42 + */ 1.43 + void add(in nsIURI aDomain); 1.44 + 1.45 + /* 1.46 + * Remove a domain from the set. No-op if it doesn't exist. 1.47 + */ 1.48 + void remove(in nsIURI aDomain); 1.49 + 1.50 + /* 1.51 + * Remove all entries from the set. 1.52 + */ 1.53 + void clear(); 1.54 + 1.55 + /* 1.56 + * Returns true if a given domain is in the set. 1.57 + */ 1.58 + bool contains(in nsIURI aDomain); 1.59 + 1.60 + /* 1.61 + * Returns true if a given domain is a subdomain of one of the entries in 1.62 + * the set. 1.63 + */ 1.64 + bool containsSuperDomain(in nsIURI aDomain); 1.65 +};