Back to index

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

import "nsIXPConnect.idl";

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

List of all members.

Public Member Functions

JSVal evalInSandboxObject2 (in AString source, in JSContextPtr cx, in nsIXPConnectJSObjectHolder sandbox, in PRBool returnStringOnly)
 Evaluate script in a sandbox, completely isolated from all other running scripts.
void reparentScopeAwareWrappers (in JSContextPtr aJSContext, in JSObjectPtr aOldScope, in JSObjectPtr aNewScope)
nsIXPConnectJSObjectHolder createSandbox (in JSContextPtr cx, in nsIPrincipal principal)
 Create a sandbox for evaluating code in isolation using evalInSandboxObject().
JSVal evalInSandboxObject (in AString source, in JSContextPtr cx, in nsIXPConnectJSObjectHolder sandbox)
 Evaluate script in a sandbox, completely isolated from all other running scripts.
void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj)
nsIXPConnectJSObjectHolder initClassesWithNewWrappedGlobal (in JSContextPtr aJSContext, in nsISupports aCOMObj, in nsIIDRef aIID, in PRUint32 aFlags)
nsIXPConnectJSObjectHolder wrapNative (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID)
 wrapNative will create a new JSObject or return an existing one.
void wrapJS (in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 wrapJS will yield a new or previously existing xpcom interface pointer to represent the JSObject passed in.
nsIXPConnectWrappedNative getWrappedNativeOfJSObject (in JSContextPtr aJSContext, in JSObjectPtr aJSObj)
 This only succeeds if the JSObject is a nsIXPConnectWrappedNative.
void setSecurityManagerForJSContext (in JSContextPtr aJSContext, in nsIXPCSecurityManager aManager, in PRUint16 flags)
void getSecurityManagerForJSContext (in JSContextPtr aJSContext, out nsIXPCSecurityManager aManager, out PRUint16 flags)
void setDefaultSecurityManager (in nsIXPCSecurityManager aManager, in PRUint16 flags)
 The security manager to use when the current JSContext has no security manager.
void getDefaultSecurityManager (out nsIXPCSecurityManager aManager, out PRUint16 flags)
nsIStackFrame createStackFrameLocation (in PRUint32 aLanguage, in string aFilename, in string aFunctionName, in PRInt32 aLineNumber, in nsIStackFrame aCaller)
void syncJSContexts ()
 XPConnect builds internal objects that parallel, and are one-to-one with, the JSContexts in the JSRuntime.
void debugDump (in short depth)
void debugDumpObject (in nsISupports aCOMObj, in short depth)
void debugDumpJSStack (in PRBool showArgs, in PRBool showLocals, in PRBool showThisProps)
void debugDumpEvalInJSStackFrame (in PRUint32 aFrameNumber, in string aSourceText)
void setSafeJSContextForCurrentThread (in JSContextPtr cx)
 Set fallback JSContext to use when xpconnect can't find an appropriate context to use to execute JavaScript.
void wrapJSAggregatedToNative (in nsISupports aOuter, in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 wrapJSAggregatedToNative is just like wrapJS except it is used in cases where the JSObject is also aggregated to some native xpcom Object.
nsIXPConnectWrappedNative getWrappedNativeOfNativeObject (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID)
 This only succeeds if the native object is already wrapped by xpconnect.
nsIXPCFunctionThisTranslator getFunctionThisTranslator (in nsIIDRef aIID)
nsIXPCFunctionThisTranslator setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator)
nsIXPConnectJSObjectHolder reparentWrappedNativeIfFound (in JSContextPtr aJSContext, in JSObjectPtr aScope, in JSObjectPtr aNewParent, in nsISupports aCOMObj)
void clearAllWrappedNativeSecurityPolicies ()
nsIXPConnectJSObjectHolder getWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo)
void releaseJSContext (in JSContextPtr aJSContext, in PRBool noGC)
JSVal variantToJS (in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value)
nsIVariant JSToVariant (in JSContextPtr ctx, in JSVal value)
void flagSystemFilenamePrefix (in string aFilenamePrefix)
 Preconfigure XPCNativeWrapper automation so that when a scripted caller whose filename starts with filenamePrefix accesses a wrapped native that is not flagged as "system", the wrapped native will be automatically wrapped with an XPCNativeWrapper.
void restoreWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo, in nsIXPConnectJSObjectHolder aPrototype)
 Restore an old prototype for wrapped natives of type aClassInfo.

Public Attributes

const PRUint32 INIT_JS_STANDARD_CLASSES = 1 << 0
const PRUint32 FLAG_SYSTEM_GLOBAL_OBJECT = 1 << 1
readonly attribute nsIStackFrame CurrentJSStack
readonly attribute
nsIXPCNativeCallContext 
CurrentNativeCallContext
attribute nsIException PendingException
attribute PRBool collectGarbageOnMainThreadOnly
attribute PRBool deferReleasesUntilAfterGarbageCollection

Detailed Description

Definition at line 725 of file nsIXPConnect.idl.


Member Function Documentation

Create a sandbox for evaluating code in isolation using evalInSandboxObject().

Parameters:
cxA context to use when creating the sandbox object.
principalThe principal (or NULL to use the null principal) to use when evaluating code in this sandbox.
nsIStackFrame nsIXPConnect::createStackFrameLocation ( in PRUint32  aLanguage,
in string  aFilename,
in string  aFunctionName,
in PRInt32  aLineNumber,
in nsIStackFrame  aCaller 
) [inherited]
void nsIXPConnect::debugDump ( in short  depth) [inherited]
void nsIXPConnect::debugDumpEvalInJSStackFrame ( in PRUint32  aFrameNumber,
in string  aSourceText 
) [inherited]
void nsIXPConnect::debugDumpJSStack ( in PRBool  showArgs,
in PRBool  showLocals,
in PRBool  showThisProps 
) [inherited]
void nsIXPConnect::debugDumpObject ( in nsISupports  aCOMObj,
in short  depth 
) [inherited]

Evaluate script in a sandbox, completely isolated from all other running scripts.

Parameters:
sourceThe source of the script to evaluate.
cxThe context to use when setting up the evaluation of the script. The actual evaluation will happen on a new temporary context.
sandboxThe sandbox object to evaluate the script in.
Returns:
The result of the evaluation as a jsval. If the caller intends to use the return value from this call the caller is responsible for rooting the jsval before making a call to this method.

Evaluate script in a sandbox, completely isolated from all other running scripts.

Parameters:
sourceThe source of the script to evaluate.
cxThe context to use when setting up the evaluation of the script. The actual evaluation will happen on a new temporary context.
sandboxThe sandbox object to evaluate the script in.
returnStringOnlyThe only results to come out of the computation (including exceptions) will be coerced into strings created in the sandbox.
Returns:
The result of the evaluation as a jsval. If the caller intends to use the return value from this call the caller is responsible for rooting the jsval before making a call to this method.
void nsIXPConnect::flagSystemFilenamePrefix ( in string  aFilenamePrefix) [inherited]

Preconfigure XPCNativeWrapper automation so that when a scripted caller whose filename starts with filenamePrefix accesses a wrapped native that is not flagged as "system", the wrapped native will be automatically wrapped with an XPCNativeWrapper.

Parameters:
aFilenamePrefixthe UTF-8 filename prefix to match, which should end with a slash (/) character

This only succeeds if the JSObject is a nsIXPConnectWrappedNative.

A new wrapper is never constructed.

nsIXPConnectWrappedNative nsIXPConnect::getWrappedNativeOfNativeObject ( in JSContextPtr  aJSContext,
in JSObjectPtr  aScope,
in nsISupports  aCOMObj,
in nsIIDRef  aIID 
) [inherited]

This only succeeds if the native object is already wrapped by xpconnect.

A new wrapper is never constructed.

void nsIXPConnect::initClasses ( in JSContextPtr  aJSContext,
in JSObjectPtr  aGlobalJSObj 
) [inherited]
nsIXPConnectJSObjectHolder nsIXPConnect::initClassesWithNewWrappedGlobal ( in JSContextPtr  aJSContext,
in nsISupports  aCOMObj,
in nsIIDRef  aIID,
in PRUint32  aFlags 
) [inherited]
nsIVariant nsIXPConnect::JSToVariant ( in JSContextPtr  ctx,
in JSVal  value 
) [inherited]
void nsIXPConnect::releaseJSContext ( in JSContextPtr  aJSContext,
in PRBool  noGC 
) [inherited]
nsIXPConnectJSObjectHolder nsIXPConnect::reparentWrappedNativeIfFound ( in JSContextPtr  aJSContext,
in JSObjectPtr  aScope,
in JSObjectPtr  aNewParent,
in nsISupports  aCOMObj 
) [inherited]
void nsIXPConnect::restoreWrappedNativePrototype ( in JSContextPtr  aJSContext,
in JSObjectPtr  aScope,
in nsIClassInfo  aClassInfo,
in nsIXPConnectJSObjectHolder  aPrototype 
) [inherited]

Restore an old prototype for wrapped natives of type aClassInfo.

This should be used only when restoring an old scope into a state close to where it was prior to being reinitialized.

The security manager to use when the current JSContext has no security manager.

Set fallback JSContext to use when xpconnect can't find an appropriate context to use to execute JavaScript.

NOTE: This method is DEPRECATED. Use nsIThreadJSContextStack::safeJSContext instead.

XPConnect builds internal objects that parallel, and are one-to-one with, the JSContexts in the JSRuntime.

It builds these objects as needed. This method tells XPConnect to resynchronize its representations with the list of JSContexts currently 'alive' in the JSRuntime. This allows it to cleanup any representations of JSContexts that are no longer valid.

JSVal nsIXPConnect::variantToJS ( in JSContextPtr  ctx,
in JSObjectPtr  scope,
in nsIVariant  value 
) [inherited]
void nsIXPConnect::wrapJS ( in JSContextPtr  aJSContext,
in JSObjectPtr  aJSObj,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

wrapJS will yield a new or previously existing xpcom interface pointer to represent the JSObject passed in.

This method now correctly deals with cases where the passed in JSObject already has an associated xpcom interface for the cases: 1) The JSObject has already been wrapped as a nsIXPConnectWrappedJS. 2) The JSObject is in fact a nsIXPConnectWrappedNative and thus already has an underlying xpcom object. 3) The JSObject is of a jsclass which supports getting the nsISupports from the JSObject directly. This is used for idlc style objects (e.g. DOM objects).

It might be possible to QueryInterface the resulting interface pointer to nsIXPConnectWrappedJS.

Returns: success: NS_OK failure: NS_ERROR_XPC_BAD_CONVERT_JS NS_ERROR_FAILURE

void nsIXPConnect::wrapJSAggregatedToNative ( in nsISupports  aOuter,
in JSContextPtr  aJSContext,
in JSObjectPtr  aJSObj,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

wrapJSAggregatedToNative is just like wrapJS except it is used in cases where the JSObject is also aggregated to some native xpcom Object.

At present XBL is the only system that might want to do this.

XXX write more!

Returns: success: NS_OK failure: NS_ERROR_XPC_BAD_CONVERT_JS NS_ERROR_FAILURE

nsIXPConnectJSObjectHolder nsIXPConnect::wrapNative ( in JSContextPtr  aJSContext,
in JSObjectPtr  aScope,
in nsISupports  aCOMObj,
in nsIIDRef  aIID 
) [inherited]

wrapNative will create a new JSObject or return an existing one.

The JSObject is returned inside a refcounted nsIXPConnectJSObjectHolder. As long as this holder is held the JSObject will be protected from collection by JavaScript's garbage collector. It is a good idea to transfer the JSObject to some equally protected place before releasing the holder (i.e. use JS_SetProperty to make this object a property of some other JSObject).

This method now correctly deals with cases where the passed in xpcom object already has an associated JSObject for the cases: 1) The xpcom object has already been wrapped for use in the same scope as an nsIXPConnectWrappedNative. 2) The xpcom object is in fact a nsIXPConnectWrappedJS and thus already has an underlying JSObject. 3) The xpcom object implements nsIScriptObjectOwner; i.e. is an idlc style DOM object for which we can call GetScriptObject to get the JSObject it uses to represent itself into JavaScript.

It might be possible to QueryInterface the nsIXPConnectJSObjectHolder returned by the method into a nsIXPConnectWrappedNative or a nsIXPConnectWrappedJS.

This method will never wrap the JSObject involved in an XPCNativeWrapper before returning.

Returns: success: NS_OK failure: NS_ERROR_XPC_BAD_CONVERT_NATIVE NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT NS_ERROR_FAILURE


Member Data Documentation

Definition at line 656 of file nsIXPConnect.idl.

Definition at line 581 of file nsIXPConnect.idl.

Definition at line 582 of file nsIXPConnect.idl.

Definition at line 657 of file nsIXPConnect.idl.

Definition at line 467 of file nsIXPConnect.idl.

Definition at line 466 of file nsIXPConnect.idl.

Definition at line 584 of file nsIXPConnect.idl.


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