• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ JS_BeginRequest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中JS_BeginRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ JS_BeginRequest函数的具体用法?C++ JS_BeginRequest怎么用?C++ JS_BeginRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了JS_BeginRequest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: jsd_NewValue

/*
 * Create a new JSD value referring to a jsval. Copy string values into the
 * JSD compartment. Leave all other GCTHINGs in their native compartments
 * and access them through cross-compartment calls.
 */
JSDValue*
jsd_NewValue(JSDContext* jsdc, jsval val)
{
    JSDValue* jsdval;
    JSCrossCompartmentCall *call = NULL;

    if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
        return NULL;

    if(JSVAL_IS_GCTHING(val))
    {
        JSBool ok;
        JS_BeginRequest(jsdc->dumbContext);

        call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob);
        if(!call) {
            JS_EndRequest(jsdc->dumbContext);
            free(jsdval);
            return NULL;
        }

        ok = JS_AddNamedValueRoot(jsdc->dumbContext, &jsdval->val, "JSDValue");
        if(ok && JSVAL_IS_STRING(val)) {
            if(!JS_WrapValue(jsdc->dumbContext, &val)) {
                ok = JS_FALSE;
            }
        }

        JS_LeaveCrossCompartmentCall(call);
        JS_EndRequest(jsdc->dumbContext);
        if(!ok)
        {
            free(jsdval);
            return NULL;
        }
    }
    jsdval->val  = val;
    jsdval->nref = 1;
    JS_INIT_CLIST(&jsdval->props);

    return jsdval;
}
开发者ID:ThinkerYzu,项目名称:mozilla-central,代码行数:47,代码来源:jsd_val.c


示例2: def_timestep_view_set_filterColor

CEXPORT JSBool def_timestep_view_set_filterColor(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp) {
	JS_BeginRequest(cx);
	timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
	if (thiz) {
		
		if (vp.isString()) {
	JSString *jstr = vp.toString();

	JSTR_TO_CSTR(cx, jstr, cstr);

	rgba color;
	rgba_parse(&color, cstr);
	thiz->filter_color = color;
}

		
	}
	JS_EndRequest(cx);
	return JS_TRUE;
}
开发者ID:debarko,项目名称:native-ios,代码行数:20,代码来源:js_timestep_view_template.gen.cpp


示例3: round_js_sm_removeregistry

JSBool round_js_sm_removeregistry(JSContext *cx, unsigned argc, jsval *vp) {
  if (argc < 1)
    return JS_FALSE;
  
  Round::LocalNode *node = dynamic_cast<Round::LocalNode *>(round_js_sm_getlocalnode());
  if (!node)
    return JS_FALSE;
  
  JS_BeginRequest(cx);
  
  std::string key;
  JSSTRING_TO_STDSTRING(cx, vp, 0, &key);
  
  bool isSuccess = node->removeRegistry(key);
  JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(JSBool(isSuccess)));
  
  JS_EndRequest(cx);
  
  return JS_TRUE;
}
开发者ID:cybergarage,项目名称:round-cc,代码行数:20,代码来源:SpiderMonkeyFunction.cpp


示例4: jsd_DropValue

void
jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval)
{
    JSCompartment* oldCompartment = NULL;

    JS_ASSERT(jsdval->nref > 0);
    if(0 == --jsdval->nref)
    {
        jsd_RefreshValue(jsdc, jsdval);
        if(JSVAL_IS_GCTHING(jsdval->val))
        {
            JS_BeginRequest(jsdc->dumbContext);
            oldCompartment = JS_EnterCompartment(jsdc->dumbContext, jsdc->glob);
            JS_RemoveValueRoot(jsdc->dumbContext, &jsdval->val);
            JS_LeaveCompartment(jsdc->dumbContext, oldCompartment);
            JS_EndRequest(jsdc->dumbContext);
        }
        free(jsdval);
    }
}
开发者ID:mvarie,项目名称:Spidermonkey,代码行数:20,代码来源:jsd_val.cpp


示例5: gjs_keep_alive_remove_global_child

void
gjs_keep_alive_remove_global_child(JSContext         *context,
                                   GjsUnrootedFunc  notify,
                                   JSObject          *child,
                                   void              *data)
{
    JSObject *keep_alive;

    JS_BeginRequest(context);

    keep_alive = gjs_keep_alive_get_global(context);

    if (!keep_alive)
        g_error("no keep_alive property on the global object, have you "
                "previously added this child?");

    gjs_keep_alive_remove_child(keep_alive, notify, child, data);

    JS_EndRequest(context);
}
开发者ID:GNOME,项目名称:gjs,代码行数:20,代码来源:keep-alive.cpp


示例6: round_js_sm_getnodestate

JSBool round_js_sm_getnodestate(JSContext* cx, unsigned argc, jsval* vp)
{
  RoundLocalNode* node = round_js_sm_getlocalnode();
  if (!node)
    return JS_FALSE;

  JS_BeginRequest(cx);

  /*
  RoundLocalNodeResponse nodeRes;
  Round::SystemGetNodeInfoResponse sysRes(&nodeRes);
  sysRes.setNode(node);
  
  JS_SET_NODERESPONSE_RVAL(cx, vp, nodeRes);
  */

  JS_EndRequest(cx);

  return JS_TRUE;
}
开发者ID:cybergarage,项目名称:round,代码行数:20,代码来源:js_sm_functions.c


示例7: jsd_GetValueFunctionName

const char*
jsd_GetValueFunctionName(JSDContext* jsdc, JSDValue* jsdval)
{
    JSContext* cx = jsdc->dumbContext;
    JSFunction* fun;
    JSExceptionState* exceptionState;

    if(!jsdval->funName && jsd_IsValueFunction(jsdc, jsdval))
    {
        JS_BeginRequest(cx);
        exceptionState = JS_SaveExceptionState(cx);
        fun = JS_ValueToFunction(cx, jsdval->val);
        JS_RestoreExceptionState(cx, exceptionState);
        JS_EndRequest(cx);
        if(!fun)
            return NULL;
        jsdval->funName = JS_GetFunctionName(fun);
    }
    return jsdval->funName;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:20,代码来源:jsd_val.c


示例8: Core_initialize

JSObject*
Core_initialize (JSContext *cx, const char* path)
{
    JS_BeginRequest(cx);
    JS_SetOptions(cx, JSOPTION_VAROBJFIX|JSOPTION_JIT|JSOPTION_XML);
    JS_SetVersion(cx, JS_StringToVersion("1.8"));

    JSObject* object = JS_NewObject(cx, &Core_class, NULL, NULL);

    if (object && JS_InitStandardClasses(cx, object)) {
        JS_DefineFunctions(cx, object, Core_methods);

        JS_EnterLocalRootScope(cx);

        // Properties
        jsval property;

        std::string rootPath = __Core_getRootPath(cx, path);
        jsval paths[] = {
            STRING_TO_JSVAL(JS_NewString(cx, JS_strdup(cx, rootPath.c_str()), rootPath.length())),
            STRING_TO_JSVAL(JS_NewString(cx, JS_strdup(cx, __LJS_LIBRARY_PATH__), strlen(__LJS_LIBRARY_PATH__)))
        };
        property = OBJECT_TO_JSVAL(JS_NewArrayObject(cx, 2, paths));
        JS_SetProperty(cx, object, "__PATH__", &property);

        property = STRING_TO_JSVAL(JS_NewString(cx, JS_strdup(cx, __LJS_VERSION__), strlen(__LJS_VERSION__)));
        JS_SetProperty(cx, object, "__VERSION__", &property);

        property = OBJECT_TO_JSVAL(object);
        JS_SetProperty(cx, object, "Program", &property);

        JS_LeaveLocalRootScope(cx);
        JS_EndRequest(cx);

        if (__Core_include(cx, __LJS_LIBRARY_PATH__ "/Core")) {
            return object;
        }
    }

    return NULL;
}
开发者ID:mandrake,项目名称:lulzjs,代码行数:41,代码来源:Core.cpp


示例9: gjs_string_from_utf8

JSBool
gjs_string_from_utf8(JSContext  *context,
                     const char *utf8_string,
                     gssize      n_bytes,
                     jsval      *value_p)
{
    jschar *u16_string;
    glong u16_string_length;
    JSString *str;
    GError *error;

    /* intentionally using n_bytes even though glib api suggests n_chars; with
    * n_chars (from g_utf8_strlen()) the result appears truncated
    */

    error = NULL;
    u16_string = g_utf8_to_utf16(utf8_string,
                                 n_bytes,
                                 NULL,
                                 &u16_string_length,
                                 &error);
    if (!u16_string) {
        gjs_throw(context,
                  "Failed to convert UTF-8 string to "
                  "JS string: %s",
                  error->message);
                  g_error_free(error);
        return JS_FALSE;
    }

    JS_BeginRequest(context);

    /* Avoid a copy - assumes that g_malloc == js_malloc == malloc */
    str = JS_NewUCString(context, u16_string, u16_string_length);

    if (str && value_p)
        *value_p = STRING_TO_JSVAL(str);

    JS_EndRequest(context);
    return str != NULL;
}
开发者ID:victoryang,项目名称:gjs,代码行数:41,代码来源:jsapi-util-string.cpp


示例10: __Core_getPath

std::string
__Core_getPath (JSContext* cx, std::string fileName)
{
    /*
     * Getting the dirname of the file from the other file is included
     * then copying it and getting the path to the dir.
     */
    const char* scriptName = __Core_getScriptName(cx);
    char* from             = strdup(scriptName ? scriptName : "");
    char* dir              = dirname(from);
    std::string path       = std::string(dir) + "/" + fileName;
    free(from);

    JS_BeginRequest(cx);
    
    struct stat test;
    if (stat(path.c_str(), &test) != 0) {
        JSObject* lPath; JS_ValueToObject(cx, JS_EVAL(cx, "Program.__PATH__"), &lPath);

        if (lPath) {
            jsuint length;
            JS_GetArrayLength(cx, lPath, &length);

            size_t i;
            for (i = 0; i < length; i++) {
                jsval pathFile;
                JS_GetElement(cx, lPath, i, &pathFile);

                path = std::string(JS_GetStringBytes(JSVAL_TO_STRING(pathFile))) + "/" + fileName;

                if (stat(path.c_str(), &test) == 0) {
                    break;
                }
            }
        }
    }

    JS_EndRequest(cx);

    return path;
}
开发者ID:mandrake,项目名称:lulzjs,代码行数:41,代码来源:Core.cpp


示例11: jsd_GetValueConstructor

JSDValue*
jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
{
    JSCrossCompartmentCall *call = NULL;

    if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_CTOR)))
    {
        JSObject* obj;
        JSObject* proto;
        JSObject* ctor;
        JS_ASSERT(!jsdval->ctor);
        SET_BIT_FLAG(jsdval->flags, GOT_CTOR);
        if(!JSVAL_IS_OBJECT(jsdval->val))
            return NULL;
        if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
            return NULL;
        JS_BeginRequest(jsdc->dumbContext);
        call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj);
        if(!call) {
            JS_EndRequest(jsdc->dumbContext);

            return NULL;
        }
        proto = JS_GetPrototype(jsdc->dumbContext,obj);
        if(!proto)
        {
            JS_LeaveCrossCompartmentCall(call);
            JS_EndRequest(jsdc->dumbContext);
            return NULL;
        }
        ctor = JS_GetConstructor(jsdc->dumbContext,proto);
        JS_LeaveCrossCompartmentCall(call);
        JS_EndRequest(jsdc->dumbContext);
        if(!ctor)
            return NULL;
        jsdval->ctor = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(ctor));
    }
    if(jsdval->ctor)
        jsdval->ctor->nref++;
    return jsdval->ctor;
}
开发者ID:moussa1,项目名称:mozilla-central,代码行数:41,代码来源:jsd_val.c


示例12: Embed

static int Embed(int argc, char **argv)
{
    Core::Context *ncx = initNidiumJS();
    JSContext *cx      = ncx->getNJS()->getJSContext();

    if (argc <= 1) {
        printf("$ %s <path> [prefix] [> out]\n", argv[0]);
        return 1;
    }

    DIR *dir = opendir(argv[1]);
    if (!dir) {
        fprintf(stderr, "Can't open dir %s\n", argv[1]);
    }

    JS_BeginRequest(cx);

    JSNFS *nfs = new JSNFS(cx);

    bool ok;
    if (argc == 3) {
        std::string prefix = "/";
        prefix += argv[2];

        fprintf(stderr, "Create prefix %s...\n", prefix.c_str());

        nfs->mkdir(prefix.c_str(), strlen(prefix.c_str()));

        ok = listdir(nfs, dir, argv[1], strlen(argv[1]));
    } else {
        ok = listdir(nfs, dir, argv[1], strlen(argv[1]));
    }

    nfs->save(DIR2NFS_OUTPUT);

    JS_EndRequest(cx);

    delete ncx;

    return ok ? 0 : 1;
}
开发者ID:nidium,项目名称:Nidium,代码行数:41,代码来源:dir2nvfs.cpp


示例13: jsd_GetThisForStackFrame

JSDValue*
jsd_GetThisForStackFrame(JSDContext* jsdc, 
                         JSDThreadState* jsdthreadstate,
                         JSDStackFrameInfo* jsdframe)
{
    JSObject* obj;
    JSDValue* jsdval = NULL;
    JSD_LOCK_THREADSTATES(jsdc);

    if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
    {
        JS_BeginRequest(jsdthreadstate->context);
        obj = JS_GetFrameThis(jsdthreadstate->context, jsdframe->fp);
        JS_EndRequest(jsdthreadstate->context);
        if(obj)
            jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj));
    }

    JSD_UNLOCK_THREADSTATES(jsdc);
    return jsdval;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:21,代码来源:jsd_stak.c


示例14: __declspec

BOOL __declspec(dllexport) InitExports(JSContext * cx, JSObject * global)
{
	JSFunctionSpec xdeployFunctions[] = {
		{ "SetComputerName", setcomputername, 2, 0 },
		{ "NetJoinDomain", netjoindomain, 6, 0 },
		{ "NetLocalGroupAddMembers", netlocalgroupaddmembers, 2, 0 },
		{ "NetGetLastErrorMessage", GetLastNetErrorMessage, 1, 0 },
		{ "NetGetJoinableOUs", netgetjoinableous, 3, 0 },
		{ "HideFirstUXWnd", close_FirstUXWnd, 0, 0 },
		{ 0 },
	};

	JS_BeginRequest(cx);
	JS_DefineFunctions(cx, global, xdeployFunctions);
	JS_DefineConstDoubles(cx, global, xdeployConsts);
	InitCrypto(cx, global);
	InitMsi(cx, global);
	InitProgressDlg(cx, global);
	JS_EndRequest(cx);
	return TRUE;
}
开发者ID:z4y4,项目名称:njord,代码行数:21,代码来源:js_xdeploy.cpp


示例15: TCP_initialize

JSBool
TCP_initialize (JSContext* cx)
{
    JS_BeginRequest(cx);
    JS_EnterLocalRootScope(cx);

    JSObject* parent = JSVAL_TO_OBJECT(JS_EVAL(cx, "System.Network.Sockets"));

    JSObject* object = JS_InitClass(
        cx, parent, JSVAL_TO_OBJECT(JS_EVAL(cx, "System.Network.Sockets.prototype")), &TCP_class,
        TCP_constructor, 1, TCP_attributes, TCP_methods, NULL, TCP_static_methods
    );

    if (object) {
        JS_LeaveLocalRootScope(cx);
        JS_EndRequest(cx);
        return JS_TRUE;
    }

    return JS_FALSE;
}
开发者ID:mandrake,项目名称:lulzjs,代码行数:21,代码来源:TCP.cpp


示例16: func

/* JSCall function by name, cvalues will be converted
 *
 * deactivates controller if any script errors!
 *
 * format values:
 * case 'b': BOOLEAN_TO_JSVAL((JSBool) va_arg(ap, int));
 * case 'c': INT_TO_JSVAL((uint16) va_arg(ap, unsigned int));
 * case 'i':
 * case 'j': js_NewNumberValue(cx, (jsdouble) va_arg(ap, int32), sp)
 * case 'u': js_NewNumberValue(cx, (jsdouble) va_arg(ap, uint32), sp)
 * case 'd':
 * case 'I': js_NewDoubleValue(cx, va_arg(ap, jsdouble), sp)
 * case 's': JS_NewStringCopyZ(cx, va_arg(ap, char *))
 * case 'W': JS_NewUCStringCopyZ(cx, va_arg(ap, jschar *))
 * case 'S': va_arg(ap, JSString *)
 * case 'o': OBJECT_TO_JSVAL(va_arg(ap, JSObject *)
 * case 'f':
 * fun = va_arg(ap, JSFunction *);
 *       fun ? OBJECT_TO_JSVAL(fun->object) : JSVAL_NULL;
 * case 'v': va_arg(ap, jsval);
 */
bool ControllerListener::call(const char *funcname, int argc, const char *format, ...) {
    va_list ap;
    jsval fval = JSVAL_VOID;
    jsval ret = JSVAL_VOID;
    
    func("%s try calling method %s.%s(argc:%i)", __func__, name, funcname, argc);
    JS_SetContextThread(jsContext);
    JS_BeginRequest(jsContext);
    int res = JS_GetProperty(jsContext, jsObject, funcname, &fval);
    
    if(JSVAL_IS_VOID(fval)) {
        warning("method unresolved by JS_GetProperty");
    } else {
        jsval *argv;
        void *markp;
        
        va_start(ap, format);
        argv = JS_PushArgumentsVA(jsContext, &markp, format, ap);
        va_end(ap);
        
        res = JS_CallFunctionValue(jsContext, jsObject, fval, argc, argv, &ret);
        JS_PopArguments(jsContext, &markp);
        
        if (res) {
            if(!JSVAL_IS_VOID(ret)) {
                JSBool ok;
                JS_ValueToBoolean(jsContext, ret, &ok);
                if (ok) // JSfunc returned 'true', so event is done
                {
                    JS_EndRequest(jsContext);
                    JS_ClearContextThread(jsContext);
                    return true;
                }
            }
        }
    }
    JS_EndRequest(jsContext);
    JS_ClearContextThread(jsContext);
    return false; // no callback, redo on next controller
}
开发者ID:dewn49,项目名称:FreeJ,代码行数:61,代码来源:controller.cpp


示例17: importer_new_resolve

/*
 * Like JSResolveOp, but flags provide contextual information as follows:
 *
 *  JSRESOLVE_QUALIFIED   a qualified property id: obj.id or obj[id], not id
 *  JSRESOLVE_ASSIGNING   obj[id] is on the left-hand side of an assignment
 *  JSRESOLVE_DETECTING   'if (o.p)...' or similar detection opcode sequence
 *  JSRESOLVE_DECLARING   var, const, or function prolog declaration opcode
 *  JSRESOLVE_CLASSNAME   class name used when constructing
 *
 * The *objp out parameter, on success, should be null to indicate that id
 * was not resolved; and non-null, referring to obj or one of its prototypes,
 * if id was resolved.
 */
static JSBool
importer_new_resolve(JSContext *context,
                     JSObject  *obj,
                     jsid       id,
                     uintN      flags,
                     JSObject **objp)
{
    Importer *priv;
    char *name;
    JSBool ret = JS_TRUE;

    *objp = NULL;

    if (!gjs_get_string_id(context, id, &name))
        return JS_FALSE;

    /* let Object.prototype resolve these */
    if (strcmp(name, "valueOf") == 0 ||
            strcmp(name, "toString") == 0 ||
            strcmp(name, "__iterator__") == 0)
        goto out;

    priv = priv_from_js(context, obj);
    gjs_debug_jsprop(GJS_DEBUG_IMPORTER, "Resolve prop '%s' hook obj %p priv %p", name, obj, priv);

    if (priv == NULL) /* we are the prototype, or have the wrong class */
        goto out;

    JS_BeginRequest(context);
    if (do_import(context, obj, priv, name)) {
        *objp = obj;
    } else {
        ret = JS_FALSE;
    }
    JS_EndRequest(context);

out:
    g_free(name);
    return ret;
}
开发者ID:KNOPOChKA2,项目名称:gjs,代码行数:53,代码来源:importer.c


示例18: win32_impersonateuser

JSBool win32_impersonateuser(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
	JSString * username, * password, *domain = NULL;
	DWORD logonType = LOGON32_LOGON_INTERACTIVE;
	JS_BeginRequest(cx);
	if(!JS_ConvertArguments(cx, argc, argv, "S S /S u", &username, &password, &domain, &logonType))
	{
		JS_ReportError(cx, "Unable to parse arguments in ImpersonateUser");
		JS_EndRequest(cx);
		return JS_FALSE;
	}

	if(logonType == LOGON32_LOGON_NETWORK)
	{
		*rval = JSVAL_FALSE;
		JS_EndRequest(cx);
		return JS_TRUE;
	}

	LPWSTR domainName = NULL;
	if(domain != NULL)
		domainName = (LPWSTR)JS_GetStringChars(domain);

	HANDLE newToken = NULL;
	JS_YieldRequest(cx);
	if(!LogonUser((LPWSTR)JS_GetStringChars(username), domainName, (LPWSTR)JS_GetStringChars(password), logonType, LOGON32_PROVIDER_DEFAULT, &newToken))
	{
		*rval = JSVAL_FALSE;
		JS_EndRequest(cx);
		return JS_TRUE;
	}

	if(!ImpersonateLoggedOnUser(newToken))
		*rval = JSVAL_FALSE;
	else
		*rval = JSVAL_TRUE;
	CloseHandle(newToken);
	JS_EndRequest(cx);
	return JS_TRUE;
}
开发者ID:z4y4,项目名称:njord,代码行数:40,代码来源:win32s.cpp


示例19: importer_new_resolve

/*
 * Like JSResolveOp, but flags provide contextual information as follows:
 *
 *  JSRESOLVE_QUALIFIED   a qualified property id: obj.id or obj[id], not id
 *  JSRESOLVE_ASSIGNING   obj[id] is on the left-hand side of an assignment
 *  JSRESOLVE_DETECTING   'if (o.p)...' or similar detection opcode sequence
 *  JSRESOLVE_DECLARING   var, const, or function prolog declaration opcode
 *  JSRESOLVE_CLASSNAME   class name used when constructing
 *
 * The *objp out parameter, on success, should be null to indicate that id
 * was not resolved; and non-null, referring to obj or one of its prototypes,
 * if id was resolved.
 */
static JSBool
importer_new_resolve(JSContext *context,
                     JS::HandleObject obj,
                     JS::HandleId id,
                     unsigned flags,
                     JS::MutableHandleObject objp)
{
    Importer *priv;
    std::string name;
    JSBool ret = JS_TRUE;
    jsid module_init_name;

    module_init_name = gjs_context_get_const_string(context, GJS_STRING_MODULE_INIT);
    if (id == module_init_name)
        return JS_TRUE;

    if (!gjs_get_string_id(context, id, name))
        return JS_FALSE;

    /* let Object.prototype resolve these */
    if (name == "valueOf" ||
        name == "toString" ||
        name == "__iterator__")
        goto out;
    priv = priv_from_js(context, obj);

//    std::cout << "Resolve prop '" << name << "' hook obj " << (uint32_t)*obj << " priv " << (uint32_t)priv << "\n";
    if (priv == NULL) /* we are the prototype, or have the wrong class */
        goto out;
    JS_BeginRequest(context);
    if (do_import(context, obj, priv, name)) {
        objp.set(obj);
    } else {
        ret = JS_FALSE;
    }
    JS_EndRequest(context);

 out:
    return ret;
}
开发者ID:invy,项目名称:xpjs,代码行数:53,代码来源:importer.cpp


示例20: Core_die

JSBool
Core_die (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
    char* error;

    JS_BeginRequest(cx);

    if (argc) {
        error = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
    }
    else {
        error = strdup("Program died.");
    }

    JS_ReportError(cx, error);
    JS_ReportPendingException(cx);

    JS_EndRequest(cx);

    exit(EXIT_FAILURE);
    return JS_FALSE;
}
开发者ID:mandrake,项目名称:lulzjs,代码行数:22,代码来源:Core.cpp



注:本文中的JS_BeginRequest函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ JS_CallFunctionName函数代码示例发布时间:2022-05-30
下一篇:
C++ JS_ARGV函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap