소스 검색

Improved ConsoleOutputDisableExpressionTemplate.ts and fixed Content-Security-Policy problems with eval

sanex3339 4 년 전
부모
커밋
a3b73d87b9
4개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 0 0
      dist/index.browser.js
  2. 0 0
      dist/index.cli.js
  3. 0 0
      dist/index.js
  4. 9 9
      src/custom-code-helpers/console-output/templates/ConsoleOutputDisableExpressionTemplate.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.browser.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.cli.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/index.js


+ 9 - 9
src/custom-code-helpers/console-output/templates/ConsoleOutputDisableExpressionTemplate.ts

@@ -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}();
     `;
 }

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.