1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 723: Always get the current frame when loading frame files

This cleans up and changes the calling convention of
load_additional_file(), so that it now grab its own doc_view using
current_frame() and the struct session pointer in the file_to_load
object. By always looking up the current frame, corruption of doc_view
due to rerendering of the upper frame document is avoided.

The fix extends commit 6afdbf608f by
Witold, which moved the getting of doc_view in the other caller of
load_additional_file(). The additional clean up ensures that any future
users of load_additional_file() will not reintroduce a similar bug.

A possible future optimization would be to change load_additional_file()
to take the referrer as an argument.
This commit is contained in:
Jonas Fonseca 2007-07-24 15:27:21 +02:00
parent efcd6c9758
commit a721f62be3

View File

@ -699,9 +699,9 @@ request_additional_file(struct session *ses, unsigned char *name, struct uri *ur
} }
static void static void
load_additional_file(struct file_to_load *ftl, struct document_view *doc_view, load_additional_file(struct file_to_load *ftl, enum cache_mode cache_mode)
enum cache_mode cache_mode)
{ {
struct document_view *doc_view = current_frame(ftl->ses);
struct uri *referrer = doc_view && doc_view->document struct uri *referrer = doc_view && doc_view->document
? doc_view->document->uri : NULL; ? doc_view->document->uri : NULL;
@ -719,15 +719,12 @@ process_file_requests(struct session *ses)
int more = 0; int more = 0;
foreach (ftl, ses->more_files) { foreach (ftl, ses->more_files) {
struct document_view *doc_view;
if (ftl->req_sent) if (ftl->req_sent)
continue; continue;
ftl->req_sent = 1; ftl->req_sent = 1;
doc_view = current_frame(ses); load_additional_file(ftl, CACHE_MODE_NORMAL);
load_additional_file(ftl, doc_view, CACHE_MODE_NORMAL);
more = 1; more = 1;
} }
@ -1194,7 +1191,6 @@ reload(struct session *ses, enum cache_mode cache_mode)
if (have_location(ses)) { if (have_location(ses)) {
struct location *loc = cur_loc(ses); struct location *loc = cur_loc(ses);
struct file_to_load *ftl; struct file_to_load *ftl;
struct document_view *doc_view = current_frame(ses);
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
loc->vs.ecmascript_fragile = 1; loc->vs.ecmascript_fragile = 1;
@ -1217,7 +1213,7 @@ reload(struct session *ses, enum cache_mode cache_mode)
ftl->download.data = ftl; ftl->download.data = ftl;
ftl->download.callback = (download_callback_T *) file_loading_callback; ftl->download.callback = (download_callback_T *) file_loading_callback;
load_additional_file(ftl, doc_view, cache_mode); load_additional_file(ftl, cache_mode);
} }
} }
} }