Closed gl91306 closed 1 year ago
jar.js
files are not intended for human reading or manipulation. The code is optimized for speed and the layout is relevant for multiple internal purposes. As a matter of fact, we are currently working on CheerpJ 3.0 that will require no jar.js
files at all.
As a workaround you might be able to use the internal "beautification" from the devtools, but actual support for this is outside the scope of the project.
currently if you use a jar.js file that was compiled directly from cheerpj it works just fine, but if you deobfuscate it it breaks due to how class names are found. In loader.js at the function "cjG" it states:
Specifically at the lines
var pc = "a.pc=" + pcVal + ";;if((";
andvar endOfGuard = code.indexOf("G|0)", guardPos);
, it shows that it uses obusfcated strings to get the class name. In a debofuscated code the first line would only work withvar pc = "a.pc = " + pcVal + ";(\n)if ((";
It can be seen that this string finding method should be replaced by using a regex to ignore any amount of spaces so that even"a.pc(big space)=(big space)"
would work. It should also accomodate any amount of semicolons and stuff. yeah.