Interned string cleanup, phase 4: Move html_script.c to corestring.
This commit is contained in:
parent
9de20d9a1a
commit
1947019095
|
@ -29,6 +29,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "utils/corestrings.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/messages.h"
|
||||
#include "javascript/js.h"
|
||||
|
@ -77,19 +78,23 @@ static bool html_scripts_exec(html_content *c)
|
|||
continue;
|
||||
|
||||
/* ensure script content fetch status is not an error */
|
||||
if (content_get_status(s->data.external) == CONTENT_STATUS_ERROR)
|
||||
if (content_get_status(s->data.external) ==
|
||||
CONTENT_STATUS_ERROR)
|
||||
continue;
|
||||
|
||||
/* ensure script handler for content type */
|
||||
script_handler = select_script_handler(content_get_type(s->data.external));
|
||||
script_handler = select_script_handler(
|
||||
content_get_type(s->data.external));
|
||||
if (script_handler == NULL)
|
||||
continue; /* unsupported type */
|
||||
|
||||
if (content_get_status(s->data.external) == CONTENT_STATUS_DONE) {
|
||||
if (content_get_status(s->data.external) ==
|
||||
CONTENT_STATUS_DONE) {
|
||||
/* external script is now available */
|
||||
const char *data;
|
||||
unsigned long size;
|
||||
data = content_get_source_data(s->data.external, &size );
|
||||
data = content_get_source_data(
|
||||
s->data.external, &size );
|
||||
script_handler(c->jscontext, data, size);
|
||||
|
||||
s->already_started = true;
|
||||
|
@ -236,12 +241,12 @@ html_process_script(void *ctx, dom_node *node)
|
|||
|
||||
LOG(("content %p parser %p node %p",c,c->parser, node));
|
||||
|
||||
exc = dom_element_get_attribute(node, html_dom_string_type, &mimetype);
|
||||
exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype);
|
||||
if (exc != DOM_NO_ERR || mimetype == NULL) {
|
||||
mimetype = dom_string_ref(html_dom_string_text_javascript);
|
||||
mimetype = dom_string_ref(corestring_dom_text_javascript);
|
||||
}
|
||||
|
||||
exc = dom_element_get_attribute(node, html_dom_string_src, &src);
|
||||
exc = dom_element_get_attribute(node, corestring_dom_src, &src);
|
||||
if (exc != DOM_NO_ERR || src == NULL) {
|
||||
struct lwc_string_s *lwcmimetype;
|
||||
script_handler_t *script_handler;
|
||||
|
|
|
@ -85,7 +85,9 @@ dom_string *corestring_dom_hspace;
|
|||
dom_string *corestring_dom_link;
|
||||
dom_string *corestring_dom_rows;
|
||||
dom_string *corestring_dom_size;
|
||||
dom_string *corestring_dom_src;
|
||||
dom_string *corestring_dom_text;
|
||||
dom_string *corestring_dom_text_javascript;
|
||||
dom_string *corestring_dom_type;
|
||||
dom_string *corestring_dom_valign;
|
||||
dom_string *corestring_dom_vlink;
|
||||
|
@ -174,7 +176,9 @@ void corestrings_fini(void)
|
|||
CSS_DOM_STRING_UNREF(link);
|
||||
CSS_DOM_STRING_UNREF(rows);
|
||||
CSS_DOM_STRING_UNREF(size);
|
||||
CSS_DOM_STRING_UNREF(src);
|
||||
CSS_DOM_STRING_UNREF(text);
|
||||
CSS_DOM_STRING_UNREF(text_javascript);
|
||||
CSS_DOM_STRING_UNREF(type);
|
||||
CSS_DOM_STRING_UNREF(valign);
|
||||
CSS_DOM_STRING_UNREF(vlink);
|
||||
|
@ -279,7 +283,9 @@ nserror corestrings_init(void)
|
|||
CSS_DOM_STRING_INTERN(link);
|
||||
CSS_DOM_STRING_INTERN(rows);
|
||||
CSS_DOM_STRING_INTERN(size);
|
||||
CSS_DOM_STRING_INTERN(src);
|
||||
CSS_DOM_STRING_INTERN(text);
|
||||
CSS_DOM_STRING_INTERN(text_javascript);
|
||||
CSS_DOM_STRING_INTERN(type);
|
||||
CSS_DOM_STRING_INTERN(valign);
|
||||
CSS_DOM_STRING_INTERN(vlink);
|
||||
|
|
|
@ -92,7 +92,9 @@ extern struct dom_string *corestring_dom_hspace;
|
|||
extern struct dom_string *corestring_dom_link;
|
||||
extern struct dom_string *corestring_dom_rows;
|
||||
extern struct dom_string *corestring_dom_size;
|
||||
extern struct dom_string *corestring_dom_src;
|
||||
extern struct dom_string *corestring_dom_text;
|
||||
extern struct dom_string *corestring_dom_text_javascript;
|
||||
extern struct dom_string *corestring_dom_type;
|
||||
extern struct dom_string *corestring_dom_valign;
|
||||
extern struct dom_string *corestring_dom_vlink;
|
||||
|
|
Loading…
Reference in New Issue