Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsIScriptSecurityManager Interface Reference

import "nsIScriptSecurityManager.idl";

Inheritance diagram for nsIScriptSecurityManager:
Inheritance graph
[legend]
Collaboration diagram for nsIScriptSecurityManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void checkPropertyAccess (in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in string aClassName, in JSVal aProperty, in PRUint32 aAction)
 Checks whether the running script is allowed to access aProperty.
void checkConnect (in JSContextPtr aJSContext, in nsIURI aTargetURI, in string aClassName, in string aProperty)
 Checks whether the running script is allowed to connect to aTargetURI.
void checkLoadURIFromScript (in JSContextPtr cx, in nsIURI uri)
 Check that the script currently running in context "cx" can load "uri".
void checkLoadURIWithPrincipal (in nsIPrincipal aPrincipal, in nsIURI uri, in unsigned long flags)
 Check that content with principal aPrincipal can load "uri".
void checkLoadURI (in nsIURI from, in nsIURI uri, in unsigned long flags)
 Check that content from "from" can load "uri".
void checkLoadURIStr (in AUTF8String from, in AUTF8String uri, in unsigned long flags)
 Same as CheckLoadURI but takes string arguments for ease of use by scripts.
void checkFunctionAccess (in JSContextPtr cx, in voidPtr funObj, in voidPtr targetObj)
 Check that the function 'funObj' is allowed to run on 'targetObj'.
boolean canExecuteScripts (in JSContextPtr cx, in nsIPrincipal principal)
 Return true if content from the given principal is allowed to execute scripts.
nsIPrincipal getSubjectPrincipal ()
 Return the principal of the innermost frame of the currently executing script.
nsIPrincipal getSystemPrincipal ()
 Return the all-powerful system principal.
nsIPrincipal getCertificatePrincipal (in AUTF8String aCertFingerprint, in AUTF8String aSubjectName, in AUTF8String aPrettyName, in nsISupports aCert, in nsIURI aURI)
 Return a principal with the specified certificate fingerprint, subject name (the full name or concatenated set of names of the entity represented by the certificate), pretty name, certificate, and codebase URI.
nsIPrincipal getCodebasePrincipal (in nsIURI aURI)
 Return a principal that has the same origin as aURI.
short requestCapability (in nsIPrincipal principal, in string capability)
 Request that 'capability' can be enabled by scripts or applets running with 'principal'.
boolean isCapabilityEnabled (in string capability)
 Return true if the currently executing script has 'capability' enabled.
void enableCapability (in string capability)
 Enable 'capability' in the innermost frame of the currently executing script.
void revertCapability (in string capability)
 Remove 'capability' from the innermost frame of the currently executing script.
void disableCapability (in string capability)
 Disable 'capability' in the innermost frame of the currently executing script.
void setCanEnableCapability (in AUTF8String certificateFingerprint, in string capability, in short canEnable)
 Allow 'certificateID' to enable 'capability.
nsIPrincipal getObjectPrincipal (in JSContextPtr cx, in JSObjectPtr obj)
 Return the principal of the specified object in the specified context.
boolean subjectPrincipalIsSystem ()
 Returns true if the principal of the currently running script is the system principal, false otherwise.
void checkSameOrigin (in JSContextPtr aJSContext, in nsIURI aTargetURI)
 Returns OK if aJSContext and target have the same "origin" (scheme, host, and port).
void checkSameOriginURI (in nsIURI aSourceURI, in nsIURI aTargetURI)
 Returns OK if aSourceURI and target have the same "origin" (scheme, host, and port).
void checkSameOriginPrincipal (in nsIPrincipal aSourcePrincipal, in nsIPrincipal aTargetPrincipal)
 Returns OK if aSourcePrincipal and aTargetPrincipal have the same "origin" (scheme, host, and port).
nsIPrincipal getPrincipalFromContext (in JSContextPtr cx)
 Returns the principal of the global object of the given context, or null if no global or no principal.
boolean securityCompareURIs (in nsIURI aSubjectURI, in nsIURI aObjectURI)
 Utility method for comparing two URIs.
void CanCreateWrapper (in JSContextPtr aJSContext, in nsIIDRef aIID, in nsISupports aObj, in nsIClassInfo aClassInfo, inout voidPtr aPolicy)
 For each of these hooks returning NS_OK means 'let the action continue'.
void CanCreateInstance (in JSContextPtr aJSContext, in nsCIDRef aCID)
void CanGetService (in JSContextPtr aJSContext, in nsCIDRef aCID)
void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in JSVal aName, inout voidPtr aPolicy)

Public Attributes

const unsigned long STANDARD = 0
 Default CheckLoadURI permissions.
const unsigned long DISALLOW_FROM_MAIL = 1 << 0
const unsigned long ALLOW_CHROME = 1 << 1
const unsigned long DISALLOW_SCRIPT_OR_DATA = 1 << 2
const unsigned long DISALLOW_SCRIPT = 1 << 3
const PRUint32 HOOK_CREATE_WRAPPER = 1 << 0
 These flags are used when calling nsIXPConnect::SetSecurityManager.
const PRUint32 HOOK_CREATE_INSTANCE = 1 << 1
const PRUint32 HOOK_GET_SERVICE = 1 << 2
const PRUint32 HOOK_CALL_METHOD = 1 << 3
const PRUint32 HOOK_GET_PROPERTY = 1 << 4
const PRUint32 HOOK_SET_PROPERTY = 1 << 5
const PRUint32 HOOK_ALL
const PRUint32 ACCESS_CALL_METHOD = 0
const PRUint32 ACCESS_GET_PROPERTY = 1
const PRUint32 ACCESS_SET_PROPERTY = 2

Detailed Description

Definition at line 45 of file nsIScriptSecurityManager.idl.


Member Function Documentation

void nsIXPCSecurityManager::CanAccess ( in PRUint32  aAction,
in nsIXPCNativeCallContext  aCallContext,
in JSContextPtr  aJSContext,
in JSObjectPtr  aJSObject,
in nsISupports  aObj,
in nsIClassInfo  aClassInfo,
in JSVal  aName,
inout voidPtr  aPolicy 
) [inherited]

Here is the caller graph for this function:

void nsIXPCSecurityManager::CanCreateInstance ( in JSContextPtr  aJSContext,
in nsCIDRef  aCID 
) [inherited]

Here is the caller graph for this function:

void nsIXPCSecurityManager::CanCreateWrapper ( in JSContextPtr  aJSContext,
in nsIIDRef  aIID,
in nsISupports  aObj,
in nsIClassInfo  aClassInfo,
inout voidPtr  aPolicy 
) [inherited]

For each of these hooks returning NS_OK means 'let the action continue'.

Returning an error code means 'veto the action'. XPConnect will return JS_FALSE to the js engine if the action is vetoed. The implementor of this interface is responsible for setting a JS exception into the JSContext if that is appropriate.

Return true if content from the given principal is allowed to execute scripts.

void nsIXPCSecurityManager::CanGetService ( in JSContextPtr  aJSContext,
in nsCIDRef  aCID 
) [inherited]
void nsIScriptSecurityManager::checkConnect ( in JSContextPtr  aJSContext,
in nsIURI  aTargetURI,
in string  aClassName,
in string  aProperty 
)

Checks whether the running script is allowed to connect to aTargetURI.

void nsIScriptSecurityManager::checkFunctionAccess ( in JSContextPtr  cx,
in voidPtr  funObj,
in voidPtr  targetObj 
)

Check that the function 'funObj' is allowed to run on 'targetObj'.

Will return error code NS_ERROR_DOM_SECURITY_ERR if the function should not run

Parameters:
cxThe current active JavaScript context.
funObjThe function trying to run..
targetObjThe object the function will run on.
void nsIScriptSecurityManager::checkLoadURI ( in nsIURI  from,
in nsIURI  uri,
in unsigned long  flags 
)

Check that content from "from" can load "uri".

Will return error code NS_ERROR_DOM_BAD_URI if the load request should be denied.

Parameters:
fromthe URI causing the load
urithe URI that is being loaded
flagsthe permission set, see above

Check that the script currently running in context "cx" can load "uri".

Will return error code NS_ERROR_DOM_BAD_URI if the load request should be denied.

Parameters:
cxthe JSContext of the script causing the load
urithe URI that is being loaded
void nsIScriptSecurityManager::checkLoadURIStr ( in AUTF8String  from,
in AUTF8String  uri,
in unsigned long  flags 
)

Same as CheckLoadURI but takes string arguments for ease of use by scripts.

Check that content with principal aPrincipal can load "uri".

Will return error code NS_ERROR_DOM_BAD_URI if the load request should be denied.

Parameters:
aPrincipalthe URI causing the load
urithe URI that is being loaded
flagsthe permission set, see above
void nsIScriptSecurityManager::checkPropertyAccess ( in JSContextPtr  aJSContext,
in JSObjectPtr  aJSObject,
in string  aClassName,
in JSVal  aProperty,
in PRUint32  aAction 
)

Checks whether the running script is allowed to access aProperty.

Returns OK if aJSContext and target have the same "origin" (scheme, host, and port).

Returns OK if aSourcePrincipal and aTargetPrincipal have the same "origin" (scheme, host, and port).

Returns OK if aSourceURI and target have the same "origin" (scheme, host, and port).

Disable 'capability' in the innermost frame of the currently executing script.

Enable 'capability' in the innermost frame of the currently executing script.

nsIPrincipal nsIScriptSecurityManager::getCertificatePrincipal ( in AUTF8String  aCertFingerprint,
in AUTF8String  aSubjectName,
in AUTF8String  aPrettyName,
in nsISupports  aCert,
in nsIURI  aURI 
)

Return a principal with the specified certificate fingerprint, subject name (the full name or concatenated set of names of the entity represented by the certificate), pretty name, certificate, and codebase URI.

The certificate fingerprint and subject name MUST be nonempty; otherwise an error will be thrown. Similarly, aCert must not be null.

Return a principal that has the same origin as aURI.

Return the principal of the specified object in the specified context.

Returns the principal of the global object of the given context, or null if no global or no principal.

Return the principal of the innermost frame of the currently executing script.

Will return null if there is no script currently executing.

Return the all-powerful system principal.

Return true if the currently executing script has 'capability' enabled.

short nsIScriptSecurityManager::requestCapability ( in nsIPrincipal  principal,
in string  capability 
)

Request that 'capability' can be enabled by scripts or applets running with 'principal'.

Will prompt user if necessary. Returns nsIPrincipal::ENABLE_GRANTED or nsIPrincipal::ENABLE_DENIED based on user's choice.

Remove 'capability' from the innermost frame of the currently executing script.

Any setting of 'capability' from enclosing frames thus comes into effect.

Utility method for comparing two URIs.

For security purposes, two URIs are equivalent if their schemes, hosts, and ports (if any) match. This method returns true if aSubjectURI and aObjectURI have the same origin, false otherwise.

void nsIScriptSecurityManager::setCanEnableCapability ( in AUTF8String  certificateFingerprint,
in string  capability,
in short  canEnable 
)

Allow 'certificateID' to enable 'capability.

' Can only be performed by code signed by the system certificate.

Returns true if the principal of the currently running script is the system principal, false otherwise.


Member Data Documentation

Definition at line 98 of file nsIXPCSecurityManager.idl.

Definition at line 99 of file nsIXPCSecurityManager.idl.

Definition at line 100 of file nsIXPCSecurityManager.idl.

Definition at line 86 of file nsIScriptSecurityManager.idl.

Definition at line 83 of file nsIScriptSecurityManager.idl.

Definition at line 94 of file nsIScriptSecurityManager.idl.

Definition at line 89 of file nsIScriptSecurityManager.idl.

Definition at line 64 of file nsIXPCSecurityManager.idl.

Definition at line 62 of file nsIXPCSecurityManager.idl.

These flags are used when calling nsIXPConnect::SetSecurityManager.

Definition at line 61 of file nsIXPCSecurityManager.idl.

Definition at line 65 of file nsIXPCSecurityManager.idl.

Definition at line 63 of file nsIXPCSecurityManager.idl.

Definition at line 66 of file nsIXPCSecurityManager.idl.

Default CheckLoadURI permissions.

Definition at line 80 of file nsIScriptSecurityManager.idl.


The documentation for this interface was generated from the following file: