Merge pull request #547 from javascript-obfuscator/exponentiation-operator-fix

Fixed support of exponentiation operator
This commit is contained in:
Timofey Kachalov
2020-02-07 11:33:53 +03:00
committed by GitHub
6 changed files with 33 additions and 7 deletions
+1
View File
@@ -2,6 +2,7 @@ Change Log
v0.24.6
---
* Fixed support of exponentiation operator. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/534
* Added file path to the error message during directory obfuscation. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/513
v0.24.5
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -29,7 +29,7 @@
"chance": "1.1.4",
"class-validator": "0.11.0",
"commander": "4.1.1",
"escodegen": "1.13.0",
"escodegen": "1.14.1",
"eslint-scope": "5.0.0",
"estraverse": "4.3.0",
"eventemitter3": "4.0.0",
@@ -572,6 +572,30 @@ describe('JavaScriptObfuscator', () => {
});
});
/**
* https://github.com/estools/escodegen/pull/407
*/
describe('valid exponentiation operator precedence', () => {
const regExp: RegExp = /var foo *= *\( *0x1 *- *0x2 *\) *\*\* *0x2;/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/exponentiation-operator-precedence.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});
it('should support exponentiation operator', () => {
assert.match(obfuscatedCode, regExp);
});
});
describe('mangled identifier names generator', () => {
const regExp: RegExp = /var c *= *0x1/;
@@ -0,0 +1 @@
var foo = (1-2) ** 2;
+4 -4
View File
@@ -1714,10 +1714,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
escodegen@1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.13.0.tgz#c7adf9bd3f3cc675bb752f202f79a720189cab29"
integrity sha512-eYk2dCkxR07DsHA/X2hRBj0CFAZeri/LyDMc0C8JT1Hqi6JnVpMhJ7XFITbb0+yZS3lVkaPL2oCkZ3AVmeVbMw==
escodegen@1.14.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.1.tgz#ba01d0c8278b5e95a9a45350142026659027a457"
integrity sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==
dependencies:
esprima "^4.0.1"
estraverse "^4.2.0"