JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keep_alive_finalize, NULL, NULL, NULL, NULL, NULL, NULL, JS_CLASS_TRACE(keep_alive_trace), NULL }; static JSPropertySpec gjs_keep_alive_proto_props[] = { { NULL } }; static JSFunctionSpec gjs_keep_alive_proto_funcs[] = { { NULL } }; JSObject* gjs_keep_alive_new(JSContext *context) { JSObject *keep_alive;
JSExtendedClass XPCNativeWrapper::sXPC_NW_JSClass = { // JSClass (JSExtendedClass.base) initialization { "XPCNativeWrapper", JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS | // Our one reserved slot holds a jsint of flag bits JSCLASS_NEW_RESOLVE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_MARK_IS_TRACE | JSCLASS_IS_EXTENDED, XPC_NW_AddProperty, XPC_NW_DelProperty, XPC_NW_GetProperty, XPC_NW_SetProperty, XPC_NW_Enumerate, (JSResolveOp)XPC_NW_NewResolve, XPC_NW_Convert, XPC_NW_Finalize, nsnull, XPC_NW_CheckAccess, XPC_NW_Call, XPC_NW_Construct, nsnull, XPC_NW_HasInstance, JS_CLASS_TRACE(XPC_NW_Trace), nsnull }, // JSExtendedClass initialization XPC_NW_Equality }; // If one of our class hooks is ever called from a non-system script, bypass // the hook by calling the same hook on our wrapped native, with obj reset to // the wrapped native's flat JSObject, so the hook and args macro parameters // can be simply: // // convert, (cx, obj, type, vp) // // in the call from XPC_NW_Convert, for example. #define XPC_NW_CALL_HOOK(obj, hook, args) \
static JSBool exn_enumerate(JSContext *cx, JSObject *obj); static JSBool exn_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp); JSClass js_ErrorClass = { js_Error_str, JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Error), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, exn_enumerate, (JSResolveOp)exn_resolve, JS_ConvertStub, exn_finalize, NULL, NULL, NULL, Exception, NULL, NULL, JS_CLASS_TRACE(exn_trace), NULL }; typedef struct JSStackTraceElem { JSString *funName; size_t argc; const char *filename; uintN ulineno; } JSStackTraceElem; typedef struct JSExnPrivate { /* A copy of the JSErrorReport originally generated. */ JSErrorReport *errorReport; JSString *message; JSString *filename; uintN lineno;
/* * FIXME be 390950. Generator's frame is a part of the JS stack when the * generator is running or closing. Thus tracing the frame in this case * here duplicates the work done in js_TraceContext. */ js_TraceStackFrame(trc, &gen->frame); } JSClass js_GeneratorClass = { js_Generator_str, JSCLASS_HAS_PRIVATE | JSCLASS_IS_ANONYMOUS | JSCLASS_MARK_IS_TRACE | JSCLASS_HAS_CACHED_PROTO(JSProto_Generator), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, generator_finalize, NULL, NULL, NULL, NULL, NULL, NULL, JS_CLASS_TRACE(generator_trace), NULL }; /* * Called from the JSOP_GENERATOR case in the interpreter, with fp referring * to the frame by which the generator function was activated. Create a new * JSGenerator object, which contains its own JSStackFrame that we populate * from *fp. We know that upon return, the JSOP_GENERATOR opcode will return * from the activation in fp, so we can steal away fp->callobj and fp->argsobj * if they are non-null. */ JSObject * js_NewGenerator(JSContext *cx, JSStackFrame *fp) { JSObject *obj; uintN argc, nargs, nvars, nslots;