bool S_CCLabelTTF::initWithContext(JSContextRef ctx, JSObjectRef obj, size_t argumentCount, const JSValueRef arguments[])
{
	bool result = true;
	if (argumentCount == 3) {
		char *buffText = (char *)malloc(128);
		char *buffFont = (char *)malloc(128);
		
		JSStringRef jsLabelText = JSValueToStringCopy(ctx, arguments[0], NULL);
		JSStringRef jsFontName  = JSValueToStringCopy(ctx, arguments[1], NULL);
		float fontSize = JSValueToNumber(ctx, arguments[2], NULL);
		
		JSStringGetUTF8CString(jsLabelText, buffText, 128);
		JSStringGetUTF8CString(jsFontName, buffFont, 128);
		
		if (!CCLabelTTF::initWithString(buffText, buffFont, fontSize)) {
			return false;
		}
		free(buffText);
		free(buffFont);
	} else {
		if (!CCLabelTTF::init()) {
			result = false;
		}
	}
	if (result) {
		setUserData(obj);
	}
	return result;
}
Exemple #2
0
char* jsstring_to_cstr(JSContextRef ctx, JSStringRef js_string)
{
  size_t len = JSStringGetMaximumUTF8CStringSize(js_string);
  char *c_str = g_new(char, len);
  JSStringGetUTF8CString(js_string, c_str, len);
  return c_str;
}
// has property methods for callbacks. method parameter definitions( e.message, e.otp, e.data)
bool spjsdata_has_property_cb(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
{
    bool ret = false;
    int propertySize = JSStringGetMaximumUTF8CStringSize(propertyName);
    char* property = (char *)malloc(propertySize * sizeof(char));
    JSStringGetUTF8CString(propertyName, property, propertySize);
 	if(strcmp(kParamOTP,property) == 0)
    {
        ret = true;
    }
    if(strcmp(kParamCode,property) == 0)
    {
        ret = true;
    }
    if(strcmp(kParamMessage,property) == 0)
    {
        ret = true;
    }
    if(strcmp(kParamData,property) == 0)
    {
        ret = true;
    }
    
    free(property);
    return ret;
}
static JSValueRef setMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
    if (!view)
        return JSValueMakeUndefined(context);

    if (argumentCount < 3)
        return JSValueMakeUndefined(context);

    JSStringRef string = JSValueToStringCopy(context, arguments[0], exception);
    g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));

    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(string);
    GOwnPtr<gchar> stringBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
    JSStringGetUTF8CString(string, stringBuffer.get(), bufferSize);
    JSStringRelease(string);

    int start = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
    g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));

    int end = static_cast<int>(JSValueToNumber(context, arguments[2], exception));
    g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));

    DumpRenderTreeSupportGtk::setComposition(view, stringBuffer.get(), start, end);

    return JSValueMakeUndefined(context);
}
Exemple #5
0
static void web_view_javascript_finished(GObject      *object,
                              GAsyncResult *result,
                              gpointer      user_data)
{
    WebKitJavascriptResult *js_result;
    JSValueRef              value;
    JSGlobalContextRef      context;
    GError                 *error = NULL;

    js_result = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error);
    if (!js_result) {
        g_warning ("Error running javascript: %s", error->message);
        g_error_free (error);
        return;
    }

    context = webkit_javascript_result_get_global_context(js_result);
    value = webkit_javascript_result_get_value(js_result);
    if (JSValueIsString(context, value)) {
        JSStringRef js_str_value;
        gchar      *str_value;
        gsize       str_length;

        js_str_value = JSValueToStringCopy(context, value, NULL);
        str_length = JSStringGetMaximumUTF8CStringSize(js_str_value);
        str_value = (gchar *)g_malloc(str_length);
        JSStringGetUTF8CString(js_str_value, str_value, str_length);
        JSStringRelease(js_str_value);
        g_free (str_value);
    } else {
        g_warning("Error running javascript: unexpected return value");
    }
    webkit_javascript_result_unref(js_result);
}
Exemple #6
0
JSValueRef function_read_file(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject,
                              size_t argc, const JSValueRef args[], JSValueRef *exception) {
    // TODO: implement fully

    if (argc == 1 && JSValueGetType(ctx, args[0]) == kJSTypeString) {
        char path[100];
        JSStringRef path_str = JSValueToStringCopy(ctx, args[0], NULL);
        assert(JSStringGetLength(path_str) < 100);
        JSStringGetUTF8CString(path_str, path, 100);
        JSStringRelease(path_str);

        // debug_print_value("read_file", ctx, args[0]);

        time_t last_modified = 0;
        char *contents = get_contents(path, &last_modified);
        if (contents != NULL) {
            JSStringRef contents_str = JSStringCreateWithUTF8CString(contents);
            free(contents);

            JSValueRef res[2];
            res[0] = JSValueMakeString(ctx, contents_str);
            res[1] = JSValueMakeNumber(ctx, last_modified);
            return JSObjectMakeArray(ctx, 2, res, NULL);
        }
    }

    return JSValueMakeNull(ctx);
}
Exemple #7
0
JSValueRef ej_getNativeClass(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef* exception) {
    size_t classNameSize = JSStringGetMaximumUTF8CStringSize(propertyNameJS);
    char* className = (char*)malloc(classNameSize);
    JSStringGetUTF8CString(propertyNameJS, className, classNameSize);

    JSObjectRef obj = NULL;
    NSString * fullClassName = new NSString();

    NSLOG("ej_getNativeClass : EJBinding%s", className);

    fullClassName->initWithFormat("EJBinding%s",className);
    EJBindingBase* pClass = (EJBindingBase*)NSClassFromString(fullClassName->getCString());
    if( pClass ) {
        obj = JSObjectMake( ctx, ej_constructorClass, (void *)pClass );
    } else {
        NSLOG("%s is NULL ... ", fullClassName->getCString());
    }

    if (obj)
    {
        NSLOG("constructor js-obj for %s", className);
    }

    free(className);
    fullClassName->autorelease();
    return obj ? obj : ej_global_undefined;
}
Exemple #8
0
JSValueRef JSCCharacterData::appendDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) {

	struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);

	if (false) {
	} else if (argumentCount == 1 &&
	           JSValueIsString(ctx, arguments[0])) {
		JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[0], exception);
		size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg);
		char* localArgBuffer = new char[localArgMaxSize];
		JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, localArgMaxSize);
		std::string localArg(localArgBuffer);
		JSStringRelease(stringReflocalArg);
		free(localArgBuffer);


		privData->nativeObj->appendData(localArg);

		JSValueRef jscRetVal = JSValueMakeUndefined(ctx);
		return jscRetVal;
	}

	JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling appendData");
	*exception = JSValueMakeString(ctx, exceptionString);
	JSStringRelease(exceptionString);
	return JSValueMakeUndefined(ctx);
}
/*
 * Converts an argument to a string.
 *
 * Convert a JSValueRef argument to a g_malloc'd gchar string. Calling function
 * is responsible for g_freeing the string.
 */
static gchar *
arg_to_string(JSContextRef context, JSValueRef arg, JSValueRef *exception) {
	JSStringRef string;
	size_t size;
	gchar *result;

	if (JSValueGetType(context, arg) != kJSTypeString) {
		_mkexception(context, exception, EXPECTSTRING);

		return NULL;
	}

	string = JSValueToStringCopy(context, arg, exception);

	if (!string) {

		return NULL;
	}

	size = JSStringGetMaximumUTF8CStringSize(string);
	result = g_malloc(size);

	if (!result) {

		return NULL;
	}

	JSStringGetUTF8CString(string, result, size);
	JSStringRelease(string);

	return result;
}
static bool setProperty(JSContextRef jscore_ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef *exception)
{
	pdf_jsimp *imp;
	char buf[STRING_BUF_SIZE];
	prop *p;

	priv_data *pdata = JSObjectGetPrivate(object);
	if (pdata == NULL)
		return false;

	JSStringGetUTF8CString(propertyName, buf, STRING_BUF_SIZE);
	p = find_prop(pdata->type->props, buf);
	if (p == NULL)
		return false;

	imp = pdata->type->imp;

	switch(p->type)
	{
		case PROP_FN:
			break;

		case PROP_VAL:
			{
				pdf_jsimp_obj *pval = wrap_val(imp, value);
				p->u.val.set(imp->nat_ctx, pdata->natobj, pval);
				pdf_jsimp_drop_obj(imp, pval);
			}
			break;
	}

	return true;
}
/**
 * return a char* from a JSStringRef as string which must be delete when finished
 */
EXPORTAPI char * HyperloopJSStringToStringCopy(JSContextRef ctx, JSStringRef str, JSValueRef *exception)
{
    auto size = JSStringGetMaximumUTF8CStringSize(str);
    auto buf = new char[size];
    JSStringGetUTF8CString(str,buf,size);
    return buf;
}
static gboolean element_text_equal_to(JSContextRef context, const gchar* text)
{
    JSStringRef scriptString = JSStringCreateWithUTF8CString(
      "window.document.getElementById(\"in\").value;");
    JSValueRef value = JSEvaluateScript(context, scriptString, 0, 0, 0, 0);
    JSStringRelease(scriptString);

    // If the value isn't a string, the element is probably a div
    // so grab the innerText instead.
    if (!JSValueIsString(context, value)) {
        JSStringRef scriptString = JSStringCreateWithUTF8CString(
          "window.document.getElementById(\"in\").innerText;");
        value = JSEvaluateScript(context, scriptString, 0, 0, 0, 0);
        JSStringRelease(scriptString);
    }

    g_assert(JSValueIsString(context, value));
    JSStringRef inputString = JSValueToStringCopy(context, value, 0);
    g_assert(inputString);

    gint size = JSStringGetMaximumUTF8CStringSize(inputString);
    gchar* cString = g_malloc(size);
    JSStringGetUTF8CString(inputString, cString, size);
    JSStringRelease(inputString);

    gboolean result = g_utf8_collate(cString, text) == 0;
    g_free(cString);
    return result;
}
Exemple #13
0
static gchar* js_extract_string(JSStringRef string)
{
    gsize size = JSStringGetMaximumUTF8CStringSize(string);
    gchar* gstr = (gchar*) g_malloc(size);
    JSStringGetUTF8CString(string, gstr, size);
    return gstr;
}
char *pdf_jsimp_to_string(pdf_jsimp *imp, pdf_jsimp_obj *obj)
{
	fz_context *ctx = imp->ctx;
	JSStringRef jstr = JSValueToStringCopy(imp->jscore_ctx, obj->ref, NULL);
	int len;

	if (jstr == NULL)
		return "";

	fz_try(ctx)
	{
		len = JSStringGetMaximumUTF8CStringSize(jstr);
		fz_free(ctx, obj->str);
		obj->str = NULL;
		obj->str = fz_malloc(ctx, len+1);
		JSStringGetUTF8CString(jstr, obj->str, len+1);
	}
	fz_always(ctx)
	{
		JSStringRelease(jstr);
	}
	fz_catch(ctx)
	{
		fz_rethrow(ctx);
	}

	return obj->str;
}
Exemple #15
0
JSValueRef function_import_script(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject,
		size_t argc, const JSValueRef args[], JSValueRef* exception) {
	if (argc == 1 && JSValueGetType(ctx, args[0]) == kJSTypeString) {
		JSStringRef path_str_ref = JSValueToStringCopy(ctx, args[0], NULL);
		assert(JSStringGetLength(path_str_ref) < 100);
		char tmp[100];
		tmp[0] = '\0';
		JSStringGetUTF8CString(path_str_ref, tmp, 100);
		JSStringRelease(path_str_ref);

		char *path = tmp;
		if (str_has_prefix(path, "goog/../") == 0) {
			path = path + 8;
		}

		char *source = NULL;
		if (out_path == NULL) {
			source = bundle_get_contents(path);
		} else {
			char *full_path = str_concat(out_path, path);
			source = get_contents(full_path, NULL);
			free(full_path);
		}

		if (source != NULL) {
			evaluate_script(ctx, source, path);
			free(source);
		}
	}

	return JSValueMakeUndefined(ctx);
}
Exemple #16
0
std::wstring hyperloop::getWString(JSStringRef sValue) {
	size_t sLength = JSStringGetMaximumUTF8CStringSize(sValue);
	char* cValue = new char[sLength];
	JSStringGetUTF8CString(sValue, cValue, sLength);
	std::string s_str = cValue;
	std::wstring w_str(s_str.begin(), s_str.end());
	return w_str;
}
// Returns a newly allocated UTF-8 character buffer which must be freed with g_free()
char* JSStringCopyUTF8CString(JSStringRef jsString)
{
    size_t dataSize = JSStringGetMaximumUTF8CStringSize(jsString);
    char* utf8 = (char*)malloc(dataSize);
    JSStringGetUTF8CString(jsString, utf8, dataSize);

    return utf8;
}
Exemple #18
0
Platform::String^ Utils::getPlatformString(JSStringRef sValue) {
	size_t sLength = JSStringGetMaximumUTF8CStringSize(sValue);
	char* cValue = new char[sLength];
	JSStringGetUTF8CString(sValue, cValue, sLength);
	std::string s_str = cValue;
	std::wstring w_str(s_str.begin(), s_str.end());
	return ref new Platform::String(w_str.c_str());
}
Exemple #19
0
static String coreAttributeToAtkAttribute(JSStringRef attribute)
{
    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute);
    GOwnPtr<gchar> buffer(static_cast<gchar*>(g_malloc(bufferSize)));
    JSStringGetUTF8CString(attribute, buffer.get(), bufferSize);

    String attributeString = String::fromUTF8(buffer.get());
    return attributeString == "AXPlaceholderValue" ? "placeholder-text" : String();
}
Exemple #20
0
char* JSUtils::JSStringRef_to_CharArray(JSStringRef jsString)
{
    char* buf = 0L;
    int len = JSStringGetLength(jsString) + 1;
    buf = (char*) malloc(len*sizeof(char));
    JSStringGetUTF8CString(jsString, buf, len);
    
    return buf;
}
Exemple #21
0
String JSStringToString(JSStringRef str)
{
    size_t len = JSStringGetMaximumUTF8CStringSize(str);
    char* buf = new char[len + 1];
    JSStringGetUTF8CString(str, buf, len + 1);

    String result(buf);
    delete[] buf;

    return result;
}
Exemple #22
0
// has property method for callback parameters
JSValueRef spjsdata_get_property_cb(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
    bool ret = false;
    JSValueRef retval;
    int propertySize = JSStringGetMaximumUTF8CStringSize(propertyName);
    char* property = (char*)malloc(propertySize*sizeof(char));
    JSStringGetUTF8CString(propertyName, property, propertySize);
    char* data = (char*)JSObjectGetPrivate(object);
    if(strcmp(kParamOTP,property) == 0)
    {

        JSStringRef sref = JSStringCreateWithUTF8CString(data);
		JSValueRef ref = JSValueMakeString(ctx, sref);
        retval = ref;
        ret = true;
    }
    if(strcmp(kParamCode,property) == 0)
    {
        JSStringRef sref = JSStringCreateWithUTF8CString(data);
		JSValueRef ref = JSValueMakeString(ctx, sref);
        retval = ref;
        ret = true;
    }
    if(strcmp(kParamMessage,property) == 0)
    {
        JSStringRef sref = JSStringCreateWithUTF8CString(data);
		JSValueRef ref = JSValueMakeString(ctx, sref);
        retval = ref;
        ret = true;
    }
    if(strcmp(kParamData,property) == 0)
    {
        //JSStringRef sref = JSStringCreateWithUTF8CString(data);
  //JSValueRef ref = JSValueMakeString(ctx, sref);
        
        // json object is passed to e.data
        DPInfo* info = (DPInfo*)JSObjectGetPrivate(object);
//        std::string json = "{\"status\":\"" + (char)info->status + "\",\"version\":\"" + info->version + "\",\"serial\":\"" + info->serial + "\"}";

        char *jsonBuffer = new char[256];
        memset(jsonBuffer, 0, 256);
        sprintf(jsonBuffer, "{\"status\":\"%u\",\"version\":\"%u\",\"serial\":\"%s\",\"passwordFatalCounter\":\"%u\",\"appEventCounter\":\"%lu\"}", info->status, info->version, info->serial.c_str(), info->fatalCounter, info->appEventCounter);
        JSStringRef sref = JSStringCreateWithUTF8CString(jsonBuffer);
        delete []jsonBuffer;

        JSValueRef ref = JSValueMakeFromJSONString(ctx, sref);
        retval = ref;
        ret = true;
    }

    free(property);
    return retval;
}
::testing::AssertionResult runJSTest(const char*, const char*, const char*, WKPageRef page, const char* script, const char* expectedResult)
{
    JavaScriptCallbackContext context;
    WKPageRunJavaScriptInMainFrame(page, Util::toWK(script).get(), &context, javaScriptCallback);
    Util::run(&context.didFinish);

    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(context.actualString.get());
    auto buffer = std::make_unique<char[]>(bufferSize);
    JSStringGetUTF8CString(context.actualString.get(), buffer.get(), bufferSize);
    
    return compareJSResult(script, buffer.get(), expectedResult);
}
Exemple #24
0
static gchar *
js_string (JSStringRef js_string)
{
  gsize size;
  gchar *string;

  size = JSStringGetMaximumUTF8CStringSize (js_string);
  string = g_malloc (size + 1);
  JSStringGetUTF8CString (js_string, string, size);

  return string;
}
static JSValueRef
zs__                (JSContextRef     js_context,
                     JSObjectRef      js_function,
                     JSObjectRef      js_this,
                     size_t           argument_count,
                     const JSValueRef js_arguments[],
                     JSValueRef*      js_exception)
{
	if(argument_count<=0){
		return JSValueMakeNull (js_context);
	}
	const char*ret;
	{
		window___* w=reinterpret_cast<window___*>(JSObjectGetPrivate(js_function));
		if(!w){
			return JSValueMakeNull (js_context);
		}
		char** argv=new char*[argument_count+1];
		JSStringRef* jsr=new JSStringRef[argument_count];
		for(size_t i=0;i<argument_count;i++){
			jsr[i]=JSValueToStringCopy(js_context, js_arguments[i], js_exception);
			size_t jsSize = JSStringGetMaximumUTF8CStringSize(jsr[i]);
			argv[i]=new char[jsSize];
			JSStringGetUTF8CString(jsr[i], argv[i], jsSize);
		}
		if(!argv[0][0]){
			ret=NULL;
			for(size_t i=1;i<argument_count;i++)
				cout<<argv[i];
			cout<<endl;
		}else
			ret=call4__(argv[0],NULL,argument_count,(const char**)argv,1);
		for(size_t i=0;i<argument_count;i++){
			delete argv[i];
			JSStringRelease(jsr[i]);
		}
		delete jsr;
		delete argv;
	}

	if(!ret)
		return JSValueMakeNull (js_context);
	JSValueRef ret2;
	if(true_==ret||false_==ret){
		ret2=JSValueMakeBoolean(js_context,true_==ret);
	}else{
		JSStringRef ret1=JSStringCreateWithUTF8CString(ret);
		ret2=JSValueMakeString(js_context,ret1);
		JSStringRelease (ret1);
	}
	return ret2;
}
static char* jsValueToCString(JSGlobalContextRef context, JSValueRef value)
{
    g_assert(value);
    g_assert(JSValueIsString(context, value));

    JSRetainPtr<JSStringRef> stringValue(Adopt, JSValueToStringCopy(context, value, 0));
    g_assert(stringValue);

    size_t cStringLength = JSStringGetMaximumUTF8CStringSize(stringValue.get());
    char* cString = static_cast<char*>(g_malloc(cStringLength));
    JSStringGetUTF8CString(stringValue.get(), cString, cStringLength);
    return cString;
}
JNIEXPORT jint JNICALL WebKit_win32_NATIVE(JSStringGetUTF8CString)
	(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2)
{
	jbyte *lparg1=NULL;
	jint rc = 0;
	WebKit_win32_NATIVE_ENTER(env, that, JSStringGetUTF8CString_FUNC);
	if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail;
	rc = (jint)JSStringGetUTF8CString((JSStringRef)arg0, (char *)lparg1, (size_t)arg2);
fail:
	if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, 0);
	WebKit_win32_NATIVE_EXIT(env, that, JSStringGetUTF8CString_FUNC);
	return rc;
}
Exemple #28
0
bool LoadItem::invoke() const
{
    size_t targetArrSize = JSStringGetMaximumUTF8CStringSize(m_target.get());
    size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(m_url.get());
    OwnArrayPtr<char> target(new char[targetArrSize]);
    OwnArrayPtr<char> url(new char[urlArrSize]);
    size_t targetLen = JSStringGetUTF8CString(m_target.get(), target.get(), targetArrSize) - 1;
    JSStringGetUTF8CString(m_url.get(), url.get(), urlArrSize);

    WebCore::Frame* frame;
    if (target && targetLen)
        frame = mainFrame->tree()->find(target.get());
    else
        frame = mainFrame;

    if (!frame)
        return false;

    WebCore::KURL kurl = WebCore::KURL(WebCore::KURL(), url.get());
    frame->loader()->load(kurl, false);
    return true;
}
Exemple #29
0
bool JSCArrayBuffer::mimeTypeAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
	struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj);

	JSStringRef stringReflocalMimeType = JSValueToStringCopy(ctx, value, exception);
	size_t localMimeTypeMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalMimeType);
	char* localMimeTypeBuffer = new char[localMimeTypeMaxSize];
	JSStringGetUTF8CString(stringReflocalMimeType, localMimeTypeBuffer, localMimeTypeMaxSize);
	std::string localMimeType(localMimeTypeBuffer);
	JSStringRelease(stringReflocalMimeType);
	free(localMimeTypeBuffer);

	privData->nativeObj->setMimeType(localMimeType);
	return true;
}
Exemple #30
0
/* Sys.print implementation */
static JSValueRef cb_sysclass_print(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) {
	/* At least, one argument must be received */
	if (argumentCount == 1 && JSValueIsString(context, arguments[0])) {
		/* Converts JSValue to char */
		size_t len;
		char * cstr;
		JSStringRef jsstr = JSValueToStringCopy(context, arguments[0], NULL);
		len = JSStringGetMaximumUTF8CStringSize(jsstr);
		cstr = g_new(char, len);
		JSStringGetUTF8CString(jsstr, cstr, len);
		g_print("%s\n\n", cstr);
		g_free(cstr);
		JSStringRelease(jsstr);
	}