mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
6e185f987b
In some very rare cases (such as the use of the t-foreach directive), Owl did leak the values in the render context in the global context. This was due to the fact that the compiled template looked like this: let _3 = _4 = _5; instead of let _3 = _5; let _4 = _5;
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`memory t-foreach does not leak stuff in global scope 1`] = `
|
|
"function anonymous(context, extra
|
|
) {
|
|
// Template name: \\"test\\"
|
|
let scope = Object.create(context);
|
|
let h = this.h;
|
|
let c1 = [], p1 = {key:1};
|
|
let vn1 = h('p', p1, c1);
|
|
let _2 = [3,2,1];
|
|
if (!_2) { throw new Error('QWeb error: Invalid loop expression')}
|
|
let _3 = _2;
|
|
let _4 = _2;
|
|
if (!(_2 instanceof Array)) {
|
|
_3 = Object.keys(_2);
|
|
_4 = Object.values(_2);
|
|
}
|
|
let _length3 = _3.length;
|
|
let _origScope5 = scope;
|
|
scope = Object.create(scope);
|
|
for (let i1 = 0; i1 < _length3; i1++) {
|
|
scope.item_first = i1 === 0
|
|
scope.item_last = i1 === _length3 - 1
|
|
scope.item_index = i1
|
|
scope.item = _3[i1]
|
|
scope.item_value = _4[i1]
|
|
let key1 = i1;
|
|
let _6 = scope['item'];
|
|
if (_6 != null) {
|
|
c1.push({text: _6});
|
|
}
|
|
}
|
|
scope = _origScope5;
|
|
return vn1;
|
|
}"
|
|
`;
|