Ghosts in the machine – avoid using window.sun in Firefox as it starts the Java engine!
Sometimes you find leftovers of old technology in browsers that blow your mind. One of these “ghost in the machine” problems exists in Firefox: if you use window.sun
or function sun()
in JavaScript you effectively start the Java VM.
There are a few “magic” properties on Mozilla’s DOMWindow interface for supporting LiveConnect that will initialize the Java plugin and all the baggage that comes with it (which, with modern Java plugins, means launching java.exe as a subprocess). Looking up these properties on the window object is all it takes.
There are a few more of these still in the Mozilla source code and they are part of the old Netscape LiveConnect engine. They are:
- java
- Packages
- netscape
- sun
- JavaClass
- JavaArray
- JavaMember
Avoid these at all cost lest you want the performance of your JavaScript to be like a Java Applet.