nocsupport

Server obfuscate/minify breaks JavaScript

Discussion created by nocsupport on Mar 6, 2014
Latest reply on Mar 10, 2014 by nocsupport

The Web server is obfuscating/minifying our client-side JavaScript code

  • variable names are renamed to generic a, b, c
  • code comments are removed

that we added to the file

  c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\html\portlet\dockbar\view.jsp

This would be fine, except the above obfuscation/minification is also

  • removing semicolons from the last line of code in each {} code block
    (any IF statements, functions, try/catch, etc.)
  • adding a semicolon after the last "}"

which breaks the JavaScript (see attached HTML file for an example).

Since the Nimsoft app is built on other platforms such as Apache Tomcat, Liferay, etc., I am not sure exactly where this is happening or how we would disable this, but we need to turn off whatever feature modifies the JavaScript.

Can anyone please explain how to disable JavaScript obfuscation or minifiy in Nimsoft running on Windows Server 2008 R2?

PS This following pages describe a similar issue

Based on the above it seemed that we need to make sure the "portal-ext.properties" file has the line

  javascript.fast.load=false

I did a search on the Web server for that file (or any files containing "javascript.fast.load" in the contents).

The search returned 2 files:

  c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\WEB-INF\classes\portal-developer.properties   c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\WEB-INF\classes\portal-ext.properties

These are under \ROOT\ like the JSP file we are having issues with, so I am guessing these are the correct properties files.

The first file already contained the line, and I added the line to the second file.

However the JavaScript is still being changed before being rendered to the client's browser.

Someone in the above thread also mentioned solving the problem with shell commands:

  Thanks, it really helped me.   I solved the pb with two shell commands (if it could help someone else):      cat < liferayDebugMode.sh   set -e   # Replace here YOUR_LIFERAY_HOME_DIRECTORY with your liferay's home directory   cd $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes      # portal-developer.properties contains javascript.fast.load=false and other usefull things   cp portal-developer.properties portal-ext.properties   EOF      cat < liferayProductionMode.sh   mv $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/portal-ext.properties /tmp   EOF      chmod a+x liferayDebugMode.sh liferayProductionMode.sh

however our Nimsoft/Apache/Liferay is running on Windows Server 2008 R2 and not LINUX/UNIX, and we do not have the above .sh files.

If we did have the files I suppose we could try the following to do the chmod

Beyond this I haven't found much else on the Web about this problem - any help would be appreciated.

Outcomes