1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00

[document] document.cpp -> document.c

Moved some code to ecmascript-c.cpp.
This commit is contained in:
Witold Filipczyk 2023-11-27 16:38:58 +01:00
parent a07f339fd1
commit bfd3f01d35
5 changed files with 19 additions and 25 deletions

View File

@ -7,6 +7,6 @@ SUBDIRS-$(CONFIG_LIBDOM) += libdom
SUBDIRS = gemini html plain
OBJS = docdata.o document.obj format.o forms.o options.o refresh.o renderer.o
OBJS = docdata.o document.o format.o forms.o options.o refresh.o renderer.o
include $(top_srcdir)/Makefile.lib

View File

@ -63,10 +63,7 @@
#include "document/renderer.h"
#ifdef CONFIG_ECMASCRIPT
#include "ecmascript/ecmascript.h"
#endif
#ifdef CONFIG_ECMASCRIPT_SMJS
#include "ecmascript/spidermonkey.h"
#include "ecmascript/ecmascript-c.h"
#endif
#ifdef CONFIG_LIBDOM
@ -435,15 +432,7 @@ done_document(struct document *document)
#if defined(CONFIG_ECMASCRIPT_SMJS) || defined(CONFIG_QUICKJS) || defined(CONFIG_MUJS)
free_ecmascript_string_list(&document->onload_snippets);
free_uri_list(&document->ecmascript_imports);
{
struct ecmascript_timeout *t;
foreach(t, document->timeouts) {
kill_timer(&t->tid);
done_string(&t->code);
}
}
kill_ecmascript_timeouts(document);
free_list(document->timeouts);
mem_free_if(document->body_onkeypress);
#endif
@ -486,14 +475,7 @@ release_document(struct document *document)
if (document->refresh) kill_document_refresh(document->refresh);
#ifdef CONFIG_ECMASCRIPT
{
struct ecmascript_timeout *t;
foreach(t, document->timeouts) {
kill_timer(&t->tid);
done_string(&t->code);
}
}
kill_ecmascript_timeouts(document);
free_list(document->timeouts);
#endif
object_unlock(document);

View File

@ -10,4 +10,4 @@ endif
subdir('gemini')
subdir('html')
subdir('plain')
srcs += files('docdata.c', 'document.cpp', 'format.c', 'forms.c', 'options.c', 'refresh.c', 'renderer.c')
srcs += files('docdata.c', 'document.c', 'format.c', 'forms.c', 'options.c', 'refresh.c', 'renderer.c')

View File

@ -277,4 +277,15 @@ check_for_snippets(struct view_state *vs, struct document_options *options, stru
check_for_rerender(vs->ecmascript, "process_snippets");
}
}
}
}
void
kill_ecmascript_timeouts(struct document *document)
{
struct ecmascript_timeout *t;
foreach(t, document->timeouts) {
kill_timer(&t->tid);
done_string(&t->code);
}
}

View File

@ -8,7 +8,7 @@ extern "C" {
#endif
struct document_options;
struct docuemnt;
struct document;
struct session;
struct uri;
struct view_state;
@ -20,6 +20,7 @@ void toggle_ecmascript(struct session *ses);
* follows a link with this synstax. */
void ecmascript_protocol_handler(struct session *ses, struct uri *uri);
void check_for_snippets(struct view_state *vs, struct document_options *options, struct document *document);
void kill_ecmascript_timeouts(struct document *document);
extern struct module ecmascript_module;