1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-29 01:45:34 +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 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 include $(top_srcdir)/Makefile.lib

View File

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

View File

@ -10,4 +10,4 @@ endif
subdir('gemini') subdir('gemini')
subdir('html') subdir('html')
subdir('plain') 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

@ -278,3 +278,14 @@ check_for_snippets(struct view_state *vs, struct document_options *options, stru
} }
} }
} }
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 #endif
struct document_options; struct document_options;
struct docuemnt; struct document;
struct session; struct session;
struct uri; struct uri;
struct view_state; struct view_state;
@ -20,6 +20,7 @@ void toggle_ecmascript(struct session *ses);
* follows a link with this synstax. */ * follows a link with this synstax. */
void ecmascript_protocol_handler(struct session *ses, struct uri *uri); 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 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; extern struct module ecmascript_module;