Browse Source

ie8 window.console fix https://github.com/javascript-obfuscator/webpack-obfuscator/issues/13

sanex3339 8 năm trước cách đây
mục cha
commit
3d29d38f6b

+ 3 - 4
dist/index.js

@@ -88,7 +88,7 @@ module.exports =
 /******/ 	__webpack_require__.p = "";
 /******/ 	__webpack_require__.p = "";
 /******/
 /******/
 /******/ 	// Load entry module and return exports
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 88);
+/******/ 	return __webpack_require__(__webpack_require__.s = 87);
 /******/ })
 /******/ })
 /************************************************************************/
 /************************************************************************/
 /******/ ([
 /******/ ([
@@ -4269,7 +4269,7 @@ exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
 "use strict";
 "use strict";
 
 
 function ConsoleOutputDisableExpressionTemplate() {
 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            that.console = (function (func){ \n                var c = {}; \n                \n                c.log = c.warn = c.debug = c.info = c.error = c.exception = c.trace = func; \n                \n                return c; \n            })(func);\n        });\n        \n        {consoleLogDisableFunctionName}();\n    ";
 }
 }
 exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
 exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
 
 
@@ -4460,8 +4460,7 @@ module.exports = require("fs");
 module.exports = require("mkdirp");
 module.exports = require("mkdirp");
 
 
 /***/ },
 /***/ },
-/* 87 */,
-/* 88 */
+/* 87 */
 /***/ function(module, exports, __webpack_require__) {
 /***/ function(module, exports, __webpack_require__) {
 
 
 "use strict";
 "use strict";

+ 8 - 5
src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts

@@ -8,11 +8,14 @@ export function ConsoleOutputDisableExpressionTemplate (): string {
             
             
             var func = function () {};
             var func = function () {};
             var that = getGlobal();
             var that = getGlobal();
-                        
-            that.console.log = func; 
-            that.console.error = func;
-            that.console.warn = func;
-            that.console.info = func;
+            
+            that.console = (function (func){ 
+                var c = {}; 
+                
+                c.log = c.warn = c.debug = c.info = c.error = c.exception = c.trace = func; 
+                
+                return c; 
+            })(func);
         });
         });
         
         
         {consoleLogDisableFunctionName}();
         {consoleLogDisableFunctionName}();