mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[spidermonkey] Changed jshandle_value_to_string
This commit is contained in:
parent
20bb653f04
commit
d659fca9fc
@ -1147,12 +1147,11 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin
|
||||
|
||||
if (argc >= 1)
|
||||
{
|
||||
for (int i=0;i<argc;++i)
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
|
||||
jshandle_value_to_char_string(&code,ctx,&args[i]);
|
||||
jshandle_value_to_char_string(&code, ctx, args[i]);
|
||||
}
|
||||
|
||||
|
||||
if (newline)
|
||||
{
|
||||
add_to_string(&code, "\n");
|
||||
@ -1245,8 +1244,8 @@ document_replace(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
init_string(&needle);
|
||||
init_string(&heystack);
|
||||
|
||||
jshandle_value_to_char_string(&needle, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&heystack, ctx, &args[1]);
|
||||
jshandle_value_to_char_string(&needle, ctx, args[0]);
|
||||
jshandle_value_to_char_string(&heystack, ctx, args[1]);
|
||||
|
||||
//DBG("doc replace %s %s\n", needle.source, heystack.source);
|
||||
|
||||
@ -1345,7 +1344,7 @@ document_createComment(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
|
||||
struct string idstr;
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string text = idstr.source;
|
||||
done_string(&idstr);
|
||||
|
||||
@ -1394,7 +1393,7 @@ document_createElement(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
|
||||
struct string idstr;
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string text = idstr.source;
|
||||
done_string(&idstr);
|
||||
|
||||
@ -1443,7 +1442,7 @@ document_createTextNode(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
|
||||
struct string idstr;
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string text = idstr.source;
|
||||
done_string(&idstr);
|
||||
|
||||
@ -1493,7 +1492,7 @@ document_getElementById(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
struct string idstr;
|
||||
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string id = idstr.source;
|
||||
|
||||
std::string xpath = "//*[@id=\"";
|
||||
@ -1555,7 +1554,7 @@ document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *vp
|
||||
struct string idstr;
|
||||
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string id = idstr.source;
|
||||
|
||||
std::string xpath = "//*[@class=\"";
|
||||
@ -1617,7 +1616,7 @@ document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
struct string idstr;
|
||||
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string id = idstr.source;
|
||||
|
||||
std::string xpath = "//*[@id=\"";
|
||||
@ -1680,7 +1679,7 @@ document_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
struct string idstr;
|
||||
|
||||
init_string(&idstr);
|
||||
jshandle_value_to_char_string(&idstr, ctx, &args[0]);
|
||||
jshandle_value_to_char_string(&idstr, ctx, args[0]);
|
||||
std::string id = idstr.source;
|
||||
std::transform(id.begin(), id.end(), id.begin(), ::tolower);
|
||||
|
||||
|
@ -211,8 +211,8 @@ localstorage_setitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
return(true);
|
||||
}
|
||||
|
||||
jshandle_value_to_char_string(&key,ctx,&args[0]);
|
||||
jshandle_value_to_char_string(&val,ctx,&args[1]);
|
||||
jshandle_value_to_char_string(&key, ctx, args[0]);
|
||||
jshandle_value_to_char_string(&val, ctx, args[1]);
|
||||
|
||||
saveToStorage(key.source,val.source);
|
||||
|
||||
|
@ -8,9 +8,7 @@ static void string_to_jsval(JSContext *ctx, JS::Value *vp, char *string);
|
||||
static void astring_to_jsval(JSContext *ctx, JS::Value *vp, char *string);
|
||||
|
||||
static int jsval_to_boolean(JSContext *ctx, JS::Value *vp);
|
||||
static void jshandle_value_to_char_string(struct string *string, JSContext *ctx, JS::MutableHandleValue *obj);
|
||||
|
||||
|
||||
static void jshandle_value_to_char_string(struct string *string, JSContext *ctx, JS::HandleValue obj);
|
||||
|
||||
/** Inline functions */
|
||||
|
||||
@ -43,20 +41,20 @@ jsval_to_boolean(JSContext *ctx, JS::Value *vp)
|
||||
* is different for String and Number and must be
|
||||
* handled accordingly */
|
||||
void
|
||||
jshandle_value_to_char_string(struct string *string,JSContext *ctx, JS::MutableHandleValue *obj)
|
||||
jshandle_value_to_char_string(struct string *string, JSContext *ctx, JS::HandleValue obj)
|
||||
{
|
||||
init_string(string);
|
||||
|
||||
if (obj->isString())
|
||||
|
||||
if (obj.isString())
|
||||
{
|
||||
add_to_string(string,JS_EncodeString(ctx, obj->toString()));
|
||||
} else if (obj->isNumber())
|
||||
add_to_string(string, jsval_to_string(ctx, obj));
|
||||
} else if (obj.isNumber())
|
||||
{
|
||||
int tmpinta = obj->toNumber();
|
||||
int tmpinta = obj.toNumber();
|
||||
add_format_to_string(string, "%d", tmpinta);
|
||||
} else if (obj->isBoolean())
|
||||
} else if (obj.isBoolean())
|
||||
{
|
||||
int tmpinta = obj->toNumber();
|
||||
int tmpinta = obj.toNumber();
|
||||
add_format_to_string(string, "%d", tmpinta);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user