[Pkg-javascript-commits] [uglifyjs] 190/491: fix `unsafe` `evaluate` of `Object` static methods (#2232)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:34 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 9282e7b0c6f20bc95ba3d2bab2bbaccebab03c9a
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Fri Jul 14 19:52:01 2017 +0800

    fix `unsafe` `evaluate` of `Object` static methods (#2232)
    
    fixes #2231
---
 lib/compress.js           |  8 +++-----
 test/compress/evaluate.js | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index 3a5694f..0330c68 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1853,10 +1853,6 @@ merge(Compressor.prototype, {
                 "isFinite",
                 "isNaN",
             ],
-            Object: [
-                "keys",
-                "getOwnPropertyNames",
-            ],
             String: [
                 "fromCharCode",
             ],
@@ -3496,7 +3492,9 @@ merge(Compressor.prototype, {
                                 operator: car.operator,
                                 expression: left
                             });
-                        } else car.write_only = false;
+                        } else {
+                            car.write_only = false;
+                        }
                         if (parent) {
                             parent[field] = car;
                             expressions[i] = expressions[j];
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 38e9cdc..1c73706 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1157,3 +1157,31 @@ issue_2207_3: {
     }
     expect_stdout: true
 }
+
+issue_2231_1: {
+    options = {
+        evaluate: true,
+        unsafe: true,
+    }
+    input: {
+        console.log(Object.keys(void 0));
+    }
+    expect: {
+        console.log(Object.keys(void 0));
+    }
+    expect_stdout: true
+}
+
+issue_2231_2: {
+    options = {
+        evaluate: true,
+        unsafe: true,
+    }
+    input: {
+        console.log(Object.getOwnPropertyNames(null));
+    }
+    expect: {
+        console.log(Object.getOwnPropertyNames(null));
+    }
+    expect_stdout: true
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list