Rhino Patches

The AltServlet relies on the Rhino JavaScript engine to parse, compile, and interpret JavaScript source files.

In the course of developing Alt Framework, several modifications were made to Rhino to add some powerful functionality. These features are not required to run the Alt Framework, but are required for several sub-features.

The source changes are included in a patch file (dev/rhinocvs.patch on SVN) with the distribution, and a binary version is included for convenience.

JSDoc Patches

To provide dynamic source-documenting in JavaScript, a series of patches provide a hidden __jsdoc__ property on all JavaScript Function objects that are defined after a /** javadoc */-style comment.

This feature is only available in interpreted mode and can be used by the Alt Framework documentation system to generate documentation for the core Alt Framework classes as well as your own code.

toSource Compression Patch

Inspired by Dojo's compressor, the toSource compression patch extends the definition of the Function.toSource method to take an additional flags argument.

Two flags (in the Java object org.mozilla.javascript.Decompiler) are defined by this patch: COMPRESS_FLAG and COMPRESS_NEWLINES_FLAG.

COMPRESS_FLAG tells toSource to generate a method where all the local variables are obfuscated, all comments are removed, and unnecessary white space is removed.

COMPRESS_NEWLINES_FLAG goes one step further to remove all new lines from the resulting code. (You may want to keep new lines if you want better client-side debugging.)

This feature will eventually be used by the client-side JavaScript module deployment system.

page last updated: Thursday, February 14, 2008

copyright © 2006 cellosoft