diff options
-rw-r--r-- | src/html.cc | 10 | ||||
-rw-r--r-- | src/html_common.hh | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/html.cc b/src/html.cc index f267ac7a..c859bef8 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1592,6 +1592,9 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize) _MSG("New: {%s}\n", ntag); + if (html->DocType != DT_NONE) + BUG_MSG("Multiple DOCTYPE declarations.\n"); + /* The default DT_NONE type is TagSoup */ if (i > strlen(HTML_SGML_sig) && // avoid out of bounds reads! !dStrnAsciiCasecmp(ntag, HTML_SGML_sig, strlen(HTML_SGML_sig))) { @@ -1622,7 +1625,10 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize) html->DocType = DT_HTML; html->DocTypeVersion = 5.0f; } - + if (html->DocType == DT_NONE) { + html->DocType = DT_UNRECOGNIZED; + BUG_MSG("DOCTYPE not recognized:\n%s.\n", ntag); + } dFree(ntag); } @@ -3488,7 +3494,7 @@ static void Html_test_section(DilloHtml *html, int new_idx, int IsCloseTag) int tag_idx; if (!(html->InFlags & IN_HTML) && html->DocType == DT_NONE) - BUG_MSG("the required DOCTYPE declaration is missing (or invalid)\n"); + BUG_MSG("the required DOCTYPE declaration is missing.\n"); if (!(html->InFlags & IN_HTML)) { tag = "<html>"; diff --git a/src/html_common.hh b/src/html_common.hh index d0eff7eb..6c5d4807 100644 --- a/src/html_common.hh +++ b/src/html_common.hh @@ -41,6 +41,7 @@ typedef enum { DT_NONE, + DT_UNRECOGNIZED, DT_HTML, DT_XHTML } DilloHtmlDocumentType; |