diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 9845889a0b7..d4f7781e88b 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -241,8 +241,8 @@ QWeb2.Engine = (function() { return true; }, load_xml : function(s) { - s = s.replace(/^\s*|\s*$/g, ''); - if (this.tools.trim(s)[0] === '<') { + s = this.tools.trim(s); + if (s.charAt(0) === '<') { return this.load_xml_string(s); } else { var req = this.get_xhr(); @@ -256,6 +256,9 @@ QWeb2.Engine = (function() { req.send(null); var xDoc = req.responseXML; if (xDoc) { + if (!xDoc.documentElement) { + throw new Error("QWeb2: This xml document has no root document : " + xDoc.responseText); + } if (xDoc.documentElement.nodeName == "parsererror") { return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue); }