From 5d649b23d74e27d299afef289689714da60357b4 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Mon, 9 Jan 2017 21:41:31 +0300 Subject: [PATCH] syncing changes from 0.8.4 with dev --- CHANGELOG.md | 4 +++ dist/index.js | 2 +- .../ConsoleOutputDisableExpressionTemplate.ts | 27 ++++++++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47702757..151a805e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log === +v0.8.4 +--- +* fixed https://github.com/javascript-obfuscator/webpack-obfuscator/issues/13 + v0.8.3 --- * `selfDefending` option now disabled by default. diff --git a/dist/index.js b/dist/index.js index be1266a7..ecd77990 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7912,7 +7912,7 @@ exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate; function ConsoleOutputDisableExpressionTemplate() { - return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var getGlobal = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');');\n \n var func = function () {};\n var that = getGlobal();\n \n that.console.log = func; \n that.console.error = func;\n that.console.warn = func;\n that.console.info = func;\n });\n \n {consoleLogDisableFunctionName}();\n "; + return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var getGlobal = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');');\n \n var func = function () {};\n var that = getGlobal();\n \n if (!that.console) {\n that.console = (function (func){ \n var c = {}; \n \n c.log = func;\n c.warn = func; \n c.debug = func;\n c.info = func;\n c.error = func;\n c.exception = func;\n c.trace = func;\n \n return c; \n })(func);\n } else {\n that.console.log = func;\n that.console.warn = func; \n that.console.debug = func;\n that.console.info = func;\n that.console.error = func;\n that.console.exception = func;\n that.console.trace = func;\n }\n });\n \n {consoleLogDisableFunctionName}();\n "; } exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate; diff --git a/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts b/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts index 949d1965..5dce8ab9 100644 --- a/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts +++ b/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts @@ -9,10 +9,29 @@ export function ConsoleOutputDisableExpressionTemplate (): string { var func = function () {}; var that = getGlobal(); - that.console.log = func; - that.console.error = func; - that.console.warn = func; - that.console.info = func; + if (!that.console) { + that.console = (function (func){ + var c = {}; + + c.log = func; + c.warn = func; + c.debug = func; + c.info = func; + c.error = func; + c.exception = func; + c.trace = func; + + return c; + })(func); + } else { + that.console.log = func; + that.console.warn = func; + that.console.debug = func; + that.console.info = func; + that.console.error = func; + that.console.exception = func; + that.console.trace = func; + } }); {consoleLogDisableFunctionName}();