mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: prevent issue with builtin object properties
The QWeb expression parser use an object as a mapping between some strings and the desired output in the compiled template. However, as we should all know, objects are not Maps, they have some additional properties, such as "constructor" or "hasOwnProperty". The simple solution is to make sure the mapping object does not have anything in its prototype chain to pollute its purpose. closes #835
This commit is contained in:
@@ -196,4 +196,8 @@ describe("expression evaluation", () => {
|
||||
expect(compileExpr("f(...state.list)", {})).toBe("scope['f'](...scope['state'].list)");
|
||||
expect(compileExpr("f([...list])", {})).toBe("scope['f']([...scope['list']])");
|
||||
});
|
||||
|
||||
test("works with builtin properties", () => {
|
||||
expect(compileExpr("state.constructor.name", {})).toBe("scope['state'].constructor.name");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user