1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
7 interface nsIPrincipal
;
8 interface mozIDOMWindow
;
14 * Interface provides the request type and its access.
16 [scriptable
, uuid(ef4db3b8
-ca9c
-4b1d
-8f81
-fd88ec32af13
)]
17 interface nsIContentPermissionType
: nsISupports
{
19 * The type of the permission request, such as
22 readonly attribute ACString type
;
25 * The array of available options.
27 readonly attribute nsIArray options
; // ["choice1", "choice2"]
31 * Interface allows access to a content to request
32 * permission to perform a privileged operation such as
35 [scriptable
, uuid(875733da
-0ac0
-4a26
-8c76
-70a30876be46
)]
36 interface nsIContentPermissionRequest
: nsISupports
{
38 * The array will include the request types. Elements of this array are
39 * nsIContentPermissionType object.
41 readonly attribute nsIArray types
;
44 * The principal of the permission request.
46 readonly attribute nsIPrincipal principal
;
49 * The principal of the top-level page the permission request comes from.
51 readonly attribute nsIPrincipal topLevelPrincipal
;
54 * The window or element that the permission request was
55 * originated in. Typically the element will be non-null
56 * in when using out of process content. window or
57 * element can be null but not both.
59 readonly attribute mozIDOMWindow window
;
60 readonly attribute Element element
;
62 readonly attribute
boolean hasValidTransientUserGestureActivation
;
65 * See nsIPermissionDelegateHandler.maybeUnsafePermissionDelegate.
67 readonly attribute
boolean isRequestDelegatedToUnsafeThirdParty
;
70 * Get delegate principal of the permission request. This will return nullptr,
71 * or request's principal or top level principal based on the delegate policy
72 * will be applied for a given type.
74 * @param aType the permission type to get
76 nsIPrincipal getDelegatePrincipal
(in ACString aType
);
79 * allow or cancel the request
84 void allow
([optional] in jsval choices
); // {"type1": "choice1", "type2": "choiceA"}
88 * Allows to show permission prompts via the UI for different types of requests,
91 [scriptable
, function
, uuid(F72DE90D
-E954
-4E69
-9A61
-917303029301)]
92 interface nsIContentPermissionPrompt
: nsISupports
{
94 * Called when a request has been made to access
95 * privileged content apis
97 void prompt
(in nsIContentPermissionRequest request
);
101 #define NS_CONTENT_PERMISSION_PROMPT_CONTRACTID
"@mozilla.org/content-permission/prompt;1"