From 10589b04eb8c6983cb87c71a1cafd0327fdd4d0f Mon Sep 17 00:00:00 2001 From: witekfl Date: Thu, 9 Feb 2006 22:50:30 +0100 Subject: [PATCH] Base href was lost while setting form->action by ECMAScript. This is attempt to fix it --- src/ecmascript/see/form.c | 12 +++++++++++- src/ecmascript/spidermonkey/form.c | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/ecmascript/see/form.c b/src/ecmascript/see/form.c index cbb6c9e8c..2fc5ac58b 100644 --- a/src/ecmascript/see/form.c +++ b/src/ecmascript/see/form.c @@ -859,7 +859,17 @@ form_put(struct SEE_interpreter *interp, struct SEE_object *o, return; if (p == s_action) { - mem_free_set(&form->action, string); + if (form->action) { + struct uri *uri = get_uri(form->action, URI_HTTP_REFERRER_HOST); + + if (uri) { + mem_free_set(&form->action, join_urls(uri, string)); + mem_free(string); + done_uri(uri); + } + } else { + mem_free_set(&form->action, string); + } } else if (p == s_encoding) { if (!strcasecmp(string, "application/x-www-form-urlencoded")) { form->method = form->method == FORM_METHOD_GET ? FORM_METHOD_GET diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 85889579f..e50384dca 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -735,6 +735,15 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp) switch (JSVAL_TO_INT(id)) { case JSP_FORM_ACTION: + if (form->action) { + struct uri *uri = get_uri(form->action, URI_HTTP_REFERRER_HOST); + + if (uri) { + mem_free_set(&form->action, join_urls(uri, jsval_to_string(ctx, vp))); + done_uri(uri); + break; + } + } mem_free_set(&form->action, stracpy(jsval_to_string(ctx, vp))); break;