add even more known globals to unsafe option

This commit is contained in:
kzc 2017-09-06 13:47:06 -04:00
parent f7c6f60a47
commit b1b088a128
2 changed files with 15 additions and 1 deletions

View File

@ -693,7 +693,7 @@ merge(Compressor.prototype, {
return node instanceof AST_SymbolRef && node.definition().undeclared;
}
var global_names = makePredicate("Array Boolean console Date Error EvalError Function JSON Math Number parseInt RangeError ReferenceError RegExp Object String SyntaxError TypeError URIError");
var global_names = makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Math Number parseFloat parseInt RangeError ReferenceError RegExp Object setInterval setTimeout String SyntaxError TypeError unescape URIError");
AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
return !this.definition().undeclared
|| compressor.option("unsafe") && global_names(this.name);

View File

@ -240,22 +240,36 @@ issue_2233_1: {
input: {
Array.isArray;
Boolean;
//clearInterval;
//clearTimeout;
console.log;
Date;
decodeURI;
decodeURIComponent;
encodeURI;
encodeURIComponent;
Error.name;
escape;
eval;
EvalError;
Function.length;
isFinite;
isNaN;
JSON;
Math.random;
Number.isNaN;
parseFloat;
parseInt;
RegExp;
Object.defineProperty;
String.fromCharCode;
RangeError;
ReferenceError;
//setInterval;
//setTimeout;
SyntaxError;
TypeError;
unescape;
URIError;
}
expect: {}