浏览代码

Added `console.table` empty function to ConsoleOutputDisableExpressionTemplate

sanex3339 5 年之前
父节点
当前提交
7e8f67992c

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ v0.21.0
 * Improved `transformObjectKeys` transformation to cover more cases
 * Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/406
 * Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/387
+* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/333
 
 v0.20.4
 ---

文件差异内容过多而无法显示
+ 0 - 0
dist/index.browser.js


文件差异内容过多而无法显示
+ 0 - 0
dist/index.cli.js


文件差异内容过多而无法显示
+ 0 - 0
dist/index.js


+ 2 - 0
src/templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts

@@ -18,6 +18,7 @@ export function ConsoleOutputDisableExpressionTemplate (): string {
                     c.info = func;
                     c.error = func;
                     c.exception = func;
+                    c.table = func;
                     c.trace = func;
                     
                     return c;
@@ -29,6 +30,7 @@ export function ConsoleOutputDisableExpressionTemplate (): string {
                 that.console.info = func;
                 that.console.error = func;
                 that.console.exception = func;
+                that.console.table = func;
                 that.console.trace = func;
             }
         });

+ 5 - 0
test/functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec.ts

@@ -10,6 +10,7 @@ describe('ConsoleOutputDisableExpressionNode', () => {
     const consoleLogRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['log'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleErrorRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['error'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleWarnRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['warn'\] *= *_0x([a-f0-9]){4,6};/u;
+    const consoleTableRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['table'\] *= *_0x([a-f0-9]){4,6};/u;
 
     describe('`disableConsoleOutput` option is set', () => {
         let obfuscatedCode: string;
@@ -37,6 +38,10 @@ describe('ConsoleOutputDisableExpressionNode', () => {
         it('match #3: should correctly append custom node into the obfuscated code', () => {
             assert.match(obfuscatedCode, consoleWarnRegExp);
         });
+
+        it('match #4: should correctly append custom node into the obfuscated code', () => {
+            assert.match(obfuscatedCode, consoleTableRegExp);
+        });
     });
 
     describe('`disableConsoleOutput` option isn\'t set', () => {

部分文件因为文件数量过多而无法显示