diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-05-01 00:24:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-01 07:24:39 +0800 |
commit | df980db4a887bf6d48d872d8dd61713dc42f7842 (patch) | |
tree | c4fb29a7e8b0da9330c8d9f380381cd925839f7d /lib | |
parent | 8e4a19ffec0506c25aebb05e2c84ec32ff307642 (diff) | |
download | tracifyjs-df980db4a887bf6d48d872d8dd61713dc42f7842.tar.gz tracifyjs-df980db4a887bf6d48d872d8dd61713dc42f7842.zip |
fix corner case in `unsafe` `evaluate` (#4887)
fixes #4886
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index ce126c80..0506f61c 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4344,6 +4344,7 @@ merge(Compressor.prototype, { } return this; }); + var nonsafe_props = makePredicate("__proto__ toString valueOf"); def(AST_Object, function(compressor, ignore_side_effects, cached, depth) { if (compressor.option("unsafe")) { var val = {}; @@ -4355,7 +4356,7 @@ merge(Compressor.prototype, { key = key._eval(compressor, ignore_side_effects, cached, depth); if (key === prop.key) return this; } - if (key == "toString" || key == "valueOf") return this; + if (nonsafe_props[key]) return this; val[key] = prop.value._eval(compressor, ignore_side_effects, cached, depth); if (val[key] === prop.value) return this; } |