Skip to content

Use nodeId for visitNodes.#154

Open
aliceofhartley wants to merge 3 commits intoHumanSecurity:mainfrom
aliceofhartley:nodeId_visitNodes
Open

Use nodeId for visitNodes.#154
aliceofhartley wants to merge 3 commits intoHumanSecurity:mainfrom
aliceofhartley:nodeId_visitNodes

Conversation

@aliceofhartley
Copy link

@aliceofhartley aliceofhartley commented Feb 16, 2026

getDeclarationWithContext crashes with an OOM error if the origin node is too large. Using the unique nodeId instead of a full copy of the node reduced the memory footprint enough to not cause a crash.

I also considered using an md5 hash of the node, but does not seem worth it unless we have concerns about the uniqueness of nodeId.

Tested against large (1.0mib) mahjong soul code.js, see https://github.com/Avenshy/AutoLiqi/releases
(Still crashes against the original file, but passed a truncated version. The full version crashes earlier.)

Also first time contributing so let me know if there's a different process preferred for PRs.
I still have a second OOM I'm chasing down in flast, so probably expect a PR there as well.

@aliceofhartley aliceofhartley marked this pull request as ready for review February 16, 2026 06:32
@aliceofhartley
Copy link
Author

Test results.

❯ npm run test > restringer@2.1.0 test > node --test --trace-warnings --no-node-snapshot

▶ Deobfuscation tests
✔ Augmented Array Replacements (63.479777ms)
✔ Compute definite binary expressions (8.797965ms)
✔ Don't replace modified member expressions (6.504246ms)
✔ Don't replace member expressions on empty arrays (3.321539ms)
﹣ TODO: Fix. Normalize Script Correctly (0.278734ms) # SKIP
✔ Parse template literals into string literals (9.606297ms)
✔ Remove nested block statements (7.296822ms)
✔ Remove redundant logical expressions (13.378729ms)
✔ Remove redundant not operators (10.625025ms)
✔ Replace augmented function with corrected array (26.892697ms)
✔ Replace deterministic if statement (4.085491ms)
✔ Replace function calls with unwrapped identifier - arrow functions (6.021869ms)
✔ Replace function calls with unwrapped identifier - function declarations (7.929388ms)
✔ Replace function evals - eval(string) (3.475425ms)
✔ Replace function evals in call expressions - eval(string)(args) (7.143789ms)
✔ Replace identifier with fixed assigned value (10.160252ms)
✔ Replace literal proxies (5.689029ms)
✔ Replace local calls proxy - arrow functions (20.311693ms)
﹣ TODO: FIX Replace local calls proxy - function declarations (0.091469ms) # SKIP
✔ Replace local calls with values - immediate (2.027705ms)
✔ Replace local calls with values - nested (12.849803ms)
✔ Replace local member expressions property reference with value (12.808248ms)
✔ Replace local member expressions proxy - chained proxies (13.621343ms)
✔ Replace local member expressions proxy - member assignment (3.07408ms)
✔ Replace member expression references with values (17.598558ms)
✔ Replace reference proxy (13.417865ms)
✔ Replace wrapped functions with return statement (5.86549ms)
✔ Resolve builtin call expressions: btoa & atob (4.012675ms)
✔ Resolve definite member expressions (4.144953ms)
✔ Resolve deterministic conditional expressions (4.322142ms)
✔ Resolve directly assigned member expressions (5.827133ms)
✔ Resolve external references with context (13.523745ms)
✔ Resolve function constructor calls (10.098694ms)
✔ Resolve injected prototype method calls (10.745741ms)
✔ Resolve member expression local references with unary expressions correctly (13.817417ms)
✔ Resolve member expression references with context (9.34923ms)
✔ Unwrap function shells (1.971057ms)
✔ Verify correct context for function declaration (10.679629ms)
✔ Verify correct context for function variable (7.38033ms)
✔ Verify correct replacement of member expressions with literals (14.740864ms)
✔ Verify random values remain untouched (8.931768ms)
✔ Deobfuscation tests (420.883661ms)
▶ Functionality tests
✔ Set max iterations (22.213725ms)
✔ REstringer.version is populated (0.276354ms)
✔ Functionality tests (25.525943ms)
▶ SAFE: removeRedundantBlockStatements
✔ TP-1 (18.47003ms)
✔ TP-2 (3.601261ms)
✔ TP-3 (5.720589ms)
✔ TP-4 (4.338824ms)
✔ SAFE: removeRedundantBlockStatements (34.981703ms)
▶ SAFE: normalizeComputed
✔ TP-1: Convert valid string identifiers to dot notation (4.06203ms)
✔ TP-2: Convert object properties with valid identifiers (5.91188ms)
✔ TP-3: Convert class method definitions with valid identifiers (5.401069ms)
✔ TN-1: Do not convert invalid identifiers (1.116052ms)
✔ TN-2: Do not convert numeric indices but convert valid string (3.600547ms)
✔ SAFE: normalizeComputed (21.121146ms)
▶ SAFE: normalizeEmptyStatements
✔ TP-1: Remove standalone empty statements (2.068943ms)
✔ TP-2: Remove empty statements in blocks (1.730449ms)
✔ TN-1: Preserve empty statements in for-loops (1.44135ms)
✔ TN-2: Preserve empty statements in while-loops (1.08298ms)
✔ TN-3: Preserve empty statements in if-statements (1.112375ms)
✔ TN-4: Preserve empty statements in do-while loops (1.023192ms)
✔ TN-5: Preserve empty statements in for-in loops (0.694842ms)
✔ SAFE: normalizeEmptyStatements (9.74013ms)
▶ SAFE: parseTemplateLiteralsIntoStringLiterals
✔ TP-1: Convert template literal with string expression (3.024096ms)
✔ TP-2: Convert template literal with multiple expressions (1.218921ms)
✔ TP-3: Convert template literal with no expressions (0.758856ms)
✔ TP-4: Convert template literal with boolean and number expressions (1.083575ms)
✔ TP-5: Convert empty template literal (0.918076ms)
✔ TN-1: Do not convert template literal with variable expression (0.758011ms)
✔ TN-2: Do not convert template literal with function call expression (0.678447ms)
✔ TN-3: Do not convert template literal with mixed literal and non-literal expressions (0.589849ms)
✔ SAFE: parseTemplateLiteralsIntoStringLiterals (9.612674ms)
▶ SAFE: rearrangeSequences
✔ TP-1: Split sequenced calls to standalone expressions (2.77345ms)
✔ TP-2: Split sequenced calls to standalone expressions in if-statements (2.374139ms)
✔ TP-3: Split sequenced calls in if-statements to cascading if-statements (1.705868ms)
✔ TP-4: Split sequenced calls in nested if-statements to cascading if-statements (1.436282ms)
✔ TP-5: Split sequences with more than three expressions (1.65437ms)
✔ TP-6: Split sequences in if condition with else clause (1.493455ms)
✔ TN-1: Do not transform single expression returns (0.593801ms)
✔ TN-2: Do not transform single expression if conditions (0.527483ms)
✔ TN-3: Do not transform non-sequence expressions (0.778111ms)
✔ SAFE: rearrangeSequences (14.137277ms)
▶ SAFE: rearrangeSwitches
✔ TP-1: Complex switch with multiple cases and return statement (9.286853ms)
✔ TP-2: Simple switch with sequential cases (2.536653ms)
✔ TP-3: Switch with default case (1.813762ms)
✔ TP-4: Switch starting with non-initial case via default (2.102555ms)
✔ TN-1: Do not transform switch without literal discriminant initialization (0.719762ms)
✔ TP-5: Transform switch but stop at multiple assignments to discriminant (1.649569ms)
✔ TN-2: Do not transform switch with non-literal case value (0.785181ms)
✔ SAFE: rearrangeSwitches (19.432205ms)
▶ SAFE: removeDeadNodes
✔ TP-1 (1.727594ms)
✔ SAFE: removeDeadNodes (1.891963ms)
▶ SAFE: replaceCallExpressionsWithUnwrappedIdentifier
✔ TP-1: Replace call expression with identifier behind an arrow function (1.766213ms)
✔ TP-2: Replace call expression with identifier behind a function declaration (1.180912ms)
✔ TP-3: Replace call expression with function expression assigned to variable (1.405171ms)
✔ TP-4: Replace call expression with arrow function using block statement (1.447041ms)
✔ TP-5: Replace call expression returning parameterless call (1.207305ms)
✔ TN-1: Do not replace function returning call expression with arguments (0.701356ms)
✔ TN-2: Do not replace function with multiple statements (0.707054ms)
✔ TN-3: Do not replace function with no return statement (0.60016ms)
✔ TN-4: Do not replace non-function callee (0.482485ms)
✔ SAFE: replaceCallExpressionsWithUnwrappedIdentifier (10.050722ms)
▶ SAFE: replaceEvalCallsWithLiteralContent
✔ TP-1: Replace eval call with the code parsed from the argument string (1.756171ms)
✔ TP-2: Replace eval call with a block statement with multiple expression statements (1.073805ms)
✔ TP-3: Replace eval call with the code in a return statement (1.360362ms)
✔ TP-4: Replace eval call wrapped in a call expression (1.395489ms)
✔ TP-5: Replace eval call wrapped in a binary expression (1.7496ms)
✔ TP-6: Unwrap expression statement from replacement where needed (0.922734ms)
✔ TP-7: Replace eval with single expression in conditional (1.290749ms)
✔ TP-8: Replace eval with function declaration (1.410549ms)
✔ TN-1: Do not replace eval with non-literal argument (0.713173ms)
✔ TN-2: Do not replace non-eval function calls (0.408209ms)
✔ TN-3: Do not replace eval with invalid syntax (1.516889ms)
✔ TN-4: Do not replace eval with no arguments (0.443959ms)
✔ SAFE: replaceEvalCallsWithLiteralContent (14.812715ms)
▶ SAFE: replaceFunctionShellsWithWrappedValue
✔ TP-1: Replace references with identifier (1.482799ms)
✔ TP-2: Replace function returning literal number (1.208527ms)
✔ TP-3: Replace function returning literal string (1.142899ms)
✔ TP-4: Replace function returning boolean literal (1.34109ms)
✔ TP-5: Replace multiple calls to same function (1.34227ms)
✔ TN-1: Should not replace literals 1 (0.801264ms)
✔ TN-2: Should not replace literals 2 (0.680425ms)
✔ TN-3: Do not replace function with multiple statements (0.688319ms)
✔ TN-4: Do not replace function with no return statement (0.6066ms)
✔ TN-5: Do not replace function returning complex expression (0.694267ms)
✔ TN-6: Do not replace function used as callback (0.790548ms)
✔ SAFE: replaceFunctionShellsWithWrappedValue (11.511922ms)
▶ SAFE: replaceFunctionShellsWithWrappedValueIIFE
✔ TP-1: Replace with wrapped value in-place (1.316496ms)
✔ TP-2: Replace IIFE returning literal number (1.017067ms)
✔ TP-3: Replace IIFE returning literal string (0.957542ms)
✔ TP-4: Replace IIFE returning boolean literal (1.074362ms)
✔ TP-5: Replace IIFE returning identifier (1.220249ms)
✔ TP-6: Replace multiple IIFEs in expression (1.397333ms)
✔ TN-1: Do not replace IIFE with arguments (0.723223ms)
✔ TN-2: Do not replace IIFE with multiple statements (0.742419ms)
✔ TN-3: Do not replace IIFE with no return statement (0.624642ms)
✔ TN-4: Do not replace IIFE returning complex expression (0.660621ms)
✔ TN-5: Do not replace function expression not used as IIFE (0.75006ms)
✔ TN-6: Do not replace function expression without a return value (0.579527ms)
✔ SAFE: replaceFunctionShellsWithWrappedValueIIFE (11.87309ms)
▶ SAFE: replaceIdentifierWithFixedAssignedValue
✔ TP-1: Replace references with number literal (2.536756ms)
✔ TP-2: Replace references with string literal (1.332742ms)
✔ TP-3: Replace references with boolean literal (1.630393ms)
✔ TP-4: Replace multiple different variables (1.784053ms)
✔ TP-5: Replace with null literal (2.050561ms)
✔ TP-6: Replace with let declaration (1.337351ms)
✔ TP-7: Replace with var declaration (1.523077ms)
✔ TN-1: Do no replace a value used in a for-in-loop (1.353582ms)
✔ TN-2: Do no replace a value used in a for-of-loop (1.071425ms)
✔ TN-3: Do not replace variable with non-literal initializer (0.784403ms)
✔ TN-4: Do not replace object property names (0.756383ms)
✔ TN-5: Do not replace modified variables (3.774446ms)
✔ TN-6: Do not replace reassigned variables (0.849406ms)
✔ TN-7: Do not replace variable without declaration (0.518833ms)
✔ SAFE: replaceIdentifierWithFixedAssignedValue (22.316357ms)
▶ SAFE: replaceIdentifierWithFixedValueNotAssignedAtDeclaration
✔ TP-1: Replace identifier with number literal (2.913762ms)
✔ TP-2: Replace identifier with string literal (1.115061ms)
✔ TP-3: Replace identifier with boolean literal (1.309406ms)
✔ TP-4: Replace identifier with null literal (1.157739ms)
✔ TP-5: Replace var declaration (1.230315ms)
✔ TP-6: Replace with multiple references (1.091389ms)
✔ TN-1: Do not replace variable used in for-in loop (0.768696ms)
✔ TN-2: Do not replace variable used in for-of loop (0.712496ms)
✔ TN-3: Do not replace variable in conditional expression context (0.977429ms)
✔ TN-4: Do not replace variable with multiple assignments (0.736451ms)
✔ TN-5: Do not replace variable assigned non-literal value (0.646385ms)
✔ TN-6: Do not replace function callee (0.660071ms)
✔ TN-7: Do not replace variable with initial value (0.672971ms)
✔ TN-8: Do not replace when references are modified (0.813565ms)
✔ SAFE: replaceIdentifierWithFixedValueNotAssignedAtDeclaration (15.680449ms)
▶ SAFE: replaceNewFuncCallsWithLiteralContent
✔ TP-1: Replace Function constructor with IIFE (2.5808ms)
✔ TP-2: Replace Function constructor with single expression (1.096377ms)
✔ TP-3: Replace Function constructor with multiple statements (1.757053ms)
✔ TP-4: Replace Function constructor with empty string (0.833574ms)
✔ TP-5: Replace Function constructor with variable declaration (1.502759ms)
✔ TN-1: Do not replace Function constructor with arguments (0.683437ms)
✔ TN-2: Do not replace Function constructor with multiple parameters (0.565506ms)
✔ TN-3: Do not replace Function constructor with non-literal argument (0.493396ms)
✔ TN-4: Do not replace non-Function constructor (0.702023ms)
✔ TN-5: Do not replace Function constructor not used as callee (0.7154ms)
✔ TN-6: Do not replace Function constructor with invalid syntax (1.22ms)
✔ SAFE: replaceNewFuncCallsWithLiteralContent (12.956239ms)
▶ SAFE: replaceBooleanExpressionsWithIf
✔ TP-1: Simple logical AND (1.499051ms)
✔ TP-2: Simple logical OR (0.954665ms)
✔ TP-3: Chained logical AND (1.076859ms)
✔ TP-4: Chained logical OR (1.117895ms)
✔ TP-5: Function call in condition (0.915496ms)
✔ TP-6: Member expression in condition (0.90364ms)
✔ TN-1: Do not transform non-logical expressions (0.407591ms)
✔ TN-2: Do not transform logical expressions not in expression statements (0.499445ms)
✔ TN-3: Do not transform bitwise operators (0.406926ms)
✔ SAFE: replaceBooleanExpressionsWithIf (8.36028ms)
▶ SAFE: replaceSequencesWithExpressions
✔ TP-1: Replace sequence with 2 expressions in if statement (1.494762ms)
✔ TP-2: Replace sequence with 3 expressions within existing block (1.153456ms)
✔ TP-3: Replace sequence in while loop (1.180197ms)
✔ TP-4: Replace sequence with 4 expressions (1.266222ms)
✔ TP-5: Replace sequence in for loop body (2.527978ms)
✔ TP-6: Replace sequence with mixed expression types (1.435017ms)
✔ TP-7: Replace sequence in else clause (1.025264ms)
✔ TN-1: Do not replace single expression (not a sequence) (0.392385ms)
✔ TN-2: Do not replace sequence with only one expression (0.404ms)
✔ TN-3: Do not replace sequence in non-ExpressionStatement context (0.616725ms)
✔ TN-4: Do not replace sequence in return statement (0.581896ms)
✔ TN-5: Do not replace sequence in assignment (0.515965ms)
✔ SAFE: replaceSequencesWithExpressions (13.330236ms)
▶ SAFE: resolveDeterministicIfStatements
✔ TP-1: Resolve true and false literals (1.424439ms)
✔ TP-2: Resolve truthy number literal (0.854855ms)
✔ TP-3: Resolve falsy number literal (0) (0.883829ms)
✔ TP-4: Resolve truthy string literal (0.830264ms)
✔ TP-5: Resolve falsy string literal (empty) (0.804528ms)
✔ TP-6: Resolve null literal (0.921467ms)
✔ TP-7: Resolve if statement with no else clause (truthy) (4.429571ms)
✔ TP-8: Remove if statement with no else clause (falsy) (1.021982ms)
✔ TP-9: Resolve negative number literal (1.143355ms)
✔ TP-10: Resolve nested if statements (0.996957ms)
✔ TN-1: Do not resolve if with variable condition (0.554881ms)
✔ TN-2: Do not resolve if with function call condition (0.5936ms)
✔ TN-3: Do not resolve if with expression condition (4.542132ms)
✔ TN-4: Do not resolve if with member expression condition (0.752691ms)
✔ SAFE: resolveDeterministicIfStatements (20.630666ms)
▶ SAFE: resolveFunctionConstructorCalls
✔ TP-1: Replace Function.constructor with no parameters (2.347489ms)
✔ TP-2: Part of a member expression (4.368671ms)
✔ TP-3: Replace Function.constructor with single parameter (1.949681ms)
✔ TP-4: Replace Function.constructor with multiple parameters (1.373942ms)
✔ TP-5: Replace Function.constructor with complex body (1.343976ms)
✔ TP-6: Replace Function.constructor with empty body (0.861721ms)
✔ TP-7: Replace Function.constructor in variable assignment (1.222533ms)
✔ TP-8: Replace Function.constructor in call expression (0.996226ms)
✔ TN-1: Do not replace Function.constructor with non-literal arguments (0.481011ms)
✔ TN-2: Do not replace Function.constructor with no arguments (0.416473ms)
✔ TN-3: Do not replace non-constructor calls (0.460647ms)
✔ TN-4: Do not replace Function.constructor with invalid syntax body (0.786396ms)
✔ TP-9: Replace any constructor call with literal arguments (0.944086ms)
✔ SAFE: resolveFunctionConstructorCalls (18.314714ms)
▶ SAFE: resolveMemberExpressionReferencesToArrayIndex
✔ TP-1 (2.313709ms)
✔ TP-2: Replace multiple array accesses on same array (1.956051ms)
✔ TP-3: Replace array access with string literal elements (1.488725ms)
✔ TP-4: Replace array access in function call arguments (1.403442ms)
✔ TN-1: Don't resolve references to array methods (0.753934ms)
✔ TN-2: Do not resolve arrays smaller than minimum length (0.627529ms)
✔ TN-3: Do not resolve assignment to array elements (0.755806ms)
✔ TN-4: Do not resolve computed property access with variables (0.704216ms)
✔ TN-5: Do not resolve out-of-bounds array access (0.876539ms)
✔ TN-6: Do not resolve negative array indices (0.596887ms)
✔ TN-7: Do not resolve floating point indices (0.476263ms)
✔ SAFE: resolveMemberExpressionReferencesToArrayIndex (12.501221ms)
▶ SAFE: resolveMemberExpressionsWithDirectAssignment
✔ TP-1: Replace direct property assignments with literal values (1.453465ms)
✔ TP-2: Replace object property assignments (1.015658ms)
✔ TP-3: Replace computed property assignments (0.776499ms)
✔ TP-4: Replace boolean and null assignments (0.866262ms)
✔ TP-5: Replace multiple references to same property (0.70158ms)
✔ TN-1: Don't resolve with multiple assignments (0.348406ms)
✔ TN-2: Don't resolve with update expressions (0.314998ms)
✔ TN-3: Do not resolve when assigned non-literal value (0.320331ms)
✔ TN-4: Do not resolve when object has no declaration (0.293533ms)
✔ TN-5: Do not resolve when property is reassigned (0.323193ms)
✔ TN-6: Do not resolve when used in assignment expression (0.314559ms)
✔ TN-7: Do not resolve when property is computed with variable (0.374949ms)
✔ TN-8: Do not resolve when no references exist (0.256512ms)
✔ SAFE: resolveMemberExpressionsWithDirectAssignment (7.777436ms)
▶ SAFE: resolveProxyCalls
✔ TP-1: Replace chained proxy calls with direct function calls (1.570224ms)
✔ TP-2: Replace proxy with no parameters (1.026238ms)
✔ TP-3: Replace proxy with multiple parameters (1.224759ms)
✔ TP-4: Replace proxy that calls another proxy (single-step resolution) (1.126901ms)
✔ TN-1: Do not replace function with multiple statements (0.498186ms)
✔ TN-2: Do not replace function with no return statement (0.32757ms)
✔ TN-3: Do not replace function that returns non-call expression (0.2269ms)
✔ TN-4: Do not replace function that calls member expression (0.602444ms)
✔ TN-5: Do not replace function with parameter count mismatch (0.419671ms)
✔ TN-6: Do not replace function with reordered parameters (0.357242ms)
✔ TN-7: Do not replace function with modified parameters (0.440152ms)
✔ TN-8: Do not replace function with no references (0.313256ms)
✔ SAFE: resolveProxyCalls (8.560862ms)
▶ SAFE: resolveProxyReferences
✔ TP-1: Replace proxy reference with direct reference (1.35441ms)
✔ TP-2: Replace multiple proxy references to same target (0.778832ms)
✔ TP-3: Replace member expression proxy references (0.896908ms)
✔ TP-4: Replace chained proxy references (0.658866ms)
✔ TP-5: Replace variable with let declaration (0.718454ms)
✔ TP-6: Replace variable with var declaration (0.680516ms)
✔ TN-1: Do not replace proxy in for-in statement (0.611657ms)
✔ TN-2: Do not replace proxy in for-of statement (0.559728ms)
✔ TN-3: Do not replace proxy in for statement (0.605629ms)
✔ TN-4: Do not replace circular references (0.352752ms)
✔ TN-5: Do not replace self-referencing variables (0.363ms)
✔ TN-6: Do not replace when proxy is modified (0.431058ms)
✔ TN-7: Do not replace when target is modified (0.364131ms)
✔ TN-8: Do not replace when proxy has no references (0.264529ms)
✔ TN-9: Do not replace non-identifier/non-member expression variables (0.245342ms)
✔ TP-7: Replace when target comes from function call (still safe) (0.630817ms)
✔ SAFE: resolveProxyReferences (10.070766ms)
▶ SAFE: resolveProxyVariables
✔ TP-1: Replace proxy variable references with target identifier (1.329211ms)
✔ TP-2: Remove unused proxy variable declaration (0.96391ms)
✔ TP-3: Replace multiple references to same proxy (0.895469ms)
✔ TP-4: Remove proxy variable with no references (0.501715ms)
✔ TP-5: Replace with let declaration (0.815141ms)
✔ TP-6: Replace with var declaration (0.658104ms)
✔ TN-1: Do not replace when proxy is assigned non-identifier (0.356462ms)
✔ TN-2: Do not replace when proxy is modified (0.379027ms)
✔ TN-3: Do not replace when proxy is updated (0.366258ms)
✔ TN-4: Do not replace when reference is used in assignment (0.377509ms)
✔ TN-5: Do not replace non-identifier initialization (0.328912ms)
✔ SAFE: resolveProxyVariables (7.429398ms)
▶ SAFE: resolveRedundantLogicalExpressions
✔ TP-1: Simplify basic true and false literals with && and || (1.209602ms)
✔ TP-2: Simplify AND expressions with truthy left operand (1.049507ms)
✔ TP-3: Simplify AND expressions with falsy left operand (0.942289ms)
✔ TP-4: Simplify AND expressions with truthy right operand (0.83843ms)
✔ TP-5: Simplify AND expressions with falsy right operand (0.818298ms)
✔ TP-6: Simplify OR expressions with truthy left operand (0.887538ms)
✔ TP-7: Simplify OR expressions with falsy left operand (1.267055ms)
✔ TP-8: Simplify OR expressions with truthy right operand (1.079233ms)
✔ TP-9: Simplify OR expressions with falsy right operand (1.515626ms)
✔ TP-10: Handle complex expressions with nested logical operators (1.032907ms)
✔ TN-1: Do not simplify when both operands are non-literals (0.874771ms)
✔ TN-2: Do not simplify non-logical expressions (0.737591ms)
✔ TN-3: Do not simplify logical expressions outside if statements (0.70637ms)
✔ TN-4: Do not simplify unsupported logical operators (if any) (0.61807ms)
✔ SAFE: resolveRedundantLogicalExpressions (14.520385ms)
▶ SAFE: unwrapFunctionShells
✔ TP-1: Unwrap and rename (2.311879ms)
✔ TP-2: Unwrap anonymous without renaming (1.570291ms)
✔ TP-3: Unwrap function expression assigned to variable (1.469816ms)
✔ TP-4: Inner function already has parameters (1.480163ms)
✔ TP-5: Outer function has multiple parameters (1.318855ms)
✔ TP-6: Complex inner function body (1.620542ms)
✔ TN-1: Do not unwrap function with multiple statements (0.814267ms)
✔ TN-2: Do not unwrap function with no return statement (0.536628ms)
✔ TN-3: Do not unwrap function returning .call instead of .apply (0.655864ms)
✔ TN-4: Do not unwrap .apply with wrong argument count (0.622809ms)
✔ TN-5: Do not unwrap when callee object is not FunctionExpression (0.607463ms)
✔ TN-6: Do not unwrap function returning non-call expression (0.488416ms)
✔ TN-7: Do not unwrap function with empty body (0.385996ms)
✔ TN-8: Do not unwrap function with BlockStatement but no statements (0.359579ms)
✔ TN-9: Do not unwrap arrow function as outer function (0.835599ms)
✔ SAFE: unwrapFunctionShells (15.981568ms)
▶ SAFE: unwrapIIFEs
✔ TP-1: Arrow functions (1.945249ms)
✔ TP-2: Function expressions (1.285194ms)
✔ TP-3: In-place unwrapping (1.360963ms)
✔ TN-1: Unary declarator init (0.802242ms)
✔ TN-2: Unary assignment right (0.877594ms)
✔ TP-4: IIFE with multiple statements unwrapped (1.697846ms)
✔ TN-3: Do not unwrap IIFE with arguments (0.799868ms)
✔ TN-4: Do not unwrap named function IIFE (0.709268ms)
✔ TN-5: Do not unwrap IIFE in assignment context (0.719934ms)
✔ TP-5: Arrow function IIFE with expression body (1.023585ms)
✔ SAFE: unwrapIIFEs (11.90444ms)
▶ SAFE: unwrapSimpleOperations
✔ TP-1: Binary operations (23.225034ms)
✔ TP-2 Unary operations (5.912324ms)
✔ TP-3 Update operations (1.722052ms)
✔ TN-1: Do not unwrap function with multiple statements (0.890694ms)
✔ TN-2: Do not unwrap function with wrong parameter count (0.75093ms)
✔ TN-3: Do not unwrap operation not using parameters (0.599666ms)
✔ TN-4: Do not unwrap function with no return statement (0.665934ms)
✔ TN-5: Do not unwrap unsupported operator (0.644491ms)
✔ SAFE: unwrapSimpleOperations (34.924935ms)
▶ SAFE: separateChainedDeclarators
✔ TP-1: A single const (1.372828ms)
✔ TP-2: A single let (0.914163ms)
✔ TP-3: A var and a let (2.015813ms)
✔ TP-3: Wrap in a block statement for a one-liner (1.065611ms)
✔ TP-5: Mixed initialization patterns (0.57717ms)
✔ TP-6: Mixed declaration types with complex expressions (0.921908ms)
✔ TP-7: Three or more declarations (0.671289ms)
✔ TP-8: Declarations in function scope (0.922934ms)
✔ TN-1: Variable declarators are not chained in for statement (0.420849ms)
✔ TN-2: Variable declarators are not chained in for-in statement (0.275809ms)
✔ TN-3: Variable declarators are not chained in for-of statement (0.21238ms)
✔ TN-4: Single declarator should not be transformed (0.254061ms)
✔ TN-5: ForAwaitStatement declarations should be preserved (0.370894ms)
✔ TN-6: Destructuring patterns should not be separated (1.40896ms)
✔ SAFE: separateChainedDeclarators (11.999502ms)
▶ SAFE: simplifyCalls
✔ TP-1: With args (1.093155ms)
✔ TP-2: Without args (0.488185ms)
✔ TP-3: Mixed calls with complex arguments (0.721802ms)
✔ TP-4: Calls on member expressions (0.708271ms)
✔ TP-5: Apply with empty array (0.396859ms)
✔ TP-6: Call and apply in same expression (0.617978ms)
✔ TP-7: Call and apply with null for context (0.554319ms)
✔ TN-1: Ignore calls without ThisExpression (0.473121ms)
✔ TN-2: Do not transform Function constructor calls (0.346379ms)
✔ TN-3: Do not transform calls on function expressions (0.386273ms)
✔ TN-4: Do not transform other method names (0.353044ms)
✔ TN-5: Do not transform calls with this in wrong position (0.30258ms)
✔ SAFE: simplifyCalls (6.869403ms)
▶ SAFE: simplifyIfStatements
✔ TP-1: Empty blocks (0.719093ms)
✔ TP-2: Empty blocks with an empty alternate statement (0.850685ms)
✔ TP-3: Empty blocks with a populated alternate statement (0.682394ms)
✔ TP-4: Empty blocks with a populated alternate block (0.509879ms)
✔ TP-5: Empty statements (0.408355ms)
✔ TP-6: Empty statements with no alternate (0.290517ms)
✔ TP-7: Empty statements with an empty alternate (0.283034ms)
✔ TP-8: Populated consequent with empty alternate block (0.381365ms)
✔ TP-9: Populated consequent with empty alternate statement (0.340999ms)
✔ TP-10: Complex expression in test with empty branches (0.424212ms)
✔ TP-11: Nested empty if statements (0.492115ms)
✔ TN-1: Do not transform if with populated consequent and alternate (0.336632ms)
✔ TN-2: Do not transform if with populated block statements (0.297119ms)
✔ TN-3: Do not transform if with only populated consequent block (0.251491ms)
✔ TN-4: Do not transform complex if-else chains (0.302682ms)
✔ SAFE: simplifyIfStatements (11.879236ms)
▶ UNSAFE: normalizeRedundantNotOperator
✔ TP-1: Mixed literals and expressions (32.406939ms)
✔ TP-2: String literals (6.52331ms)
✔ TP-3: Number literals (6.839283ms)
✔ TP-4: Null literal (5.089176ms)
✔ TP-5: Empty array and object literals (6.077718ms)
✔ TP-6: Simple nested NOT operations (4.683466ms)
✔ TP-7: Normalize complex literals that can be safely evaluated (6.166704ms)
✔ TN-1: Do not normalize NOT on variables (3.21949ms)
✔ TN-2: Do not normalize NOT on complex expressions (1.770326ms)
✔ TN-3: Do not normalize NOT on function calls (1.092917ms)
✔ TN-4: Do not normalize NOT on computed properties (0.572083ms)
✔ TN-5: Do not normalize literals with unpredictable values (0.336831ms)
✔ UNSAFE: normalizeRedundantNotOperator (78.546083ms)
▶ UNSAFE: resolveAugmentedFunctionWrappedArrayReplacements
✔ Add Missing True Positive Test Cases (0.191495ms) # TODO
✔ TN-1: Do not transform functions without augmentation (2.475817ms)
✔ TN-2: Do not transform functions without array operations (1.648065ms)
✔ TN-3: Do not transform when no matching expression statements (1.791377ms)
✔ TN-4: Do not transform anonymous functions (0.828122ms)
✔ TN-5: Do not transform when array candidate has no declNode (0.701996ms)
✔ TN-6: Do not transform when expression statement pattern is wrong (1.808094ms)
✔ TN-7: Do not transform when no replacement candidates found (1.394424ms)
✔ UNSAFE: resolveAugmentedFunctionWrappedArrayReplacements (11.342317ms)
▶ UNSAFE: resolveBuiltinCalls
✔ TP-1: atob (4.133547ms)
✔ TP-2: btoa (3.632123ms)
✔ TP-3: split (4.958445ms)
✔ TP-4: Member expression with literal arguments (3.60568ms)
✔ TP-5: Multiple builtin calls (3.658955ms)
✔ TP-6: String method with multiple arguments (3.689331ms)
✔ TN-1: querySelector (0.446392ms)
✔ TN-2: Unknown variable (3.677618ms)
✔ TN-3: Overwritten builtin (0.649845ms)
✔ TN-4: Skip builtin function call (0.343145ms)
✔ TN-5: Skip member expression with restricted property (0.262474ms)
✔ TN-6: Function call with this expression (0.3191ms)
✔ TN-7: Constructor property access (0.275138ms)
✔ TN-8: Member expression with computed property using variable (3.545893ms)
✔ UNSAFE: resolveBuiltinCalls (33.893232ms)
▶ UNSAFE: resolveDefiniteBinaryExpressions
✔ TP-1: Mixed arithmetic and string operations (5.980888ms)
✔ TP-2: Division and modulo operations (4.901008ms)
✔ TP-3: Bitwise operations (3.760179ms)
✔ TP-4: Comparison operations (3.824583ms)
✔ TP-5: Negative number edge case handling (3.726204ms)
✔ TP-6: Null operations and string concatenation (3.739612ms)
✔ TN-1: Do not resolve expressions with variables (0.410094ms)
✔ TN-2: Do not resolve expressions with function calls (0.369388ms)
✔ TN-3: Do not resolve member expressions (0.451571ms)
✔ TN-4: Do not resolve complex nested expressions (0.479282ms)
✔ TN-5: Do not resolve logical expressions (not BinaryExpressions) (3.419111ms)
✔ TN-6: Do not resolve expressions with undefined identifier (0.463108ms)
✔ Helper TP-1: Literal node (0.385194ms)
✔ Helper TP-2: Binary expression with literals (0.270727ms)
✔ Helper TP-3: Unary expression with literal (0.195985ms)
✔ Helper TP-4: Complex nested binary expressions (0.257105ms)
✔ Helper TP-5: Logical expression with literals (0.201127ms)
✔ Helper TP-6: Conditional expression with literals (0.411381ms)
✔ Helper TP-7: Sequence expression with literals (0.423608ms)
✔ Helper TN-7: Update expression with identifier (0.538298ms)
✔ Helper TN-1: Identifier is rejected (0.220401ms)
✔ Helper TN-2: Unary expression with identifier (0.223687ms)
✔ Helper TN-3: Binary expression with identifier (0.228586ms)
✔ Helper TN-4: Complex non-literal expressions are rejected (0.222251ms)
✔ Helper TN-5: Function calls and member expressions (0.471829ms)
✔ Helper TN-6: Null and undefined handling (0.151477ms)
✔ UNSAFE: resolveDefiniteBinaryExpressions (36.724564ms)
▶ UNSAFE: resolveDefiniteMemberExpressions
✔ TP-1: String and array indexing with properties (3.460869ms)
✔ TP-2: Array literal indexing (3.952369ms)
✔ TP-3: String indexing with different positions (4.352486ms)
✔ TP-4: Array length property (3.211405ms)
✔ TP-5: Mixed literal types in arrays (3.33127ms)
✔ TP-6: Non-computed property access with identifier (3.140928ms)
✔ TN-1: Do not transform update expressions (0.616393ms)
✔ TN-2: Do not transform method calls (callee position) (0.613131ms)
✔ TN-3: Do not transform computed properties with variables (0.69667ms)
✔ TN-4: Do not transform non-literal objects (0.400257ms)
✔ TN-5: Do not transform empty literals (0.346216ms)
✔ TN-6: Do not transform complex property expressions (0.359626ms)
✔ TN-7: Do not transform out-of-bounds access (handled by sandbox) (3.455182ms)
✔ UNSAFE: resolveDefiniteMemberExpressions (28.799117ms)
▶ UNSAFE: resolveDeterministicConditionalExpressions
✔ TP-1: Boolean literals (true/false) (5.607576ms)
✔ TP-2: Truthy string literals (4.801777ms)
✔ TP-3: Falsy string literal (empty string) (3.391899ms)
✔ TP-4: Truthy number literals (3.506199ms)
✔ TP-5: Falsy number literal (zero) (3.390969ms)
✔ TP-6: Null literal (3.20172ms)
✔ TP-7: Nested conditional expressions (single pass) (3.170775ms)
✔ TP-8: Complex expressions as branches (3.349148ms)
✔ TN-1: Non-literal test expressions (0.53936ms)
✔ TN-2: Variable test expressions (0.375426ms)
✔ TN-3: Function call test expressions (0.466461ms)
✔ TN-4: Binary expression test expressions (0.652398ms)
✔ TN-5: Member expression test expressions (0.624925ms)
✔ TN-6: Unary expressions (not literals) (5.809296ms)
✔ TN-7: Undefined identifier (not literal) (0.587036ms)
✔ UNSAFE: resolveDeterministicConditionalExpressions (40.288304ms)
▶ UNSAFE: resolveEvalCallsOnNonLiterals
✔ TP-1: Function call that returns string (6.754329ms)
✔ TP-2: Array access returning empty string (3.145727ms)
✔ TP-3: Variable reference resolution (4.097429ms)
✔ TP-4: Function expression IIFE (5.400074ms)
✔ TP-5: Member expression property access (5.346863ms)
✔ TP-6: Array index with complex expression (4.980321ms)
✔ TN-1: Eval with literal string (already handled by another module) (0.447613ms)
✔ TN-2: Non-eval function calls (0.544832ms)
✔ TN-3: Eval with multiple arguments (0.420928ms)
✔ TN-4: Eval with no arguments (0.316882ms)
✔ TN-5: Computed member expression for eval (0.560062ms)
✔ TN-6: Eval with non-evaluable expression (3.914894ms)
✔ UNSAFE: resolveEvalCallsOnNonLiterals (36.631367ms)
▶ UNSAFE: resolveFunctionToArray
✔ TP-1: Simple function returning array (5.811111ms)
✔ TP-2: Function with multiple elements (4.833354ms)
✔ TP-3: Arrow function returning array (5.215514ms)
✔ TP-4: Function with parameters (ignored) (5.129444ms)
✔ TP-5: Multiple variables with array access only (5.240785ms)
✔ TN-1: Function call with non-array-access usage (0.743979ms)
✔ TP-6: Variable with empty references array (should transform) (4.446521ms)
✔ TN-3: Variable not assigned function call (0.607669ms)
✔ TN-4: Mixed usage (array access and other) (0.854902ms)
✔ TP-7: Function with property access (length is MemberExpression) (5.317133ms)
✔ TN-5: Function with method calls (not just property access) (0.748568ms)
✔ TN-6: Non-literal init expression (3.854644ms)
✔ UNSAFE: resolveFunctionToArray (43.616101ms)
▶ UNSAFE: resolveInjectedPrototypeMethodCalls
✔ TP-1: String prototype method injection (7.429574ms)
✔ TP-2: Number prototype method injection (5.523815ms)
✔ TP-3: Array prototype method injection (5.956844ms)
✔ TP-4: Method with parameters (6.278477ms)
✔ TP-5: Multiple calls to same injected method (6.335644ms)
✔ TP-6: Identifier assignment to prototype method (6.591384ms)
✔ TP-7: Method call with missing arguments resolves to expected result (6.021892ms)
✔ TP-8: Arrow function prototype method injection (5.569113ms)
✔ TP-9: Arrow function with parameters (6.14629ms)
✔ TP-10: Arrow function using closure variable (6.083434ms)
✔ TN-1: Non-prototype property assignment (1.110312ms)
✔ TN-2: Non-function assignment to prototype (1.43006ms)
✔ TN-3: Call to non-injected method (7.119092ms)
✔ TN-4: Assignment with non-assignment operator (1.143582ms)
✔ TN-5: Complex expression assignment to prototype (1.201078ms)
✔ TN-6: Arrow function returning this (may not evaluate safely) (4.878861ms)
✔ UNSAFE: resolveInjectedPrototypeMethodCalls (80.112269ms)
▶ UNSAFE: resolveLocalCalls
✔ TP-1: Function declaration (6.185165ms)
✔ TP-2: Arrow function (5.293298ms)
✔ TP-3: Overwritten builtin (5.481126ms)
✔ TP-4: Function expression (5.360655ms)
✔ TP-5: Multiple calls to same function (5.646373ms)
✔ TP-6: Function returning string (5.036534ms)
✔ TN-1: Missing declaration (0.524835ms)
✔ TN-2: Skipped builtin (0.419959ms)
✔ TN-3: No replacement with undefined (4.360876ms)
✔ TN-4: Complex member expression property access (4.869699ms)
✔ TP-7: Function call argument with FunctionExpression (10.390047ms)
✔ TN-5: Function toString (anti-debugging protection) (0.916662ms)
✔ TN-6: Simple wrapper function (handled by safe modules) (0.788133ms)
✔ TN-7: Call with ThisExpression argument (6.709848ms)
✔ TN-8: Member expression call on empty array (3.758313ms)
✔ UNSAFE: resolveLocalCalls (66.908361ms)
▶ UNSAFE: resolveMinimalAlphabet
✔ TP-1: Unary expressions on literals and arrays (31.039806ms)
✔ TP-2: Binary expressions with arrays (JSFuck patterns) (10.857596ms)
✔ TP-3: Unary expressions on null literal (8.451095ms)
✔ TP-4: Binary expressions with string concatenation (8.847069ms)
✔ TN-1: Expressions containing ThisExpression should be skipped (15.263684ms)
✔ TN-2: Binary expressions with non-plus operators (0.379198ms)
✔ TN-3: Unary expressions on numeric literals (0.250051ms)
✔ TN-4: Unary expressions on undefined identifier (0.205575ms)
✔ UNSAFE: resolveMinimalAlphabet (75.683133ms)
▶ resolveMemberExpressionsLocalReferences (resolveMemberExpressionsLocalReferences.js)
✔ TP-1: Array index access with literal (3.698374ms)
✔ TP-2: Object property access with dot notation (3.613574ms)
✔ TP-3: Object property access with string literal (4.128328ms)
✔ TP-4: Constructor property access (3.80868ms)
✔ TN-1: Object computed property with identifier variable (3.359099ms)
✔ TN-2: Array index with identifier variable (3.075687ms)
✔ TN-3: Function parameter reference (3.061956ms)
✔ TN-4: Member expression on left side of assignment (0.445089ms)
✔ TN-5: Member expression used as call expression callee (0.527142ms)
✔ TN-6: Property with skipped name (length) (0.340325ms)
✔ resolveMemberExpressionsLocalReferences (resolveMemberExpressionsLocalReferences.js) (26.550302ms)
▶ UTILS: evalInVm
✔ TP-1: String concatenation (10.948451ms)
✔ TP-2: Arithmetic operations (4.364126ms)
✔ TP-3: Array literal evaluation (4.752233ms)
✔ TP-4: Object literal evaluation (4.354048ms)
✔ TP-5: Boolean operations (4.296279ms)
✔ TP-6: Array length property (4.165922ms)
✔ TP-7: String method calls (4.588765ms)
✔ TP-8: Caching behavior - identical code returns same result (4.642198ms)
✔ TP-9: Sandbox reuse (4.861672ms)
✔ TP-10: Multi-statement code with valid operations (4.686796ms)
✔ TP-11: Trap neutralization - infinite while loop (4.585211ms)
✔ TP-12: Complex expression evaluation (4.241143ms)
✔ TP-14: Debugger statement (neutralized and evaluates successfully) (4.067789ms)
✔ TP-13: Split debugger string neutralization works (4.391751ms)
✔ TN-1: Non-deterministic function calls (4.626926ms)
✔ TN-2: Console object evaluation (4.515095ms)
✔ TN-3: Promise objects (bad type) (4.409595ms)
✔ TN-4: Invalid syntax (4.586953ms)
✔ TN-5: Function calls with side effects (4.459679ms)
✔ TN-6: Variable references (undefined) (4.234009ms)
✔ TN-7: Complex expressions with timing dependencies (4.610864ms)
✔ UTILS: evalInVm (106.663779ms)
▶ UTILS: areReferencesModified
✔ TP-1: Update expression (16.649973ms)
✔ TP-2: Direct assignment (3.448566ms)
✔ TP-3: Assignment to property (3.158536ms)
✔ TP-4: Re-assignment to property (1.504447ms)
✔ TP-5: Delete operation on object property (2.23272ms)
✔ TP-6: Delete operation on array element (5.008066ms)
✔ TP-7: For-in loop variable modification (5.057262ms)
✔ TP-8: For-of loop variable modification (3.963187ms)
✔ TP-9: Array mutating method call (3.7806ms)
✔ TP-10: Array sort method call (3.496494ms)
✔ TP-11: Object destructuring assignment (5.436604ms)
✔ TP-12: Array destructuring assignment (1.154216ms)
✔ TP-13: Update expression on member expression (0.937455ms)
✔ TN-1: No assignment (1.955725ms)
✔ TN-2: Read-only property access (1.134943ms)
✔ TN-3: Read-only array access (1.148049ms)
✔ TN-4: Non-mutating method calls (0.943911ms)
✔ TN-5: For-in loop with different variable (1.500226ms)
✔ TN-6: Safe destructuring (different variable) (1.311668ms)
✔ UTILS: areReferencesModified (66.963956ms)
▶ UTILS: createNewNode
✔ Literan: String (0.591095ms)
✔ Literan: String that starts with ! (0.257354ms)
✔ Literal: Number - positive number (0.217717ms)
✔ Literal: Number - negative number (0.343619ms)
✔ Literal: Number - negative infinity (0.26712ms)
✔ Literal: Number - negative zero (0.199264ms)
✔ Literal: Number - NOT operator (0.195652ms)
✔ Literal: Number - Identifier (0.231262ms)
✔ Literal: Boolean (0.192458ms)
✔ Array: empty (0.260613ms)
✔ Array: populated (0.421218ms)
✔ Object: empty (0.224573ms)
✔ Object: populated (0.432013ms)
✔ Object: populated with BAD_VALUE (1.298375ms)
✔ Undefined (0.260738ms)
✔ Null (0.223021ms)
✔ TODO: Implement Function (0.17973ms) # TODO
✔ RegExp (0.370286ms)
✔ BigInt (0.312227ms)
✔ Symbol with description (0.344155ms)
✔ Symbol without description (0.448128ms)
✔ UTILS: createNewNode (8.663522ms)
▶ UTILS: doesDescendantMatchCondition
✔ TP-1: Find descendant by type (boolean return) (2.977266ms)
✔ TP-2: Find descendant by type (node return) (0.995514ms)
✔ TP-3: Find marked descendant (simulating isMarked property) (0.791237ms)
✔ TP-4: Multiple nested descendants (0.999581ms)
✔ TP-5: Find specific assignment pattern (0.975817ms)
✔ TN-1: No matching descendants (1.079865ms)
✔ TN-2: Node itself matches condition (0.579831ms)
✔ TN-3: Null/undefined input handling (0.335298ms)
✔ TN-4: Node with no children (1.01182ms)
✔ TN-5: Empty childNodes array (0.269439ms)
✔ UTILS: doesDescendantMatchCondition (10.723ms)
▶ UTILS: generateHash
✔ TP-1: Generate hash for normal string (6.334767ms)
✔ TP-2: Generate hash for AST node with .src property (0.341937ms)
✔ TP-3: Generate hash for number input (0.222162ms)
✔ TP-4: Generate hash for boolean input (0.193371ms)
✔ TP-5: Generate hash for empty string (0.177801ms)
✔ TP-6: Consistent hashes for identical inputs (0.18421ms)
✔ TP-7: Different hashes for different inputs (0.247501ms)
✔ TN-1: Handle null input gracefully (0.134689ms)
✔ TN-2: Handle undefined input gracefully (0.12998ms)
✔ TN-3: Handle object without .src property (0.201067ms)
✔ UTILS: generateHash (8.694326ms)
▶ UTILS: createOrderedSrc
✔ TP-1: Re-order nodes (1.082675ms)
✔ TP-2: Wrap calls in expressions (0.598291ms)
✔ TP-3: Push IIFEs to the end in order (1.555018ms)
✔ TP-4: Add dynamic name to IIFEs (1.801906ms)
✔ TP-5: Add variable name to IIFEs (1.466701ms)
✔ TP-6: Preserve node order (0.989573ms)
✔ TP-7: Standalone FEs (1.197039ms)
✔ TP-8: Variable declarations with semicolons (0.850312ms)
✔ TP-9: Assignment expressions with semicolons (0.917298ms)
✔ TP-10: Duplicate node elimination (0.731283ms)
✔ TP-11: IIFE dependency ordering with arguments (0.966912ms)
✔ TN-1: Empty node array (0.187962ms)
✔ TN-2: Single node without reordering (0.478792ms)
✔ TN-3: Non-CallExpression and non-FunctionExpression nodes (0.616619ms)
✔ TN-4: CallExpression without ExpressionStatement parent (0.566634ms)
✔ TN-5: Named function expressions (no renaming needed) (0.849824ms)
✔ UTILS: createOrderedSrc (15.7319ms)
▶ UTILS: getCache
✔ TP-1: Retain values for same script hash (0.832962ms)
✔ TP-2: Cache invalidation on script hash change (0.294687ms)
✔ TP-3: Manual flush preserves script hash (0.280694ms)
✔ TP-4: Multiple script hash switches (0.371069ms)
✔ TP-5: Cache object mutation persistence (0.281551ms)
✔ TN-1: Handle null script hash gracefully (0.315225ms)
✔ TN-2: Handle undefined script hash gracefully (0.268483ms)
✔ TN-3: Null and undefined should share same fallback cache (0.393986ms)
✔ TN-4: Empty string script hash (0.296808ms)
✔ TN-5: Flush after multiple hash changes (0.269671ms)
✔ UTILS: getCache (4.181469ms)
▶ UTILS: getCalleeName
✔ TP-1: Simple identifier callee (0.740367ms)
✔ TP-2: Member expression callee (single level) (0.832524ms)
✔ TP-3: Nested member expression callee (0.585764ms)
✔ TP-4: Deeply nested member expression (0.54686ms)
✔ TP-5: Avoid counting collision between function and literal calls (0.848121ms)
✔ TN-1: Literal string method calls return empty (0.498763ms)
✔ TN-2: Literal number method calls return empty (0.477089ms)
✔ TN-3: ThisExpression method calls return empty (0.513241ms)
✔ TN-4: Boolean literal method calls return empty (0.4705ms)
✔ TN-5: Logical expression callee returns empty (0.636847ms)
✔ TN-6: CallExpression as base object returns empty (0.516244ms)
✔ TN-7: Null/undefined input handling (0.217707ms)
✔ TN-8: Computed member expression with identifier (0.683196ms)
✔ TN-9: Complex callee without name returns empty (0.194944ms)
✔ UTILS: getCalleeName (8.506411ms)
▶ UTILS: getDeclarationWithContext
✔ TP-1: Call expression with function declaration (1.866684ms)
✔ TP-2: Call expression with function expression (1.328117ms)
✔ TP-3: Nested call with FE (1.033028ms)
✔ TP-4: Anti-debugging function overwrite (1.236039ms)
✔ TP-5: Collect assignments on references (1.263186ms)
✔ TP-6: Collect relevant parents for anonymous FE (0.737116ms)
✔ TP-7: Node without scriptHash should still work (1.00498ms)
✔ TP-8: Node without nodeId should still work (3.869044ms)
✔ TN-1: Prevent collection before changes are applied (1.130061ms)
✔ TN-2: Handle null input gracefully (0.224914ms)
✔ TN-3: Handle undefined input gracefully (0.200238ms)
✔ UTILS: getDeclarationWithContext (14.548025ms)
▶ UTILS: getDescendants
✔ TP-1 (0.8533ms)
✔ TP-2: Limited scope (0.584893ms)
✔ TP-3: Nested function with complex descendants (0.962183ms)
✔ TP-4: Object expression with properties (0.658873ms)
✔ TP-5: Array expression with elements (0.66947ms)
✔ TP-6: Caching behavior - same node returns cached result (0.439378ms)
✔ TN-1: No descendants for leaf nodes (0.493963ms)
✔ TN-2: Null input returns empty array (0.180319ms)
✔ TN-3: Undefined input returns empty array (0.168987ms)
✔ TN-4: Node with no childNodes property (0.211178ms)
✔ TN-5: Node with empty childNodes array (0.189417ms)
✔ UTILS: getDescendants (6.000241ms)
▶ UTILS: getMainDeclaredObjectOfMemberExpression
✔ TP-1: Simple member expression with declared object (0.607664ms)
✔ TP-2: Nested member expression finds root identifier (0.488288ms)
✔ TP-3: Computed member expression with declared base (0.485086ms)
✔ TP-4: Deep nesting finds correct root (0.545241ms)
✔ TN-1: Non-MemberExpression input returns the input unchanged (0.473627ms)
✔ TN-2: Null input returns null (0.16197ms)
✔ TN-3: Undefined input returns null (0.132673ms)
✔ TN-4: Member expression with no declNode still returns the object (0.44492ms)
✔ TN-5: Non-MemberExpression with declNode returns itself (0.519956ms)
✔ UTILS: getMainDeclaredObjectOfMemberExpression (4.296725ms)
▶ UTILS: getObjType
✔ TP-1: Detect Array type (0.305019ms)
✔ TP-2: Detect Object type (0.17797ms)
✔ TP-3: Detect String type (0.185476ms)
✔ TP-4: Detect Number type (0.140049ms)
✔ TP-5: Detect Boolean type (0.120887ms)
✔ TP-6: Detect Null type (0.125886ms)
✔ TP-7: Detect Undefined type (0.144532ms)
✔ TP-8: Detect Date type (0.187396ms)
✔ TP-9: Detect RegExp type (0.166144ms)
✔ TP-10: Detect Function type (0.150124ms)
✔ TP-11: Detect Arrow Function type (0.134321ms)
✔ TP-12: Detect Error type (0.202898ms)
✔ TP-13: Detect empty array (0.134579ms)
✔ TP-14: Detect empty object (0.136023ms)
✔ TP-15: Detect Symbol type (0.136676ms)
✔ TP-16: Detect BigInt type (0.14299ms)
✔ UTILS: getObjType (3.224286ms)
▶ UTILS: isNodeInRanges
✔ TP-1: Node completely within single range (0.637722ms)
✔ TP-2: Node within multiple ranges (first match) (0.501406ms)
✔ TP-3: Node within multiple ranges (second match) (0.467493ms)
✔ TP-4: Node exactly matching range boundaries (0.486387ms)
✔ TP-5: Large range containing small node (0.716382ms)
✔ TN-1: Node extends beyond range end (0.460963ms)
✔ TN-2: Node starts before range start (0.4487ms)
✔ TN-3: Empty ranges array (0.59252ms)
✔ TN-4: Node range partially overlapping but not contained (0.477779ms)
✔ UTILS: isNodeInRanges (5.241864ms)
▶ UTILS: Sandbox
✔ TP-1: Basic code execution (3.491978ms)
✔ TP-2: String operations (3.169389ms)
✔ TP-3: Array operations (3.1817ms)
✔ TP-4: Object operations (3.158092ms)
✔ TP-5: Multiple executions on same sandbox (3.269155ms)
✔ TP-6: Deterministic behavior - Math.random is deleted (3.149603ms)
✔ TP-7: Deterministic behavior - Date is deleted (3.178357ms)
✔ TP-8: Blocked API - WebAssembly is undefined (2.456954ms)
✔ TP-9: Blocked API - fetch is undefined (2.323515ms)
✔ TP-10: isReference method correctly identifies VM References (2.268364ms)
✔ TN-1: isReference returns false for null (2.145411ms)
✔ TN-2: isReference returns false for undefined (2.193876ms)
✔ TN-3: isReference returns false for regular objects (2.145802ms)
✔ UTILS: Sandbox (36.976017ms)
▶ Processors tests: Augmented Array
✔ TP-1: Complex IIFE with mixed array elements (45.411667ms)
✔ TP-2: Simple array with single shift (9.521171ms)
✔ TP-3: Array with zero shifts (no change) (7.491282ms)
✔ TP-4: Array with larger shift count (7.447716ms)
✔ TN-1: IIFE with non-literal shift count (2.451946ms)
✔ TN-2: IIFE with insufficient arguments (1.59572ms)
✔ TN-3: IIFE with non-identifier array argument (1.518495ms)
✔ TN-4: Non-IIFE function call (1.876815ms)
✔ TN-5: Invalid shift count (NaN) (1.748513ms)
✔ TN-9: Function passed to IIFE (function not self-modifying) (2.565743ms)
✔ TP-5: Arrow function IIFE (6.676415ms)
✔ TP-6: Shift count larger than array length (5.699427ms)
✔ TN-10: Arrow function without parentheses around parameters (0.912409ms)
✔ TN-11: Negative shift count (1.244974ms)
✔ TN-12: IIFE with complex array manipulation that cannot be resolved (5.853039ms)
✔ Processors tests: Augmented Array (106.56284ms)
▶ Processors tests: Caesar Plus
﹣ TP-1: FIX ME (0.15568ms) # SKIP
✔ Processors tests: Caesar Plus (0.406902ms)
▶ Processors tests: Function to Array
✔ TP-1: Independent call (8.665747ms)
✔ TP-2: IIFE (7.39104ms)
✔ TP-3: Arrow function returning array (6.793912ms)
✔ TP-4: Multiple variables with array access only (7.408228ms)
✔ TN-1: Function called multiple times without assignment (1.12968ms)
✔ TN-2: Mixed usage (array access and other) (1.09589ms)
✔ TN-3: Variable not assigned function call (0.683781ms)
✔ Processors tests: Function to Array (35.006346ms)
▶ Processors tests: Obfuscator.io
✔ TP-1 (2.886587ms)
✔ TP-2 (2.030689ms)
✔ Processors tests: Obfuscator.io (5.177318ms)
▶ Samples tests
✔ Deobfuscate sample: JSFuck (324.771924ms)
✔ Deobfuscate sample: Ant & Cockroach (520.360222ms)
✔ Deobfuscate sample: New Function IIFE (225.593986ms)
✔ Deobfuscate sample: Hunter (547.483414ms)
✔ Deobfuscate sample: $ (418.457498ms)
✔ Deobfuscate sample: Prototype Calls (578.258551ms)
﹣ TODO: FIX Deobfuscate sample: Caesar+ (0.138847ms) # SKIP
✔ Deobfuscate sample: eval(Ox$ (1559.906953ms)
✔ Deobfuscate sample: Obfuscator.io (6312.014343ms)
✔ Deobfuscate sample: $s (9149.820277ms)
✔ Deobfuscate sample: Local Proxies (11643.158652ms)
✔ Samples tests (31283.54392ms)
▶ parseArgs tests
✔ TP-1: Defaults (9.111192ms)
✔ TP-2: All on - short (2.015822ms)
✔ TP-3: All on - full (1.063067ms)
✔ TP-4: Custom outputFilename split (0.919077ms)
✔ TP-5: Custom outputFilename equals (0.682671ms)
✔ TP-6: Custom outputFilename full (0.656346ms)
✔ TP-7: Max iterations short equals (0.649465ms)
✔ TP-8: Max iterations short split (0.969305ms)
✔ TP-9: Max iterations long equals (1.45425ms)
✔ TP-10: Max iterations long split (1.258709ms)
✔ parseArgs tests (22.513745ms)
ℹ tests 763
ℹ suites 64
ℹ pass 757
ℹ fail 0
ℹ cancelled 0
ℹ skipped 4
ℹ todo 2
ℹ duration_ms 31825.806788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments