Просмотр исходного кода

fixed ie8 crash, improve templates for custom nodes

sanex3339 8 лет назад
Родитель
Сommit
ff3d49ece6

Разница между файлами не показана из-за своего большого размера
+ 8 - 11
dist/index.js


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "javascript-obfuscator",
-  "version": "0.8.0-dev.3",
+  "version": "0.8.0-dev.4",
   "description": "JavaScript obfuscator",
   "keywords": [
     "obfuscator",

+ 3 - 1
src/templates/custom-nodes/AtobTemplate.ts

@@ -4,7 +4,9 @@
 export function AtobTemplate (): string {
     return `
         (function () {
-            var object = []['filter']['constructor']('return this')();
+            var getGlobal = Function('return (function () ' + '{}.constructor("return this")()' + ');');
+
+            var object = getGlobal();
             var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
 
             object.atob || (

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

@@ -4,7 +4,7 @@
 export function ConsoleOutputDisableExpressionTemplate (): string {
     return `
         var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
-            var getGlobal = Function('return typeof self !== "undefined"' + ' ? self : ' + 'typeof window !== "undefined"' + ' ? window : ' + 'typeof global !== "undefined"' + ' ? global : ' + '[]["filter"]["constructor"]("return this")()');
+            var getGlobal = Function('return (function () ' + '{}.constructor("return this")()' + ');');
             
             var func = Function('for ' + '(;;)' + ' {}');
             var that = getGlobal();

+ 2 - 2
src/templates/custom-nodes/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts

@@ -4,8 +4,8 @@
 export function DomainLockNodeTemplate (): string {
     return `
         var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
-            var getGlobal = Function('return typeof self !== "undefined"' + ' ? self : ' + 'typeof window !== "undefined"' + ' ? window : ' + 'typeof global !== "undefined"' + ' ? global : ' + '[]["filter"]["constructor"]("return this")()');
-            
+            var getGlobal = Function('return (function () ' + '{}.constructor("return this")()' + ');');
+
             var func = function () { 
                 return {
                     key: 'item',

Некоторые файлы не были показаны из-за большого количества измененных файлов