mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
Moved the setTimeout timer to the struct document.
This commit is contained in:
parent
c76ce39a87
commit
2fe0623298
@ -157,6 +157,7 @@ done_document(struct document *document)
|
|||||||
#ifdef CONFIG_ECMASCRIPT
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
free_string_list(&document->onload_snippets);
|
free_string_list(&document->onload_snippets);
|
||||||
free_uri_list(&document->ecmascript_imports);
|
free_uri_list(&document->ecmascript_imports);
|
||||||
|
kill_timer(&document->timeout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_list(document->tags);
|
free_list(document->tags);
|
||||||
@ -177,6 +178,9 @@ release_document(struct document *document)
|
|||||||
if_assert_failed return;
|
if_assert_failed return;
|
||||||
|
|
||||||
if (document->refresh) kill_document_refresh(document->refresh);
|
if (document->refresh) kill_document_refresh(document->refresh);
|
||||||
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
|
kill_timer(&document->timeout);
|
||||||
|
#endif
|
||||||
object_unlock(document);
|
object_unlock(document);
|
||||||
move_to_top_of_list(format_cache, document);
|
move_to_top_of_list(format_cache, document);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "document/options.h"
|
#include "document/options.h"
|
||||||
#include "intl/charsets.h" /* unicode_val_T */
|
#include "intl/charsets.h" /* unicode_val_T */
|
||||||
#include "main/object.h"
|
#include "main/object.h"
|
||||||
|
#include "main/timer.h"
|
||||||
#include "protocol/uri.h"
|
#include "protocol/uri.h"
|
||||||
#include "util/color.h"
|
#include "util/color.h"
|
||||||
#include "util/lists.h"
|
#include "util/lists.h"
|
||||||
@ -153,6 +154,8 @@ struct document {
|
|||||||
* dependencies between the various entries so nothing gets removed
|
* dependencies between the various entries so nothing gets removed
|
||||||
* unneeded. */
|
* unneeded. */
|
||||||
struct uri_list ecmascript_imports;
|
struct uri_list ecmascript_imports;
|
||||||
|
/* used by setTimeout */
|
||||||
|
timer_id_T timeout;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_CSS
|
#ifdef CONFIG_CSS
|
||||||
/* FIXME: We should externally maybe using cache_entry store the
|
/* FIXME: We should externally maybe using cache_entry store the
|
||||||
|
@ -144,7 +144,6 @@ ecmascript_put_interpreter(struct ecmascript_interpreter *interpreter)
|
|||||||
spidermonkey_put_interpreter(interpreter);
|
spidermonkey_put_interpreter(interpreter);
|
||||||
#endif
|
#endif
|
||||||
free_string_list(&interpreter->onload_snippets);
|
free_string_list(&interpreter->onload_snippets);
|
||||||
kill_timer(&interpreter->timeout);
|
|
||||||
done_string(&interpreter->code);
|
done_string(&interpreter->code);
|
||||||
interpreter->vs->ecmascript = NULL;
|
interpreter->vs->ecmascript = NULL;
|
||||||
mem_free(interpreter);
|
mem_free(interpreter);
|
||||||
@ -311,13 +310,13 @@ ecmascript_timeout_handler(void *i)
|
|||||||
void
|
void
|
||||||
ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout)
|
ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout)
|
||||||
{
|
{
|
||||||
assert(interpreter);
|
assert(interpreter && interpreter->vs->doc_view->document);
|
||||||
if (!code) return;
|
if (!code) return;
|
||||||
done_string(&interpreter->code);
|
done_string(&interpreter->code);
|
||||||
init_string(&interpreter->code);
|
init_string(&interpreter->code);
|
||||||
add_to_string(&interpreter->code, code);
|
add_to_string(&interpreter->code, code);
|
||||||
mem_free(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[] = {
|
static struct module *ecmascript_modules[] = {
|
||||||
|
@ -24,7 +24,6 @@ struct ecmascript_interpreter {
|
|||||||
|
|
||||||
/* The code evaluated by setTimeout() */
|
/* The code evaluated by setTimeout() */
|
||||||
struct string code;
|
struct string code;
|
||||||
timer_id_T timeout;
|
|
||||||
|
|
||||||
time_t exec_start;
|
time_t exec_start;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user