Fixed regression bug with combination of splitStrings and renameProperties option

https://github.com/javascript-obfuscator/javascript-obfuscator/issues/729

(cherry picked from commit a0dca0256b)
This commit is contained in:
sanex
2020-09-03 11:12:18 +03:00
parent 8c91a254be
commit f98993f8cb
7 changed files with 15 additions and 6 deletions
+4
View File
@@ -1,5 +1,9 @@
Change Log
v1.12.1
---
* Fixed regression bug with combination of `splitStrings` and `renameProperties` option. https://github.com/javascript-obfuscator/javascript-obfuscator/issues/729
v1.12.0
---
* **New option:** `optionsPreset` allows to set options preset
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -217,12 +217,11 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.ControlFlowFlattening);
}
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Converting);
if (this.options.renameProperties) {
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.RenameProperties);
}
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.Converting);
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.RenameIdentifiers);
astTree = this.runNodeTransformationStage(astTree, NodeTransformationStage.StringArray);
@@ -294,7 +294,12 @@ describe('RenamePropertiesTransformer', () => {
});
describe('Variant #8: integration with `splitStrings` option', () => {
const propertyRegExp: RegExp = /'a': *'long' *\+ *'Prop' *\+ *'erty' *\+ *'Valu' *\+ *'e'/;
const propertyRegExp: RegExp = new RegExp(
'const foo *= *{' +
'\'a\': *\'long\' *\\+ *\'Prop\' *\\+ *\'erty\' *\\+ *\'Valu\' *\\+ *\'e\'' +
'};' +
'foo\\[\'a\'];'
);
let obfuscatedCode: string;
@@ -1,3 +1,4 @@
const foo = {
longPropertyName: 'longPropertyValue'
};
foo.longPropertyName;