Affects Version/s: 6.1.0 CE GA1, 6.1.10 EE GA1, 6.2.0 CE M2
Component/s: Core Infrastructure
Steps to reproduce:
- Navigate to Control Panel > Server Administration > Script
- Paste execute the script out.println("\u0073" == "s");
- Run the same script
Expected: results from 2 and 4 should be the same (both true).
Actual: 2 is false and 4 is true
This is only one symptom of the problem (
LPS-25044 is another symptom). The problem is that our Rhino environment is not decoding unicode of hex escape sequences. This can be easily seen by executing the code "\u0073" using liferay-rhino.jar. It will print \u0073 whereas with the rhino.jar downloaded from mozilla it prints s (even though both are the same version of Rhino).
This is happening because we use YUI Compressor which uses a modified version of Rhino which does not decode escape sequences. The YUI Compressor version of Rhino is overwriting the normal version for us.
In fixing this, I've done the following:
- Repackaged YUI Compressor so that it's version of Rhino is namespaced at com.yahoo.platform.yui and will not conflict with other versions.
- Repackaging is now done with Jar Jar Links (http://code.google.com/p/jarjar) which works on the binary yuicompressor.jar instead of find and replace in source and then compiling. This is much simpler and means we only need to include the binary jar in /tools instead of the source zip. Another advantage is that we don't need to compile it (compilation was broken anyway because it could no longer download one of its dependencies because the version we use is slightly older).
- To upgrade YUI Compressor replace the jar in /tools with the new one, run the build-yuicompressor target of portal-impl/build.xml (if the new tools jar has a different name than the old one, update the name in the build.xml first). The new jar will be generated at /lib/portal/liferay-yuicompressor.jar.new. Delete the other one and remove the .new extension.
- Used vanilla Rhino instead of namespacing it to com.liferay. This will make it much easier to upgrade: just overwrite the jar with the new one in /lib/portal. The reason we were namespacing it to com.liferay was so that it wouldn't conflict with the rhino.jar that WebLogic includes (
LPS-3169), but the proper fix for this is to modify weblogic.xml to tell it we will use our own Rhino classes.