Merge pull request #695 from javascript-obfuscator/improved-disable-console-log-template

Improved ConsoleOutputDisableExpressionTemplate.ts and fixed Content-…
This commit is contained in:
Timofey Kachalov
2020-08-05 17:06:17 +03:00
committed by GitHub
6 changed files with 14 additions and 12 deletions
+1
View File
@@ -1 +1,2 @@
open_collective: javascript-obfuscator
custom: ["https://xscode.com/sanex3339/javascript-obfuscator"]
+1
View File
@@ -38,6 +38,7 @@ The example of obfuscated code: [github.com](https://github.com/javascript-obfus
[![Coverage Status](https://coveralls.io/repos/github/javascript-obfuscator/javascript-obfuscator/badge.svg?branch=master)](https://coveralls.io/github/javascript-obfuscator/javascript-obfuscator?branch=master)
[![Backers on Open Collective](https://opencollective.com/javascript-obfuscator/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/javascript-obfuscator/sponsors/badge.svg)](#sponsors)
[![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/sanex3339/javascript-obfuscator)
#### You can support this project by donating:
* (OpenCollective) https://opencollective.com/javascript-obfuscator
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -3,22 +3,22 @@
*/
export function ConsoleOutputDisableExpressionTemplate (): string {
return `
const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
{globalVariableTemplate}
const _console = (that.console = that.console || {});
const consoleObject = (that.console = that.console || {});
const methods = ['log', 'warn', 'info', 'error', 'exception', 'table', 'trace'];
for (let index = 0; index < methods.length; index++){
const func = {callControllerFunctionName}.constructor();
const func = {callControllerFunctionName}.constructor.prototype.bind({callControllerFunctionName});
const methodName = methods[index];
const originalFunction = _console[methodName] || func;
const originalFunction = consoleObject[methodName] || func;
func.toString = originalFunction.toString.bind(originalFunction);
_console[methodName] = func;
};
consoleObject[methodName] = func;
}
});
{consoleLogDisableFunctionName}();
`;
}