add even more known globals to unsafe option
This commit is contained in:
parent
f7c6f60a47
commit
b1b088a128
|
|
@ -693,7 +693,7 @@ merge(Compressor.prototype, {
|
||||||
return node instanceof AST_SymbolRef && node.definition().undeclared;
|
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) {
|
AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
|
||||||
return !this.definition().undeclared
|
return !this.definition().undeclared
|
||||||
|| compressor.option("unsafe") && global_names(this.name);
|
|| compressor.option("unsafe") && global_names(this.name);
|
||||||
|
|
|
||||||
|
|
@ -240,22 +240,36 @@ issue_2233_1: {
|
||||||
input: {
|
input: {
|
||||||
Array.isArray;
|
Array.isArray;
|
||||||
Boolean;
|
Boolean;
|
||||||
|
//clearInterval;
|
||||||
|
//clearTimeout;
|
||||||
console.log;
|
console.log;
|
||||||
Date;
|
Date;
|
||||||
|
decodeURI;
|
||||||
|
decodeURIComponent;
|
||||||
|
encodeURI;
|
||||||
|
encodeURIComponent;
|
||||||
Error.name;
|
Error.name;
|
||||||
|
escape;
|
||||||
|
eval;
|
||||||
EvalError;
|
EvalError;
|
||||||
Function.length;
|
Function.length;
|
||||||
|
isFinite;
|
||||||
|
isNaN;
|
||||||
JSON;
|
JSON;
|
||||||
Math.random;
|
Math.random;
|
||||||
Number.isNaN;
|
Number.isNaN;
|
||||||
|
parseFloat;
|
||||||
parseInt;
|
parseInt;
|
||||||
RegExp;
|
RegExp;
|
||||||
Object.defineProperty;
|
Object.defineProperty;
|
||||||
String.fromCharCode;
|
String.fromCharCode;
|
||||||
RangeError;
|
RangeError;
|
||||||
ReferenceError;
|
ReferenceError;
|
||||||
|
//setInterval;
|
||||||
|
//setTimeout;
|
||||||
SyntaxError;
|
SyntaxError;
|
||||||
TypeError;
|
TypeError;
|
||||||
|
unescape;
|
||||||
URIError;
|
URIError;
|
||||||
}
|
}
|
||||||
expect: {}
|
expect: {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user