提交 ebfccde2 编写于 作者: G Guillaume Chau

fix(perf): limit string size, closes #652, closes #842

上级 7345d7ad
......@@ -62,6 +62,11 @@ const handler = {
const proxy1 = new Proxy(sum, handler)
let veryLongText = ''
for (let i = 0; i < 1000000; i++) {
veryLongText += `line${i}\n`
}
export default {
components: {
TestComponent: {
......@@ -102,7 +107,8 @@ export default {
sym: Symbol('test'),
multiLineParameterFunction: function(a,
b,
c) {}
c) {},
veryLongText
}
},
computed: {
......
......@@ -59,6 +59,8 @@ export const SPECIAL_TOKENS = {
'NaN': NAN
}
export const MAX_STRING_SIZE = 10000
export function specialTokenToString (value) {
if (value === null) {
return 'null'
......@@ -149,6 +151,8 @@ function replacer (key) {
}
} else if (Number.isNaN(val)) {
return NAN
} else if (typeof val === 'string' && val.length > MAX_STRING_SIZE) {
return val.substr(0, MAX_STRING_SIZE) + `... (${(val.length)} total length)`
}
return sanitize(val)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册