2015-07-08 03:53:15 +03:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIURI.idl"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This interface allows the security manager to query custom per-addon security
|
|
|
|
* policy.
|
|
|
|
*/
|
2015-07-21 00:46:58 +03:00
|
|
|
[scriptable,uuid(8a034ef9-9d14-4c5d-8319-06c1ab574baa)]
|
2015-07-08 03:53:15 +03:00
|
|
|
interface nsIAddonPolicyService : nsISupports
|
|
|
|
{
|
2016-04-24 07:29:15 +03:00
|
|
|
/**
|
|
|
|
* Returns the base content security policy, which is applied to all
|
|
|
|
* extension documents, in addition to any custom policies.
|
|
|
|
*/
|
|
|
|
readonly attribute AString baseCSP;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the default content security policy which applies to extension
|
|
|
|
* documents which do not specify any custom policies.
|
|
|
|
*/
|
|
|
|
readonly attribute AString defaultCSP;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the content security policy which applies to documents belonging
|
|
|
|
* to the extension with the given ID. This may be either a custom policy,
|
|
|
|
* if one was supplied, or the default policy if one was not.
|
|
|
|
*/
|
|
|
|
AString getAddonCSP(in AString aAddonId);
|
|
|
|
|
2015-07-08 03:53:15 +03:00
|
|
|
/**
|
|
|
|
* Returns true if unprivileged code associated with the given addon may load
|
|
|
|
* data from |aURI|.
|
|
|
|
*/
|
|
|
|
boolean addonMayLoadURI(in AString aAddonId, in nsIURI aURI);
|
2015-07-20 04:42:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if a given extension:// URI is web-accessible.
|
|
|
|
*/
|
|
|
|
boolean extensionURILoadableByAnyone(in nsIURI aURI);
|
2015-07-21 00:46:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps an extension URI to the ID of the addon it belongs to.
|
|
|
|
*/
|
|
|
|
AString extensionURIToAddonId(in nsIURI aURI);
|
2015-07-08 03:53:15 +03:00
|
|
|
};
|
2016-04-24 06:41:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This interface exposes functionality related to add-on content policy
|
|
|
|
* enforcement.
|
|
|
|
*/
|
|
|
|
[scriptable,uuid(7a4fe60b-9131-45f5-83f3-dc63b5d71a5d)]
|
|
|
|
interface nsIAddonContentPolicy : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Checks a custom content security policy string, to ensure that it meets
|
|
|
|
* minimum security requirements. Returns null for valid policies, or a
|
|
|
|
* string describing the error for invalid policies.
|
|
|
|
*/
|
|
|
|
AString validateAddonCSP(in AString aPolicyString);
|
|
|
|
};
|