Hi Praveen.

Praveen Nayak:
> I asked about this in the Rhino forum and Norris gave me the following
> suggestion:
> ...
> * Remove importPackage calls. You'll have to change existing code that 
> relies upon the package import, of course. 
> * Declare global variables before using them. I haven't tested this, 
> but a quick read of the ImporterTopLevel code makes it look like Rhino 
> will test first to see if global variables are defined before 
> attempting to load a class of that name.
> ...
> http://groups.google.com/group/mozilla.dev.tech.js-engine/browse_thread/
> thread/a8e60144d4c76b68/ce9df605a451f6df#ce9df605a451f6df
> 
> I then checked the Batik source and found that "importPackage" is only
> called in the RhinoInterpreter constructor. If I remove this call, the
> rendering of SVG and execution of the JS had no problem. The hits to the
> server are also stopped.
> 
> So, I wanted to know if anyone can foresee any problem removing this
> call.

Those importPackage calls cause the various DOM interface objects to be
visible in the global scope (e.g. Node, Element, Document, etc.) as well
as the classes from java.lang.  Actually I’m not sure why the java.lang
classes are imported; I think it’d be fine to require the author to
import them specifically.

Anyway, if the importPackage call is to be removed, it should be
replaced with a bunch of importClass calls so that the individual
classes/interfaces from those packages are still imported.

A patch to do this would be welcome.

-- 
Cameron McCormack, http://mcc.id.au/
        xmpp:[EMAIL PROTECTED]  ▪  ICQ 26955922  ▪  MSN [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to