|
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 /* |
|
12 * When a domain policy is instantiated by invoking activateDomainPolicy() on |
|
13 * nsIScriptSecurityManager, these domain sets are consulted when each new |
|
14 * global is created (they have no effect on already-created globals). |
|
15 * If javascript is globally enabled with |javascript.enabled|, the blacklists |
|
16 * are consulted. If globally disabled, the whitelists are consulted. Lookups |
|
17 * on blacklist and whitelist happen with contains(), and lookups on |
|
18 * superBlacklist and superWhitelist happen with containsSuperDomain(). |
|
19 * |
|
20 * When deactivate() is invoked, the domain sets are emptied, and the |
|
21 * nsIDomainPolicy ceases to have any effect on the system. |
|
22 */ |
|
23 [scriptable, builtinclass, uuid(27b10f54-f34b-42b7-8594-4348d3ad7953)] |
|
24 interface nsIDomainPolicy : nsISupports |
|
25 { |
|
26 readonly attribute nsIDomainSet blacklist; |
|
27 readonly attribute nsIDomainSet superBlacklist; |
|
28 readonly attribute nsIDomainSet whitelist; |
|
29 readonly attribute nsIDomainSet superWhitelist; |
|
30 |
|
31 void deactivate(); |
|
32 }; |
|
33 |
|
34 [scriptable, builtinclass, uuid(946a01ff-6525-4007-a2c2-447ebe1875d3)] |
|
35 interface nsIDomainSet : nsISupports |
|
36 { |
|
37 /* |
|
38 * Add a domain to the set. No-op if it already exists. |
|
39 */ |
|
40 void add(in nsIURI aDomain); |
|
41 |
|
42 /* |
|
43 * Remove a domain from the set. No-op if it doesn't exist. |
|
44 */ |
|
45 void remove(in nsIURI aDomain); |
|
46 |
|
47 /* |
|
48 * Remove all entries from the set. |
|
49 */ |
|
50 void clear(); |
|
51 |
|
52 /* |
|
53 * Returns true if a given domain is in the set. |
|
54 */ |
|
55 bool contains(in nsIURI aDomain); |
|
56 |
|
57 /* |
|
58 * Returns true if a given domain is a subdomain of one of the entries in |
|
59 * the set. |
|
60 */ |
|
61 bool containsSuperDomain(in nsIURI aDomain); |
|
62 }; |