fix: make sure qweb throw error if invalid templates

This commit is contained in:
Géry Debongnie
2019-03-29 15:37:42 +01:00
parent 5cd45b59af
commit e6b0d06e3e
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -300,6 +300,9 @@ export class QWeb {
loadTemplates(xmlstr: string) {
const parser = new DOMParser();
const doc = parser.parseFromString(xmlstr, "text/xml");
if (doc.getElementsByTagName("parsererror").length) {
throw new Error("Invalid XML in template");
}
const templates = doc.getElementsByTagName("templates")[0];
if (!templates) {
return;