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;