aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-19 18:49:04 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-19 18:49:04 +0200
commit199ca9297d2ef4ff58db4b0c948eb384deceb610 (patch)
tree45e60747c6e2b19e145b277414ac4c36e7ca64d8 /src
parent8d40850ffd52100aa51f9dc7814cc7b334381c32 (diff)
Javascript string doesn't escape script end tag, so dont escape that. Fixes some websites
Diffstat (limited to 'src')
-rw-r--r--src/HtmlParser.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/HtmlParser.c b/src/HtmlParser.c
index 8a595ac..a5cde1c 100644
--- a/src/HtmlParser.c
+++ b/src/HtmlParser.c
@@ -257,32 +257,13 @@ static void html_parser_parse_attribute_value(HtmlParser *self) {
self->attribute_value.size = (self->source + self->offset) - self->attribute_value.data;
}
-static void html_parser_goto_end_of_js_string(HtmlParser *self, char quote_symbol) {
- int escape_quote = 0;
- for(;;) {
- char c = html_parser_next_char(self);
- if(!escape_quote && c == quote_symbol) {
- return;
- } else if(c == '\\') {
- escape_quote = !escape_quote;
- } else if(c == '\0') {
- return;
- } else {
- escape_quote = 0;
- }
- }
-}
-
static int html_parser_goto_script_end_tag(HtmlParser *self) {
int res = 0;
self->text.data = self->source + self->offset;
self->text.size = 0;
for(;;) {
char c = html_parser_peek_char(self);
- if(c == '"' || c == '\'') {
- html_parser_advance_char(self);
- html_parser_goto_end_of_js_string(self, c);
- } else if(c == '<' && self->offset + 7 < self->source_len && memcmp(self->source + self->offset + 1, "/script", 7) == 0) {
+ if(c == '<' && self->offset + 7 < self->source_len && memcmp(self->source + self->offset + 1, "/script", 7) == 0) {
self->text.size = (self->source + self->offset) - self->text.data;
strip(self->text.data, self->text.size, &self->text_stripped.data, &self->text_stripped.size, is_whitespace);
self->offset += 7;
@@ -346,7 +327,6 @@ static int html_parser_parse_tag_start(HtmlParser *self) {
if(self->inside_script_tag) {
self->inside_script_tag = 0;
- /* <script> tags require special handling since they can have </script> inside a javascript string */
return html_parser_goto_script_end_tag(self);
}
return 0;