1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/. */
7 #include
"nsISupports.idl"
11 * This interface allows the security manager to query custom per-addon security
14 [scriptable
, uuid(8a034ef9
-9d14
-4c5d
-8319-06c1ab574baa
)]
15 interface nsIAddonPolicyService
: nsISupports
18 * Returns the base content security policy, which is applied to all
19 * extension documents, in addition to any custom policies.
21 readonly attribute AString baseCSP
;
24 * Returns the default content security policy which applies to extension
25 * documents which do not specify any custom policies.
27 readonly attribute AString defaultCSP
;
30 * Returns the content security policy which applies to documents belonging
31 * to the extension with the given ID. This may be either a custom policy,
32 * if one was supplied, or the default policy if one was not.
34 AString getExtensionPageCSP
(in AString aAddonId
);
37 * Returns the content security policy which applies to content scripts belonging
38 * to the extension with the given ID. This may be either a custom policy,
39 * if one was supplied, or the default policy if one was not.
41 AString getContentScriptCSP
(in AString aAddonId
);
44 * Returns the generated background page as a data-URI, if any. If the addon
45 * does not have an auto-generated background page, an empty string is
48 ACString getGeneratedBackgroundPageUrl
(in ACString aAddonId
);
51 * Returns true if the addon was granted the |aPerm| API permission.
53 boolean addonHasPermission
(in AString aAddonId
, in AString aPerm
);
56 * Returns true if unprivileged code associated with the given addon may load
57 * data from |aURI|. If |aExplicit| is true, the <all_urls> permission and
58 * permissive host globs are ignored when checking for a match.
60 boolean addonMayLoadURI
(in AString aAddonId
, in nsIURI aURI
, [optional] in boolean aExplicit
);
63 * Returns the name of the WebExtension with the given ID, or the ID string
64 * if no matching add-on can be found.
66 AString getExtensionName
(in AString aAddonId
);
69 * Returns true if a given extension:// URI is web-accessible.
71 boolean extensionURILoadableByAnyone
(in nsIURI aURI
);
74 * Maps an extension URI to the ID of the addon it belongs to.
76 AString extensionURIToAddonId
(in nsIURI aURI
);
80 * This interface exposes functionality related to add-on content policy
83 [scriptable
, uuid(7a4fe60b
-9131-45f5
-83f3
-dc63b5d71a5d
)]
84 interface nsIAddonContentPolicy
: nsISupports
87 * Checks a custom content security policy string, to ensure that it meets
88 * minimum security requirements. Returns null for valid policies, or a
89 * string describing the error for invalid policies.
91 AString validateAddonCSP
(in AString aPolicyString
);