1
0
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:
2006-01-27 13:29:38 +01:00
parent 2551fe3525
commit 8bf45d0ece
2 changed files with 33 additions and 4 deletions

View File

@ -366,8 +366,9 @@ imported:
done_string(&code);
if (!ret.length) return;
format_html_part(html_context, ret.source, ret.source + ret.length,
par_format.align, par_format.leftmargin, part->box.width,
part = format_html_part(html_context, ret.source,
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);
done_string(&ret);

View File

@ -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_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
const JSFunctionSpec document_funcs[] = {
{ "write", document_write, 1 },
{ "writeln", document_writeln, 1 },
{ NULL }
};
static JSBool
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
#ifdef CONFIG_LEDS
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
* function' errors, I want to see just the useful ones. So just
* 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;
}
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;
}