1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
This commit is contained in:
Kalle Olavi Niemitalo 2006-02-12 17:54:22 +02:00 committed by Kalle Olavi Niemitalo
commit a1f26c1f25
7 changed files with 9 additions and 61 deletions

View File

@ -11,7 +11,6 @@
struct cache_entry;
struct document_refresh;
struct document_view;
struct form_control;
struct frame_desc;
struct frameset_desc;
@ -148,8 +147,6 @@ struct document {
* dependencies between the various entries so nothing gets removed
* unneeded. */
struct uri_list ecmascript_imports;
/* For ecmascript access */
struct document_view *doc_view;
#endif
#ifdef CONFIG_CSS
/* FIXME: We should externally maybe using cache_entry store the

View File

@ -17,8 +17,6 @@
#include "config/options.h"
#include "document/css/apply.h"
#include "document/document.h"
#include "document/view.h"
#include "document/html/frames.h"
#include "document/html/parser/general.h"
#include "document/html/parser/link.h"
@ -28,7 +26,6 @@
#include "document/html/renderer.h"
#include "document/html/tables.h"
#include "document/options.h"
#include "ecmascript/ecmascript.h"
#include "intl/charsets.h"
#include "protocol/uri.h"
#include "terminal/draw.h"
@ -40,7 +37,6 @@
#include "util/memdebug.h"
#include "util/memory.h"
#include "util/string.h"
#include "viewer/text/vs.h"
/* Unsafe macros */
#include "document/html/internal.h"
@ -347,42 +343,8 @@ imported:
}
if (html_context->part->document && *html != '^') {
struct string code, ret;
struct part *part = html_context->part;
struct document *document = part->document;
struct document_view *doc_view = document->doc_view;
struct view_state *vs = doc_view->vs;
struct ecmascript_interpreter *interpreter;
if (vs->ecmascript_fragile)
ecmascript_reset_state(vs);
interpreter = vs->ecmascript;
assert(interpreter);
if (!init_string(&code)) return;
if (!init_string(&ret)) {
done_string(&code);
return;
}
add_bytes_to_string(&code, html, *end - html);
ecmascript_eval(interpreter, &code, &ret);
done_string(&code);
if (!ret.length) {
done_string(&ret);
return;
}
/* FIXME: it doesn't work */
html_top->invisible = 0;
parse_html(ret.source, ret.source + ret.length, part, NULL,
html_context);
done_string(&ret);
#if 0
add_to_string_list(&html_context->part->document->onload_snippets,
html, *end - html);
#endif
}
#endif
}

View File

@ -282,6 +282,7 @@ render_document(struct view_state *vs, struct document_view *doc_view,
options->gradual_rerendering, struri(vs->uri),
doc_view, doc_view->name, vs);
#endif
name = doc_view->name;
doc_view->name = NULL;
@ -325,18 +326,13 @@ render_document(struct view_state *vs, struct document_view *doc_view,
document = get_cached_document(cached, options);
if (document) {
doc_view->document = document;
#ifdef CONFIG_ECMASCRIPT
document->doc_view = doc_view;
#endif
} else {
document = init_document(cached, options);
if (!document) return;
doc_view->document = document;
shrink_memory(0);
#ifdef CONFIG_ECMASCRIPT
document->doc_view = doc_view;
#endif
render_encoded_document(cached, document);
sort_links(document);
if (!document->title) {

View File

@ -351,8 +351,7 @@ bittorrent_fetch_callback(struct download *download, void *data)
return;
if (cached->redirect && fetcher->redirects++ < MAX_REDIRECTS) {
if (is_in_progress_state(download->state))
cancel_download(download, 0);
cancel_download(download, 0);
download->state = S_WAIT_REDIR;
@ -427,8 +426,7 @@ end_bittorrent_fetch(void *fetcher_data)
assert(fetcher && !fetcher->callback);
/* Stop any running connections. */
if (is_in_progress_state(fetcher->download.state))
cancel_download(&fetcher->download, 0);
cancel_download(&fetcher->download, 0);
mem_free(fetcher);
}

View File

@ -140,8 +140,7 @@ abort_download(struct file_download *file_download)
if (file_download->dlg_data)
cancel_dialog(file_download->dlg_data, NULL);
if (is_in_progress_state(file_download->download.state))
cancel_download(&file_download->download, file_download->stop);
cancel_download(&file_download->download, file_download->stop);
if (file_download->uri) done_uri(file_download->uri);
if (file_download->handle != -1) {
@ -389,8 +388,7 @@ download_data(struct download *download, struct file_download *file_download)
file_download->remotetime = parse_date(&cached->last_modified, NULL, 0, 1);
if (cached->redirect && file_download->redirect_cnt++ < MAX_REDIRECTS) {
if (is_in_progress_state(download->state))
cancel_download(&file_download->download, 0);
cancel_download(&file_download->download, 0);
assertm(compare_uri(cached->uri, file_download->uri, 0),
"Redirecting using bad base URI");
@ -900,8 +898,7 @@ void
done_type_query(struct type_query *type_query)
{
/* Unregister any active download */
if (is_in_progress_state(type_query->download.state))
cancel_download(&type_query->download, 0);
cancel_download(&type_query->download, 0);
object_unlock(type_query->cached);
done_uri(type_query->uri);

View File

@ -1124,8 +1124,7 @@ abort_loading(struct session *ses, int interrupt)
if (have_location(ses)) {
struct location *loc = cur_loc(ses);
if (is_in_progress_state(loc->download.state))
cancel_download(&loc->download, interrupt);
cancel_download(&loc->download, interrupt);
abort_files_load(ses, interrupt);
}
abort_preloading(ses, interrupt);

View File

@ -206,8 +206,7 @@ dump_loading_callback(struct download *download, void *p)
if (cached && cached->redirect && dump_redir_count++ < MAX_REDIRECTS) {
struct uri *uri = cached->redirect;
if (is_in_progress_state(download->state))
cancel_download(download, 0);
cancel_download(download, 0);
load_uri(uri, cached->uri, download, PRI_MAIN, 0, -1);
return;