mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[stringify/url] only own properties can be locals
This commit is contained in:
parent
f99beea38f
commit
1b303fbea4
2 changed files with 15 additions and 2 deletions
|
@ -83,8 +83,10 @@ define(function (require) {
|
|||
var i = -1;
|
||||
while (++i < parts.length) {
|
||||
if (i % 2) {
|
||||
var local = locals[parts[i]];
|
||||
output += local == null ? '' : local;
|
||||
if (locals.hasOwnProperty(parts[i])) {
|
||||
var local = locals[parts[i]];
|
||||
output += local == null ? '' : local;
|
||||
}
|
||||
} else {
|
||||
output += parts[i];
|
||||
}
|
||||
|
|
|
@ -183,6 +183,17 @@ define(function (require) {
|
|||
expect(url.convert('url', 'text')).to.be('');
|
||||
});
|
||||
|
||||
it('does not get values from the prototype chain', function () {
|
||||
Object.prototype.cantStopMeNow = {
|
||||
toString: function () {
|
||||
return 'fail';
|
||||
}
|
||||
};
|
||||
|
||||
var url = new Url({ template: '{{ cantStopMeNow }}' });
|
||||
expect(url.convert('url', 'text')).to.be('');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue