summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-08-17 20:26:00 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-08-17 20:26:00 +0100
commit6d39b569c700ddfa405c5c9a7a49320be2945997 (patch)
tree23867f005e9fa7fc59c1d957cb430497cd74c1c4 /render
parentbe00425776514fccddd79d69caa8ed01dc172779 (diff)
downloadnetsurf-6d39b569c700ddfa405c5c9a7a49320be2945997.tar.gz
netsurf-6d39b569c700ddfa405c5c9a7a49320be2945997.tar.bz2
Pass content containing form's nsurl to form_submit, instead of its hlcache_handle. Avoid dereferencing bw in html content handlers.
Diffstat (limited to 'render')
-rw-r--r--render/form.c13
-rw-r--r--render/form.h2
-rw-r--r--render/html_interaction.c2
-rw-r--r--render/textinput.c2
4 files changed, 8 insertions, 11 deletions
diff --git a/render/form.c b/render/form.c
index 40e95ea31..09579dc5b 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1460,7 +1460,7 @@ void form_radio_set(hlcache_handle *content,
* Collect controls and submit a form.
*/
-void form_submit(hlcache_handle *h, struct browser_window *target,
+void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button)
{
char *data = NULL, *url = NULL;
@@ -1507,8 +1507,7 @@ void form_submit(hlcache_handle *h, struct browser_window *target,
url_destroy_components(&components);
- browser_window_go(target, url, nsurl_access(hlcache_handle_get_url(h)),
- true);
+ browser_window_go(target, url, nsurl_access(page_url), true);
break;
case method_POST_URLENC:
@@ -1520,14 +1519,12 @@ void form_submit(hlcache_handle *h, struct browser_window *target,
}
browser_window_go_post(target, form->action, data, 0,
- true, nsurl_access(hlcache_handle_get_url(h)),
- false, true, 0);
+ true, nsurl_access(page_url), false, true, 0);
break;
case method_POST_MULTIPART:
- browser_window_go_post(target, form->action, 0,
- success, true, nsurl_access(hlcache_handle_get_url(h)),
- false, true, 0);
+ browser_window_go_post(target, form->action, 0, success,
+ true, nsurl_access(page_url), false, true, 0);
break;
}
diff --git a/render/form.h b/render/form.h
index e2f9f63b6..dab6a625d 100644
--- a/render/form.h
+++ b/render/form.h
@@ -173,7 +173,7 @@ void form_select_get_dimensions(struct form_control *control,
int *width, int *height);
void form_select_process_selection(hlcache_handle *h,
struct form_control *control, int item);
-void form_submit(struct hlcache_handle *h, struct browser_window *target,
+void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button);
void form_radio_set(struct hlcache_handle *content, struct form_control *radio);
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 1365d77e0..4d21b222c 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -839,7 +839,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
*/
switch (action) {
case ACTION_SUBMIT:
- form_submit(bw->current_content,
+ form_submit(content_get_url(c),
browser_window_find_target(bw, target, mouse),
gadget->form, gadget);
break;
diff --git a/render/textinput.c b/render/textinput.c
index 3c3eb7361..6c580a8cd 100644
--- a/render/textinput.c
+++ b/render/textinput.c
@@ -1911,7 +1911,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t key,
selection_clear(&html->sel, true);
if (form)
- form_submit(bw->current_content, bw, form, 0);
+ form_submit(content_get_url(c), bw, form, 0);
return true;
case KEY_SHIFT_TAB: