public class AppletHelper
This class allows our HtmlComparatorApplet to invoke complex actions.
There are two issues that this class is primarily intended to resolve. The HtmlComparatorApplet
lives in the Bootstrap jar, so it is directly available to the applet support in the
IE or Netscape6+/Mozilla browsers. However, our html logs use a single applet, and invoke methods
on the applet class. In Netscape6+/Mozilla, this makes use LiveConnect , and that
runs under a very restrictive SecurityManager. Even though our classes are loaded from
the JVM's lib/ext directory, and the java.policy file for the jvm allows full privileges to classes
loaded from that directory, the restrictive security policy obtains. In particular, file io and
reflection are not supported under that SecurityManager.
So - this class is loaded by the HtmlTestDomainImplementation running under the
bootstrap code under the AWT Accessibility SecurityManager. The class is therefore constructed with
full trust. We run as a separate thread under the generous SecurityManager, and wait for messages
asking us to perform actions. During our construction, we reach out to the HtmlComparatorApplet and register
ourself as a IAppletHelper. This supports the postsMessage() method. When the applet wants to
invoke a method, it calls postMessage. The postMessage implementation enqueues the message, and tickles the
AppletHelper thread to wake up and finish the action. A limitation of the current implementation is that only
string args are supported (up to 4) and there is no return value.
A complexity is that the AppletMessage is constructed under the restrictive SecurityManager. Consequently,
we ensure that this class is pre-loaded. This security problem seems to not occur in JRE 1.5.
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
This method is used by the HTML Log Compare Button to display a failing VP. The code
in the applet is absolutely minimal so that this algorithm can be easily changed without
having to reinstall the bootstrap JAR file.