mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
0.12.5 release: fixed https://github.com/javascript-obfuscator/javascript*-obfuscator/issues/139
This commit is contained in:
+36
-1
@@ -100,7 +100,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('variant #3: obfuscated code with removed debug protection function call', () => {
|
||||
describe('variant #3: obfuscated code with removed debug protection code', () => {
|
||||
const expectedEvaluationResult: number = 0;
|
||||
|
||||
let obfuscatedCode: string,
|
||||
@@ -135,4 +135,39 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
|
||||
assert.equal(evaluationResult, expectedEvaluationResult);
|
||||
});
|
||||
});
|
||||
|
||||
describe('variant #4: single call of debug protection code', () => {
|
||||
const expectedEvaluationResult: number = 1;
|
||||
|
||||
let obfuscatedCode: string,
|
||||
evaluationResult: number = 0;
|
||||
|
||||
beforeEach((done) => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/single-call.js');
|
||||
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
debugProtection: true
|
||||
}
|
||||
);
|
||||
|
||||
obfuscatedCode = obfuscationResult.getObfuscatedCode();
|
||||
|
||||
spawnThread(
|
||||
() => obfuscatedCode,
|
||||
(response: number) => {
|
||||
evaluationResult = response;
|
||||
done();
|
||||
},
|
||||
() => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should correctly evaluate code with enabled debug protection', () => {
|
||||
assert.equal(evaluationResult, expectedEvaluationResult);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
(function () {
|
||||
function foo () {
|
||||
function bar () {
|
||||
function baz () {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return baz();
|
||||
}
|
||||
|
||||
return bar();
|
||||
}
|
||||
|
||||
for (var i = 0; i <= 10000; i++) {
|
||||
if (i < 10000) {
|
||||
foo();
|
||||
} else {
|
||||
return foo();
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user