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

Moved the setTimeout timer to the struct document.

This commit is contained in:
Witold Filipczyk 2006-10-24 16:47:41 +02:00 committed by Witold Filipczyk
parent c76ce39a87
commit 2fe0623298
4 changed files with 9 additions and 4 deletions

View File

@ -157,6 +157,7 @@ done_document(struct document *document)
#ifdef CONFIG_ECMASCRIPT
free_string_list(&document->onload_snippets);
free_uri_list(&document->ecmascript_imports);
kill_timer(&document->timeout);
#endif
free_list(document->tags);
@ -177,6 +178,9 @@ release_document(struct document *document)
if_assert_failed return;
if (document->refresh) kill_document_refresh(document->refresh);
#ifdef CONFIG_ECMASCRIPT
kill_timer(&document->timeout);
#endif
object_unlock(document);
move_to_top_of_list(format_cache, document);
}

View File

@ -4,6 +4,7 @@
#include "document/options.h"
#include "intl/charsets.h" /* unicode_val_T */
#include "main/object.h"
#include "main/timer.h"
#include "protocol/uri.h"
#include "util/color.h"
#include "util/lists.h"
@ -153,6 +154,8 @@ struct document {
* dependencies between the various entries so nothing gets removed
* unneeded. */
struct uri_list ecmascript_imports;
/* used by setTimeout */
timer_id_T timeout;
#endif
#ifdef CONFIG_CSS
/* FIXME: We should externally maybe using cache_entry store the

View File

@ -144,7 +144,6 @@ ecmascript_put_interpreter(struct ecmascript_interpreter *interpreter)
spidermonkey_put_interpreter(interpreter);
#endif
free_string_list(&interpreter->onload_snippets);
kill_timer(&interpreter->timeout);
done_string(&interpreter->code);
interpreter->vs->ecmascript = NULL;
mem_free(interpreter);
@ -311,13 +310,13 @@ ecmascript_timeout_handler(void *i)
void
ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout)
{
assert(interpreter);
assert(interpreter && interpreter->vs->doc_view->document);
if (!code) return;
done_string(&interpreter->code);
init_string(&interpreter->code);
add_to_string(&interpreter->code, code);
mem_free(code);
install_timer(&interpreter->timeout, timeout, ecmascript_timeout_handler, interpreter);
install_timer(&interpreter->vs->doc_view->document->timeout, timeout, ecmascript_timeout_handler, interpreter);
}
static struct module *ecmascript_modules[] = {

View File

@ -24,7 +24,6 @@ struct ecmascript_interpreter {
/* The code evaluated by setTimeout() */
struct string code;
timer_id_T timeout;
time_t exec_start;