1. Compile the project in PRETTY mode (see previous post).
2. Find the files used by Safari. To do this, run this script in the compiled directory(~/Documents/workspace/MyProjectName/www/com.MyProjectName):
grep 'safari' *.nocache.js
This will find one or more files. The only difference between the files (as far as I can tell) is language settings.
3. Copy the 'default' file to another location. This will be used later.
4. Recompile in OBFUSCATED mode instead of PRETTY (see previous post) and deploy to the server.
5. Open the project in Safari 4.
6. Open the Error Console in Safari 4 (Develop --> Show Error Console)
7. You will see an error saying "SyntaxError: Expression too deep". Parallel to that, there will be a file name. Rename the file that you saved earlier to this file name.
8. Take this renamed file and replace the existing file on the server.
9. Restart the server.
There is also another workaround I have found and tested:
1. Compile and deploy in OBFUSCATED mode.
2. Open the application in Safari 4.
3. Open the Error Console in Safari 4 (Develop --> Show Error Console)
4. Find the offending file that is creating the error and open it in an editor (*Note: do to the large size of these files, some editors will not be able to open it. I use BBEdit (for Mac).)
5. Once the file is open, you will see a very long line of variables (ie: var ..., ..., ...). This is the offensive line. Insert new line characters every several hundred characters. (I believe the computable threshold is a thousand characters, but I have not run appropriate test to find the limit.)
6. Save the file and restart the server.