diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-05-17 14:35:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-17 21:35:17 +0800 |
commit | a00f8dade75838862d1d284440eea6d35198b63e (patch) | |
tree | e2cf6a6e7d60f7f8634d2057c8f9b35a36adb5d2 /test/ufuzz/index.js | |
parent | 9daa2fb6f50aad11d4a6b83db97411eedfa0d143 (diff) | |
download | tracifyjs-a00f8dade75838862d1d284440eea6d35198b63e.tar.gz tracifyjs-a00f8dade75838862d1d284440eea6d35198b63e.zip |
fix suspicious `toplevel` detection (#3902)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r-- | test/ufuzz/index.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index 1ade4fca..faa9fd53 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -1018,6 +1018,7 @@ function log_suspects(minify_options, component) { if (!options) return; if (typeof options != "object") options = {}; var defs = default_options[component]; + var toplevel = sandbox.has_toplevel(minify_options); var suspects = Object.keys(defs).filter(function(name) { var flip = name == "keep_fargs"; if (flip !== (name in options ? options : defs)[name]) { @@ -1030,7 +1031,7 @@ function log_suspects(minify_options, component) { errorln("Error testing options." + component + "." + name); errorln(result.error); } else { - var r = sandbox.run_code(result.code, sandbox.has_toplevel(m)); + var r = sandbox.run_code(result.code, toplevel); return !sandbox.same_stdout(uglify_result, r); } } @@ -1044,7 +1045,7 @@ function log_suspects(minify_options, component) { } } -function log_suspects_global(options) { +function log_suspects_global(options, toplevel) { var suspects = Object.keys(default_options).filter(function(component) { return typeof default_options[component] != "object"; }).filter(function(component) { @@ -1055,7 +1056,7 @@ function log_suspects_global(options) { errorln("Error testing options." + component); errorln(result.error); } else { - var r = sandbox.run_code(result.code, sandbox.has_toplevel(m)); + var r = sandbox.run_code(result.code, toplevel); return !sandbox.same_stdout(uglify_result, r); } }); @@ -1117,7 +1118,7 @@ function log(options) { var defs = default_options[component]; return defs && typeof defs == "object"; }).forEach(log_suspects.bind(null, JSON.parse(options))); - log_suspects_global(options); + log_suspects_global(options, toplevel); errorln("!!!!!! Failed... round " + round); } } |