mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Adjust logic
This commit is contained in:
@@ -14,7 +14,7 @@ export abstract class AbstractIdentifierNamesGenerator implements IIdentifierNam
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
private static readonly maxGenerationAttempts: number = 1000;
|
||||
private static readonly maxGenerationAttempts: number = 10000;
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
|
||||
@@ -282,14 +282,25 @@ export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGene
|
||||
};
|
||||
|
||||
let identifierName: string = previousMangledName;
|
||||
let isValidIdentifierName: boolean;
|
||||
let attempts: number = 0;
|
||||
let isValidIdentifierName: boolean = false;
|
||||
let reservedNameAttempts: number = 0;
|
||||
|
||||
do {
|
||||
this.checkGenerationAttempts(attempts);
|
||||
identifierName = generateNewMangledName(identifierName);
|
||||
|
||||
if (
|
||||
this.preservedNamesSet.has(identifierName) ||
|
||||
MangledIdentifierNamesGenerator.reservedNamesSet.has(identifierName)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
isValidIdentifierName = validationFunction?.(identifierName) ?? this.isValidIdentifierName(identifierName);
|
||||
attempts++;
|
||||
|
||||
if (!isValidIdentifierName) {
|
||||
this.checkGenerationAttempts(reservedNameAttempts);
|
||||
reservedNameAttempts++;
|
||||
}
|
||||
} while (!isValidIdentifierName);
|
||||
|
||||
return identifierName;
|
||||
|
||||
Reference in New Issue
Block a user