mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Spidermonkey's document.write and document.writeln defined. They work,
but rendering doesn't work
This commit is contained in:
parent
2551fe3525
commit
8bf45d0ece
@ -366,8 +366,9 @@ imported:
|
|||||||
done_string(&code);
|
done_string(&code);
|
||||||
if (!ret.length) return;
|
if (!ret.length) return;
|
||||||
|
|
||||||
format_html_part(html_context, ret.source, ret.source + ret.length,
|
part = format_html_part(html_context, ret.source,
|
||||||
par_format.align, par_format.leftmargin, part->box.width,
|
ret.source + ret.length, par_format.align,
|
||||||
|
par_format.leftmargin, document->options.box.width,
|
||||||
document, part->box.x, part->box.y, NULL, part->link_num);
|
document, part->box.x, part->box.y, NULL, part->link_num);
|
||||||
|
|
||||||
done_string(&ret);
|
done_string(&ret);
|
||||||
|
@ -192,19 +192,25 @@ document_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JSBool document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
|
static JSBool document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
|
||||||
|
static JSBool document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
|
||||||
|
|
||||||
const JSFunctionSpec document_funcs[] = {
|
const JSFunctionSpec document_funcs[] = {
|
||||||
{ "write", document_write, 1 },
|
{ "write", document_write, 1 },
|
||||||
|
{ "writeln", document_writeln, 1 },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_LEDS
|
|
||||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||||
#endif
|
struct string *ret = interpreter->ret;
|
||||||
|
|
||||||
|
if (argc >= 1 && ret) {
|
||||||
|
unsigned char *code = jsval_to_string(ctx, &argv[0]);
|
||||||
|
|
||||||
|
add_to_string(ret, code);
|
||||||
|
}
|
||||||
/* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined
|
/* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined
|
||||||
* function' errors, I want to see just the useful ones. So just
|
* function' errors, I want to see just the useful ones. So just
|
||||||
* lighting a led and going away, no muss, no fuss. --pasky */
|
* lighting a led and going away, no muss, no fuss. --pasky */
|
||||||
@ -220,3 +226,25 @@ document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
|
|||||||
|
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||||
|
struct string *ret = interpreter->ret;
|
||||||
|
|
||||||
|
if (argc >= 1 && ret) {
|
||||||
|
unsigned char *code = jsval_to_string(ctx, &argv[0]);
|
||||||
|
|
||||||
|
add_to_string(ret, code);
|
||||||
|
add_char_to_string(ret, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_LEDS
|
||||||
|
set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
|
||||||
|
#endif
|
||||||
|
|
||||||
|
boolean_to_jsval(ctx, rval, 0);
|
||||||
|
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user