[FIX] qweb: do not crash in some rare t-call situation

Before this commit, QWeb crashed when it had to deal with a t-call with
multiple sub nodes on the same line, and one text node:

<t t-call="SomeTemplate">
  <span>hey</span> <span>hey</span>
</t>

This was because we need to compile the content to be able to extract
all possible t-set t-value statements. But doing so means that we had a
multiple root templates, which caused a crash in this case.

Solving this issue is simple: the sub template is compiled with the flag
allowMultipleRoots set to true.
This commit is contained in:
Géry Debongnie
2019-09-09 11:48:15 +02:00
parent 1c0dd79955
commit 2a40907e35
4 changed files with 59 additions and 18 deletions
@@ -775,6 +775,28 @@ exports[`t-call (template calling basic caller 1`] = `
}"
`;
exports[`t-call (template calling call with several sub nodes on same line 1`] = `
"function anonymous(context,extra
) {
var h = this.h;
let c1 = [], p1 = {key:1};
var vn1 = h('div', p1, c1);
let c5 = [], p5 = {key:5};
var vn5 = h('div', p5, c5);
c1.push(vn5);
let c6 = [], p6 = {key:6};
var vn6 = h('span', p6, c6);
c5.push(vn6);
c6.push({text: \`hey\`});
c5.push({text: \` \`});
let c7 = [], p7 = {key:7};
var vn7 = h('span', p7, c7);
c5.push(vn7);
c7.push({text: \`yay\`});
return vn1;
}"
`;
exports[`t-call (template calling inherit context 1`] = `
"function anonymous(context,extra
) {