From a464157d4d81a5a37e9d7c295b183f048abeb3fd Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Sun, 12 Feb 2006 04:33:42 +0000 Subject: [PATCH] SEE & SMJS: document.write(ln): use all arguments Additionally add a test to test/ecmascript/document_write.html. Thanks to Kirk Reiser for observing that ELinks only printed the first. --- src/ecmascript/see/document.c | 14 ++++++++++---- src/ecmascript/spidermonkey/document.c | 9 +++++++-- test/ecmascript/document_write.html | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/ecmascript/see/document.c b/src/ecmascript/see/document.c index 8705849b7..49bc455e4 100644 --- a/src/ecmascript/see/document.c +++ b/src/ecmascript/see/document.c @@ -212,11 +212,17 @@ js_document_write_do(struct SEE_interpreter *interp, struct SEE_object *self, struct string *ret = g->ret; if (argc >= 1 && ret) { - unsigned char *code = SEE_value_to_unsigned_char(interp, argv[0]); + int i = 0; - if (code) { - add_to_string(ret, code); - mem_free(code); + for (; i < argc; ++i) { + unsigned char *code; + + code = SEE_value_to_unsigned_char(interp, argv[i]); + + if (code) { + add_to_string(ret, code); + mem_free(code); + } } if (newline) diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 896daacf7..cef2aa236 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -212,9 +212,14 @@ document_write_do(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, struct string *ret = interpreter->ret; if (argc >= 1 && ret) { - unsigned char *code = jsval_to_string(ctx, &argv[0]); + int i = 0; + + for (; i < argc; ++i) { + unsigned char *code = jsval_to_string(ctx, &argv[i]); + + add_to_string(ret, code); + } - add_to_string(ret, code); if (newline) add_char_to_string(ret, '\n'); } diff --git a/test/ecmascript/document_write.html b/test/ecmascript/document_write.html index 2721529ae..02856d605 100644 --- a/test/ecmascript/document_write.html +++ b/test/ecmascript/document_write.html @@ -3,7 +3,8 @@ history.html
onload.html