1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

Bug 765: Bypass checks on base tab's view state when copying to a new tab

In setup_session, use copy_location, add_to_history, and
render_document_frames instead of goto_uri and copy_vs to copy the base
tab's view state.  By avoiding goto_uri, setup_session now bypasses MIME
checks, form post confirmations, malicious URL checks, and so on when
copying the base tab's current location and view state to the new tab,
so the new tab should get exactly what was loaded in the base tab.

This fixes bug 765: Opening a new tab can ask about the document of the
previous tab.

(cherry picked from commit 5c96d430c9)

Conflicts:

	src/session/session.c:
		Both elinks-0.12 and master had the ses->doc_view->vs
		= vs assignment, but only elinks-0.12 had vs->doc_view
		= ses->doc_view as well.  Also, struct connection_state
		had been added after the original patch.
This commit is contained in:
Miciah Dashiel Butler Masters 2008-06-11 10:32:02 +00:00 committed by Kalle Olavi Niemitalo
parent b6aca8d9a7
commit f4a231cb9a

View File

@ -22,6 +22,7 @@
#include "document/html/parser.h"
#include "document/html/renderer.h"
#include "document/refresh.h"
#include "document/renderer.h"
#include "document/view.h"
#include "globhist/globhist.h"
#include "intl/gettext/libintl.h"
@ -847,15 +848,13 @@ static void
setup_session(struct session *ses, struct uri *uri, struct session *base)
{
if (base && have_location(base)) {
goto_uri(ses, cur_loc(base)->vs.uri);
if (ses->doc_view && ses->doc_view->vs
&& base->doc_view && base->doc_view->vs) {
struct view_state *vs = ses->doc_view->vs;
struct location *loc = mem_calloc(1, sizeof(*loc));
destroy_vs(vs, 1);
copy_vs(vs, base->doc_view->vs);
ses->doc_view->vs = vs;
vs->doc_view = ses->doc_view;
if (loc) {
loc->download.state = connection_state(S_OK);
copy_location(loc, cur_loc(base));
add_to_history(&ses->history, loc);
render_document_frames(ses, 0);
}
}