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

C++ JSObjectMake函数代码示例

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

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



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

示例1: get_message_data

static JSValueRef
get_message_data(SoupMessage *msg)
{
    const char *name, *value;
    SoupMessageHeadersIter iter;
    JSObjectRef o = NULL, ho;
    JSValueRef ret;
    JSStringRef s;

    JSContextRef ctx = scripts_get_global_context();
    if (ctx == NULL) {
        return NIL;
    }

    o = JSObjectMake(ctx, NULL, NULL);
    js_set_object_property(ctx, o, "body", msg->response_body->data, NULL);

    ho = JSObjectMake(ctx, NULL, NULL);

    soup_message_headers_iter_init(&iter, msg->response_headers);
    while (soup_message_headers_iter_next(&iter, &name, &value))
        js_set_object_property(ctx, ho, name, value, NULL);

    s = JSStringCreateWithUTF8CString("headers");
    JSObjectSetProperty(ctx, o, s, ho, kJSDefaultProperty, NULL);
    JSStringRelease(s);
    ret = o;

    scripts_release_global_context();

    return ret;
}
开发者ID:vifino,项目名称:dwb,代码行数:32,代码来源:ns_net.c


示例2: InitializeContext

/**
 * internal 
 *
 * setup a context after created
 */
static void InitializeContext (JSGlobalContextRef ctx)
{
    auto global = JSContextGetGlobalObject(ctx);
    auto setterProps = kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete;

    // inject a simple console logger
    auto logProperty = JSStringCreateWithUTF8CString("log");
    auto consoleProperty = JSStringCreateWithUTF8CString("console");
    auto consoleObject = JSObjectMake(ctx, 0, 0);
    auto logFunction = JSObjectMakeFunctionWithCallback(ctx, logProperty, HyperloopLogger);
    JSObjectSetProperty(ctx, consoleObject, logProperty, logFunction, setterProps, 0);
    JSObjectSetProperty(ctx, global, consoleProperty, consoleObject, setterProps, 0);
    JSStringRelease(logProperty);
    JSStringRelease(consoleProperty);

    // bind some internal cross-platform methods
    auto vmBindingProperty = JSStringCreateWithUTF8CString("hyperloop$vm");
    auto vmrunInNewContextProperty = JSStringCreateWithUTF8CString("runInNewContext");
    auto vmBindingObject = JSObjectMake(ctx, 0, 0);
    auto vmrunInNewContextFunction = JSObjectMakeFunctionWithCallback(ctx, vmrunInNewContextProperty, RunInNewContext);
    JSObjectSetProperty(ctx, vmBindingObject, vmrunInNewContextProperty, vmrunInNewContextFunction, setterProps, 0);
    JSObjectSetProperty(ctx, global, vmBindingProperty, vmBindingObject, setterProps, 0);
    JSStringRelease(vmBindingProperty);
    JSStringRelease(vmrunInNewContextProperty);

    // create a hook into our global context
    auto prop = JSStringCreateWithUTF8CString("hyperloop$global");
    JSObjectSetProperty(ctx, global, prop, global, setterProps, 0);
    JSStringRelease(prop);

    // setup our globals object -- should point to the real root global object if a new context (not the root ctx)
    auto globalProperty = JSStringCreateWithUTF8CString("global");
    JSObjectSetProperty(ctx, global, globalProperty, global, setterProps, 0);
    JSStringRelease(globalProperty);
}
开发者ID:Sophrinix,项目名称:hyperloop-common,代码行数:40,代码来源:hyperloop.cpp


示例3: seed_gi_importer_handle_struct

/*
 * Set up prototype and constructor for structs. Same semantics as objects
 * except
 * for the type.
 */
static void
seed_gi_importer_handle_struct(JSContextRef ctx,
                               JSObjectRef namespace_ref,
                               GIStructInfo* info,
                               JSValueRef* exception)
{
    JSObjectRef struct_ref;
    JSObjectRef proto;
    gint i, n_methods;
    GIFunctionInfo* finfo;

    struct_ref = JSObjectMake(ctx, seed_struct_constructor_class, info);
    g_base_info_ref(info);

    n_methods = g_struct_info_get_n_methods(info);

    for (i = 0; i < n_methods; i++) {
        GIFunctionInfoFlags flags;
        finfo = g_struct_info_get_method(info, i);

        flags = g_function_info_get_flags(finfo);

        if (flags & GI_FUNCTION_IS_CONSTRUCTOR) {
            JSObjectRef constructor
              = JSObjectMake(ctx, gobject_named_constructor_class, finfo);
            const gchar* fname = g_base_info_get_name((GIBaseInfo*) finfo);
            if (g_strrstr(fname, "new_") == fname) {
                // To be compatible with gjs, we need to have a method with
                // new_, too.
                seed_object_set_property(ctx, struct_ref, fname, constructor);
                fname += 4;
            }

            else if (!g_strcmp0(fname, "new")) {
                // To be compatible with gjs, we need to have new as function,
                // too.
                seed_object_set_property(ctx, struct_ref, fname, constructor);
                fname = "c_new";
            }

            seed_object_set_property(ctx, struct_ref, fname, constructor);
        } else if (flags & GI_FUNCTION_IS_METHOD)
            g_base_info_unref((GIBaseInfo*) finfo);
        else
            seed_gobject_define_property_from_function_info(ctx, finfo,
                                                            struct_ref, FALSE);
    }

    proto = seed_struct_prototype(ctx, (GIBaseInfo*) info);
    seed_object_set_property(ctx, struct_ref, "prototype", proto);

    seed_object_set_property(ctx, namespace_ref,
                             g_base_info_get_name((GIBaseInfo*) info),
                             struct_ref);
}
开发者ID:GNOME,项目名称:seed,代码行数:60,代码来源:seed-importer.c


示例4: gum_emit_range

static gboolean
gum_emit_range (const GumRangeDetails * details,
                gpointer user_data)
{
  GumJscMatchContext * mc = user_data;
  GumJscCore * core = mc->self->core;
  GumJscScope scope = GUM_JSC_SCOPE_INIT (core);
  JSContextRef ctx = mc->ctx;
  char prot_str[4] = "---";
  JSObjectRef range;
  const GumFileMapping * f = details->file;
  JSValueRef result;
  gboolean proceed;
  gchar * str;

  if ((details->prot & GUM_PAGE_READ) != 0)
    prot_str[0] = 'r';
  if ((details->prot & GUM_PAGE_WRITE) != 0)
    prot_str[1] = 'w';
  if ((details->prot & GUM_PAGE_EXECUTE) != 0)
    prot_str[2] = 'x';

  range = JSObjectMake (ctx, NULL, NULL);
  _gumjs_object_set_pointer (ctx, range, "base",
      GSIZE_TO_POINTER (details->range->base_address), core);
  _gumjs_object_set_uint (ctx, range, "size", details->range->size);
  _gumjs_object_set_string (ctx, range, "protection", prot_str);

  if (f != NULL)
  {
    JSObjectRef file = JSObjectMake (ctx, NULL, NULL);
    _gumjs_object_set_string (ctx, file, "path", f->path);
    _gumjs_object_set_uint (ctx, file, "offset", f->offset);
    _gumjs_object_set (ctx, range, "file", file);
  }

  result = JSObjectCallAsFunction (ctx, mc->on_match, NULL, 1,
      (JSValueRef *) &range, &scope.exception);
  _gum_jsc_scope_flush (&scope);

  proceed = TRUE;
  if (result != NULL && _gumjs_string_try_get (ctx, result, &str, NULL))
  {
    proceed = strcmp (str, "stop") != 0;
    g_free (str);
  }

  return proceed;
}
开发者ID:terry2012,项目名称:frida-gum,代码行数:49,代码来源:gumjscprocess.c


示例5: m_context

BB::PatchCollection::PatchCollection(BB::Context& context)
 :	m_context(context)
{
	JSContextRef ctx;
	ctx = context.context();
	this->m_patch_collection_object = JSObjectMake(ctx, context.patchCollectionClass(), this);
}
开发者ID:hjqqq,项目名称:Brain-Box,代码行数:7,代码来源:BBPatchCollection.cpp


示例6: constructJSCallback

static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
{
    JSObject* constructor = exec->callee();
    JSContextRef ctx = toRef(exec);
    JSObjectRef constructorRef = toRef(constructor);

    JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
    if (callback) {
        int argumentCount = static_cast<int>(exec->argumentCount());
        Vector<JSValueRef, 16> arguments(argumentCount);
        for (int i = 0; i < argumentCount; i++)
            arguments[i] = toRef(exec, exec->argument(i));

        JSValueRef exception = 0;
        JSObjectRef result;
        {
            APICallbackShim callbackShim(exec);
            result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
        }
        if (exception)
            throwError(exec, toJS(exec, exception));
        return JSValue::encode(toJS(result));
    }
    
    return JSValue::encode(toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
}
开发者ID:1833183060,项目名称:wke,代码行数:26,代码来源:JSCallbackConstructor.cpp


示例7: fz_malloc_struct

pdf_jsimp_obj *pdf_jsimp_new_obj(pdf_jsimp *imp, pdf_jsimp_type *type, void *natobj)
{
	fz_context *ctx = imp->ctx;
	pdf_jsimp_obj *obj = fz_malloc_struct(ctx, pdf_jsimp_obj);
	priv_data *pdata = NULL;

	fz_var(pdata);
	fz_try(ctx)
	{
		pdata = fz_malloc_struct(ctx, priv_data);
		pdata->type = type;
		pdata->natobj = natobj;
		obj->ref = JSObjectMake(imp->jscore_ctx, imp->class_ref, pdata);
		if (obj->ref == NULL)
			fz_throw(ctx, FZ_ERROR_GENERIC, "JSObjectMake failed");

		JSValueProtect(imp->jscore_ctx, obj->ref);
	}
	fz_catch(ctx)
	{
		fz_free(ctx, pdata);
		fz_free(ctx, obj);
		fz_rethrow(ctx);
	}

	return obj;
}
开发者ID:azaleafisitania,项目名称:sumatrapdf,代码行数:27,代码来源:pdf-jsimp-jscore.c


示例8: EJ_BIND_FUNCTION

 EJ_BIND_FUNCTION(EJBindingCanvas,createImageData, ctx, argc, argv) {
 	if( argc < 2 ) { return NULL; }
	
 	float
 		sw = JSValueToNumberFast(ctx, argv[0]),
 		sh = JSValueToNumberFast(ctx, argv[1]);
		
 	GLubyte * pixels = (GLubyte *)calloc( sw * sh * 4, sizeof(GLubyte) );
 	EJImageData * imageData = new EJImageData(sw ,sh ,pixels);
 	imageData->autorelease();

 	// Create the JS object
 	EJBindingImageData* tempData = new EJBindingImageData();
 	JSClassRef imageDataClass = EJApp::instance()->getJSClassForClass((EJBindingBase*)tempData);
 	delete tempData;
 	JSObjectRef obj = JSObjectMake( ctx, imageDataClass, NULL );
 	JSValueProtect(ctx, obj);

 	// Create the native instance
 	EJBindingImageData * jsImageData =new EJBindingImageData(ctx,obj,imageData);

 	// Attach the native instance to the js object
 	JSObjectSetPrivate( obj, (void *)jsImageData );
 	JSValueUnprotect(ctx, obj);
 	return obj;
 }
开发者ID:YaakovDavis,项目名称:Ejecta-X,代码行数:26,代码来源:EJBindingCanvas.cpp


示例9: get_sessions_cb

static JSValueRef
get_sessions_cb(JSContextRef context,
				JSObjectRef thisObject,
				JSStringRef propertyName,
				JSValueRef *exception) {

	JSObjectRef array;
	const GList *sessions, *link;
	guint i, n_sessions = 0;
	JSValueRef *args;

	sessions = lightdm_get_sessions();
	n_sessions = g_list_length((GList *) sessions);
	args = g_malloc(sizeof(JSValueRef) * ( n_sessions + 1 ));

	for (i = 0, link = sessions; link; i++, link = link->next) {
		LightDMSession *session = link->data;
		g_object_ref(session);

		args[i] = JSObjectMake(context, lightdm_session_class, session);
	}

	array = JSObjectMakeArray(context, n_sessions, args, exception);
	g_free(args);

	if (array == NULL) {
		return JSValueMakeNull(context);
	} else {
		return array;
	}
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:31,代码来源:lightdm-webkit2-greeter-ext.c


示例10: get_users_cb

static JSValueRef
get_users_cb(JSContextRef context,
			 JSObjectRef thisObject,
			 JSStringRef propertyName,
			 JSValueRef *exception) {

	JSObjectRef array;
	const GList *users, *link;
	guint i, n_users = 0;
	JSValueRef *args;

	users = lightdm_user_list_get_users(lightdm_user_list_get_instance());
	n_users = g_list_length((GList *) users);
	args = g_malloc(sizeof(JSValueRef) * ( n_users + 1 ));

	for (i = 0, link = users; link; i++, link = link->next) {
		LightDMUser *user = link->data;
		g_object_ref(user);
		args[i] = JSObjectMake(context, lightdm_user_class, user);
	}

	array = JSObjectMakeArray(context, n_users, args, exception);
	g_free(args);

	if (array == NULL) {
		return JSValueMakeNull(context);
	} else {
		return array;
	}
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:30,代码来源:lightdm-webkit2-greeter-ext.c


示例11: _gum_jsc_polyfill_init

void
_gum_jsc_polyfill_init (GumJscPolyfill * self,
                        GumJscCore * core,
                        JSObjectRef scope)
{
  JSContextRef ctx = core->ctx;
  JSClassDefinition def;
  JSClassRef klass;
  JSObjectRef module;

  self->core = core;

  def = kJSClassDefinitionEmpty;
  def.className = "ProxyModule";
  def.staticFunctions = gumjs_proxy_module_functions;
  klass = JSClassCreate (&def);
  module = JSObjectMake (ctx, klass, self);
  JSClassRelease (klass);
  _gumjs_object_set (ctx, scope, "Proxy", module);

  def = kJSClassDefinitionEmpty;
  def.attributes = kJSClassAttributeNoAutomaticPrototype;
  def.className = "Proxy";
  def.finalize = gumjs_proxy_finalize;
  def.hasProperty = gumjs_proxy_has_property;
  def.getProperty = gumjs_proxy_get_property;
  def.setProperty = gumjs_proxy_set_property;
  def.getPropertyNames = gumjs_proxy_get_property_names;
  self->proxy = JSClassCreate (&def);
}
开发者ID:terry2012,项目名称:frida-gum,代码行数:30,代码来源:gumjscpolyfill.c


示例12: JSOSInstaller_new

JSObjectRef JSOSInstaller_new(JSContextRef context, JSInstaller* jsinst)
{
    JSObjectRef jsobj;
    jsobj = JSObjectMake(context, JSOSInstaller_class(context), jsinst);
    jsinst->js_self = jsobj;
    return jsobj;
}
开发者ID:gvsurenderreddy,项目名称:installer-2,代码行数:7,代码来源:jsosinstaller.c


示例13: if

JSObjectRef JSCArrayBuffer::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
	uscxml::ArrayBuffer* localInstance = NULL;

	if (false) {
	} else if (argumentCount == 1 &&
	           JSValueIsNumber(ctx, arguments[0])) {

		unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception);
		localInstance = new uscxml::ArrayBuffer(localLength);

	}
	if (!localInstance) {
		JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for ArrayBuffer");
		*exception = JSValueMakeString(ctx, exceptionString);
		JSStringRelease(exceptionString);
		return (JSObjectRef)JSValueMakeNull(ctx);
	}

	JSClassRef retClass = JSCArrayBuffer::getTmpl();

	struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate();
	retPrivData->nativeObj = localInstance;

	JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
	return retObj;
}
开发者ID:bjqiwei,项目名称:uscxml,代码行数:26,代码来源:JSCArrayBuffer.cpp


示例14: constructJSCallback

static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
{
    JSObject* constructor = exec->callee();
    JSContextRef ctx = toRef(exec);
    JSObjectRef constructorRef = toRef(constructor);

    JSObjectCallAsConstructorCallback callback = jsCast<JSCallbackConstructor*>(constructor)->callback();
    if (callback) {
        size_t argumentCount = exec->argumentCount();
        Vector<JSValueRef, 16> arguments;
        arguments.reserveInitialCapacity(argumentCount);
        for (size_t i = 0; i < argumentCount; ++i)
            arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));

        JSValueRef exception = 0;
        JSObjectRef result;
        {
            APICallbackShim callbackShim(exec);
            result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
        }
        if (exception)
            exec->vm().throwException(exec, toJS(exec, exception));
        // result must be a valid JSValue.
        if (!result)
            return throwVMTypeError(exec);
        return JSValue::encode(toJS(result));
    }
    
    return JSValue::encode(toJS(JSObjectMake(ctx, jsCast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:30,代码来源:JSCallbackConstructor.cpp


示例15: Java_com_vasco_digipass_sdk_smartfaceplugin_PluginImp_initNative

void Java_com_vasco_digipass_sdk_smartfaceplugin_PluginImp_initNative(JNIEnv *env, jobject thiz,jlong jsContext,jlong envMap)
{
	long jscontextlong = (long)jsContext;
	DPPlugin* instance = DPPlugin::getInstance();
	instance->jsContext = (JSContextRef)jsContext;
	instance->envMap = (std::map<long,JNIEnv*>*)envMap;
	instance->pluginImpObject = env->NewGlobalRef(thiz);
    jclass clazz = env->GetObjectClass(thiz);
    jmethodID initMethod = env->GetMethodID(clazz,"init","(Ljava/lang/String;)V");
    jstring fingerprint = env->NewStringUTF(DBFINGERPRINT);
    env->CallVoidMethod(thiz,initMethod,fingerprint);
    env->DeleteLocalRef(fingerprint);
    instance->getBytes = env->GetMethodID(clazz,"getBytes","(Ljava/lang/String;)[B");
    instance->putBytes = env->GetMethodID(clazz,"putBytes","(Ljava/lang/String;Ljava/lang/String;[B)Z");
    instance->initializeRegistrationDataV2JavaFunction = env->GetMethodID(clazz,"initializeRegistrationDataV2","(Ljava/lang/String;[Z)Ljava/lang/String;");
    instance->decryptActivationDataJavaFunction = env->GetMethodID(clazz,"decryptActivationData","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Z)Ljava/lang/String;");
    instance->validateSharedDataChecksumJavaFunction = env->GetMethodID(clazz,"validateSharedDataChecksum","(Ljava/lang/String;[Z)Ljava/lang/String;");
    env->DeleteLocalRef(clazz);
    JSStringRef str = JSStringCreateWithUTF8CString("VASCO");
	JSClassRef classDef = JSClassCreate(&spjsdpplugin_def);
	JSObjectRef classObj = JSObjectMake(instance->jsContext, classDef, (void*)DPPlugin::getInstance());
	JSObjectSetProperty(instance->jsContext, JSContextGetGlobalObject(instance->jsContext), str, classObj, kJSPropertyAttributeNone, NULL);
    JSClassRelease(classDef);
	JSStringRelease(str);
}
开发者ID:memedum90,项目名称:demoforios,代码行数:25,代码来源:plugin-jni-Android.cpp


示例16: Make

 static JSObjectRef Make(JSContextRef context, Args_ &&... args) {
     Internal_ *internal(new Internal_(cy::Forward<Args_>(args)...));
     JSObjectRef object(JSObjectMake(context, Class_, internal));
     if (JSValueRef prototype = internal->GetPrototype(context))
         CYSetPrototype(context, object, prototype);
     return object;
 }
开发者ID:simpzan,项目名称:cycript,代码行数:7,代码来源:Internal.hpp


示例17: constructJSCallback

static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, const ArgList& args)
{
    JSContextRef ctx = toRef(exec);
    JSObjectRef constructorRef = toRef(constructor);

    JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
    if (callback) {
        int argumentCount = static_cast<int>(args.size());
        Vector<JSValueRef, 16> arguments(argumentCount);
        for (int i = 0; i < argumentCount; i++)
            arguments[i] = toRef(exec, args.at(i));

        JSValueRef exception = 0;
        JSObjectRef result;
        {
            JSLock::DropAllLocks dropAllLocks(exec);
            result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
        }
        if (exception)
            exec->setException(toJS(exec, exception));
        return toJS(result);
    }
    
    return toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:25,代码来源:JSCallbackConstructor.cpp


示例18: window_object_cleared__

static void window_object_cleared__(
	WebKitWebView  *wv,
	WebKitWebFrame *wf,
	JSGlobalContextRef ctx,
	gpointer        window_object,
	gpointer        user_data)
{
	const char* name0 = "z$";
	JSStringRef name = JSStringCreateWithUTF8CString(name0);

	JSObjectRef func;
	//func = JSObjectMakeFunctionWithCallback(ctx, name, zs__);
	{
		JSClassDefinition cd = kJSClassDefinitionEmpty;
		cd.className = name0;
		cd.callAsFunction = zs__;
		JSClassRef cr = JSClassCreate (&cd);
		func = JSObjectMake (ctx, cr, NULL);
	}

	JSObjectRef o = JSContextGetGlobalObject(ctx);
	JSObjectSetProperty(ctx, o, name, func, kJSPropertyAttributeNone, NULL);
	JSStringRelease(name);
	/*bool b=*/JSObjectSetPrivate(func, (void*)webkit_view___::from__(wv));
}
开发者ID:zzzzzzzzzzz0,项目名称:zhscript,代码行数:25,代码来源:webkit_view___.cpp


示例19: JSObjectMake

/* static */
Object Object::create(JSContextRef ctx) {
  JSObjectRef newObj = JSObjectMake(
      ctx,
      NULL, // create instance of default object class
      NULL); // no private data
  return Object(ctx, newObj);
}
开发者ID:0m15,项目名称:react-native-1,代码行数:8,代码来源:Value.cpp


示例20: gum_emit_thread

static gboolean
gum_emit_thread (const GumThreadDetails * details,
                 gpointer user_data)
{
  GumJscMatchContext * mc = user_data;
  GumJscCore * core = mc->self->core;
  GumJscScope scope = GUM_JSC_SCOPE_INIT (core);
  JSContextRef ctx = mc->ctx;
  JSObjectRef thread;
  JSValueRef result;
  gboolean proceed;
  gchar * str;

  thread = JSObjectMake (ctx, NULL, NULL);
  _gumjs_object_set_uint (ctx, thread, "id", details->id);
  _gumjs_object_set_string (ctx, thread, "state",
      _gumjs_thread_state_to_string (details->state));
  _gumjs_object_set (ctx, thread, "context", _gumjs_cpu_context_new (ctx,
      (GumCpuContext *) &details->cpu_context, GUM_CPU_CONTEXT_READONLY, core));

  result = JSObjectCallAsFunction (ctx, mc->on_match, NULL, 1,
      (JSValueRef *) &thread, &scope.exception);
  _gum_jsc_scope_flush (&scope);

  proceed = TRUE;
  if (result != NULL && _gumjs_string_try_get (ctx, result, &str, NULL))
  {
    proceed = strcmp (str, "stop") != 0;
    g_free (str);
  }

  return proceed;
}
开发者ID:terry2012,项目名称:frida-gum,代码行数:33,代码来源:gumjsckernel.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ JSObjectSetProperty函数代码示例发布时间:2022-05-30
下一篇:
C++ JSObjectGetProperty函数代码示例发布时间: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