[Pkg-javascript-commits] [uglifyjs] 160/228: ufuzz: workaround for Function.toString() v2 (#1700)

Jonas Smedegaard dr at jones.dk
Sat Apr 15 14:25:26 UTC 2017


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

js pushed a commit to branch master
in repository uglifyjs.

commit aa3f647656ce46469d20bd477b600ca09bc3f964
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Mon Mar 27 21:49:08 2017 +0800

    ufuzz: workaround for Function.toString() v2 (#1700)
---
 test/ufuzz.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/ufuzz.js b/test/ufuzz.js
index 491526d..c1ac8f4 100644
--- a/test/ufuzz.js
+++ b/test/ufuzz.js
@@ -121,7 +121,20 @@ var TYPEOF_OUTCOMES = [
   'symbol',
   'crap' ];
 
-var FUNC_TOSTRING = 'Function.prototype.toString=function(){return"function(){}"};';
+var FUNC_TOSTRING = [
+    "Function.prototype.toString = function() {",
+    "    var ids = [];",
+    "    return function() {",
+    "        var i = ids.indexOf(this);",
+    "        if (i < 0) {",
+    "            i = ids.length;",
+    "            ids.push(this);",
+    "        }",
+    '        return "[Function: __func_" + i + "__]";',
+    "    }",
+    "}();",
+    ""
+].join("\n");
 
 function run_code(code) {
     var stdout = "";

-- 
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