Back to index

lightning-sunbird  0.9+nobinonly
xpcwrappednativeinfo.cpp File Reference
#include "xpcprivate.h"

Go to the source code of this file.


JSObjectxpc_CloneJSFunction (XPCCallContext &ccx, JSObject *funobj, JSObject *parent)

Function Documentation

JSObject* xpc_CloneJSFunction ( XPCCallContext ccx,
JSObject funobj,
JSObject parent 

Definition at line 54 of file xpcwrappednativeinfo.cpp.

    JSObject *clone = JS_CloneFunctionObject(ccx, funobj, parent);
        return nsnull;


    XPCWrappedNativeScope *scope = 
        XPCWrappedNativeScope::FindInJSObjectScope(ccx, parent);

    if (!scope) {
        return nsnull;

    // Make sure to break the prototype chain to the function object
    // we cloned to prevent its scope from leaking into the clones
    // scope.
    JS_SetPrototype(ccx, clone, scope->GetPrototypeJSFunction());

    // Copy the reserved slots to the clone.
    jsval ifaceVal, memberVal;
    if(!JS_GetReservedSlot(ccx, funobj, 0, &ifaceVal) ||
       !JS_GetReservedSlot(ccx, funobj, 1, &memberVal))
        return nsnull;

    if(!JS_SetReservedSlot(ccx, clone, 0, ifaceVal) ||
       !JS_SetReservedSlot(ccx, clone, 1, memberVal))
        return nsnull;

    return clone;

Here is the call graph for this function:

Here is the caller graph for this function: