Propagate formatting changes from the mozilla-org CVS repository

This commit is contained in:
nboyd%atg.com 2006-11-13 21:03:34 +00:00
Родитель b90cc75520
Коммит 51f645080a
9 изменённых файлов: 538 добавлений и 419 удалений

Просмотреть файл

@ -32,44 +32,47 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!DOCTYPE doctype PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st September 2004), see www.w3.org"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content= <meta http-equiv="Content-Language" content="en">
"text/html; charset=us-ascii"> <meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Igor Bukanov"> <meta name="Author" content="Igor Bukanov">
<meta name="KeyWords" content="Rhino, JavaScript, Java"> <meta name="KeyWords" content="Rhino, JavaScript, Java">
<title>Change Log</title> <title>Change Log</title>
<style type="text/css"> <link rel="up" href="./" title="Rhino project page">
P { text-align: justify; }
</style>
</head> </head>
<body bgcolor="#FFFFFF"> <body>
<h1 align="center">Change Log for Rhino</h1>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Change Log</strong></p>
<h1 style="text-align: center;">Change Log for Rhino</h1>
<h2>Change logs for previous Rhino releases</h2> <h2>Change logs for previous Rhino releases</h2>
<ul> <ul>
<li><a href="rhino16R2.html">Rhino 1.6R2</a>, released <li><a href="rhino16R2.html">Rhino 1.6R2</a>, released
2005-09-19</li> 2005-09-19</li>
<li><a href="rhino16R1.html">Rhino 1.6R1</a>, released <li><a href="rhino16R1.html">Rhino 1.6R1</a>, released
2004-11-29</li> 2004-11-29</li>
<li><a href="rhino15R5.html">Rhino 1.5R5</a>, released <li><a href="rhino15R5.html">Rhino 1.5R5</a>, released
2004-03-25</li> 2004-03-25</li>
<li><a href="rhino15R41.html">Rhino 1.5R4.1</a>, released <li><a href="rhino15R41.html">Rhino 1.5R4.1</a>, released
2003-04-21</li> 2003-04-21</li>
<li><a href="rhino15R4.html">Rhino 1.5R4</a>, released <li><a href="rhino15R4.html">Rhino 1.5R4</a>, released
2003-02-10</li> 2003-02-10</li>
<li><a href="rhino15R3.html">Rhino 1.5R3</a>, released <li><a href="rhino15R3.html">Rhino 1.5R3</a>, released
2002-01-27</li> 2002-01-27</li>
<li><a href="rhino15R2.html">Rhino 1.5R2</a>, released <li><a href="rhino15R2.html">Rhino 1.5R2</a>, released
2001-07-27</li> 2001-07-27</li>
<li><a href="rhino15R1.html">Rhino 1.5R1</a>, released <li><a href="rhino15R1.html">Rhino 1.5R1</a>, released
2000-09-10</li> 2000-09-10</li>
</ul> </ul>
<hr width="100%">
<br>
<a href="index.html">back to top</a>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,24 +32,40 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Norris Boyd"> <meta name="Author" content="Norris Boyd">
<meta name="KeyWords" content="Rhino, JavaScript, Java"> <meta name="KeyWords" content="Rhino, JavaScript, Java">
<title>Rhino Documentation</title> <title>Rhino Documentation</title>
</head>
<style> <link rel="up" href="./" title="Rhino project page">
h1 { text-align: center } <link rel="section" href="#general" title="General">
th { text-align: left; font-weight: normal; width: 220px } <link rel="section" href="#scripts" title="Writing Scripts">
hr { width: 100% } <link rel="section" href="#javaScript" title="JavaScript Tools">
<link rel="section" href="#embedding" title="Embedding Rhino">
<style type="text/css">
h1 { text-align: center; }
th { text-align: left; font-weight: normal; width: 220px; }
</style> </style>
</head>
<body> <body>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Rhino Documentation</strong></p>
<h1> Rhino Documentation</h1> <h1> Rhino Documentation</h1>
<h3>General</h3> <h2><a name="general" id="general">General</a></h2>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -73,13 +89,13 @@ hr { width: 100% }
<td>Answers to frequently asked questions about Rhino.</td> <td>Answers to frequently asked questions about Rhino.</td>
</tr> </tr>
<tr> <tr>
<th><a href="http://www.ociweb.com/jnb/archive/jnbMar2001.html">Scripting Languages for Java</a></th> <th><a class="ex-ref" href="http://www.ociweb.com/jnb/archive/jnbMar2001.html">Scripting Languages for Java</a></th>
<td>An article comparing and contrasting Rhino and Jython.</td> <td>An article comparing and contrasting Rhino and Jython.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>Writing Scripts</h3> <h2><a name="scripts" id="scripts">Writing Scripts</a></h2>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -97,7 +113,7 @@ hr { width: 100% }
</tbody> </tbody>
</table> </table>
<h3>JavaScript Tools</h3> <h2><a name="javascript" id="javascript">JavaScript Tools</a></h2>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -113,13 +129,13 @@ hr { width: 100% }
<td>Compiling scripts into Java class files.</td> <td>Compiling scripts into Java class files.</td>
</tr> </tr>
<tr> <tr>
<th><a href="http://www.mozilla.org/js/tests/library.html">Testing</a></th> <th><a href="../js/tests/library.html">Testing</a></th>
<td>Running the JavaScript test suite.</td> <td>Running the JavaScript test suite.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>Embedding Rhino</h3> <h2><a name="embedding" id="embedding">Embedding Rhino</a></h2>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -127,13 +143,14 @@ hr { width: 100% }
<td>A short tutorial on how to embed Rhino into your application.</td> <td>A short tutorial on how to embed Rhino into your application.</td>
</tr> </tr>
<tr> <tr>
<th><a href="apidocs/index.html">API javadoc Reference</a></th> <th><a href="apidocs/">API javadoc Reference</a></th>
<td>An annotated outline of the programming interface to Rhino (tip only).</td> <td>An annotated outline of the programming interface to Rhino
(tip only).</td>
</tr> </tr>
<tr> <tr>
<th><a href="scopes.html">Scopes and Contexts</a></th> <th><a href="scopes.html">Scopes and Contexts</a></th>
<td>Describes how to use scopes and contexts for the best performance <td>Describes how to use scopes and contexts for the best performance
and flexibility, with an eye toward multithreaded environments.</td> and flexibility, with an eye toward multithreaded environments.</td>
</tr> </tr>
<tr> <tr>
<th><a href="serialization.html">Serialization</a></th> <th><a href="serialization.html">Serialization</a></th>
@ -153,13 +170,13 @@ and flexibility, with an eye toward multithreaded environments.</td>
build JavaScript host objects.</td> build JavaScript host objects.</td>
</tr> </tr>
<tr> <tr>
<th><a href="bsf.html">Using Rhino with BSF</a></th> <th><a href="bsf.html">Using Rhino with
<td>How to use Rhino with apps that support BSF (Bean Scripting Framework) from the Apache Jakarta project.</td> <abbr title="Bean Scripting Framework">BSF</abbr></a></th>
<td>How to use Rhino with apps that support
<dfn>BSF (Bean Scripting Framework)</dfn> from the Apache Jakarta project.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3><hr><a href="index.html">back to top</a></h3>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,41 +32,58 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Igor Bukanov"> <meta name="Author" content="Igor Bukanov">
<meta name="KeyWords" content="Rhino, JavaScript, Java"> <meta name="KeyWords" content="Rhino, JavaScript, Java">
<title>Rhino Downloads</title> <title>Rhino Downloads</title>
<link rel="up" href="./" title="Rhino project page">
<link rel="section" href="#binaries" title="Rhino Binaries">
<link rel="section" href="#source" title="Getting source code for Rhino">
</head> </head>
<body> <body>
<center><b><font size="+3">Rhino Downloads</font></b></center>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Rhino Downloads</strong></p>
<h1>Rhino Downloads</h1>
<p>Rhino is available for download both in source and compiled form. </p> <p>Rhino is available for download both in source and compiled form. </p>
<h3> Binaries</h3>
<h2><a name="binaries" id="binaries">Binaries</a></h2>
<p> <p>
You can download binary distributions of Rhino from <a You can download binary distributions of Rhino from <a
href="ftp://ftp.mozilla.org/pub/mozilla.org/js/"> ftp://ftp.mozilla.org/pub/mozilla.org/js/</a> href="ftp://ftp.mozilla.org/pub/mozilla.org/js/">ftp://ftp.mozilla.org/pub/mozilla.org/js/</a>
. These zip files includes precompiled <tt>js.jar</tt> with all Rhino classes, documentation, examples and sources. . These zip files includes precompiled <code class="filename">js.jar</code>
with all Rhino classes, documentation, examples and sources.
</p> </p>
<p> <p>
Rhino 1.6R4 is the last qualified release. It includes support for <a Rhino 1.6R4 is the last qualified release. It includes support for
href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMAScript for XML</a> (E4X). To implement E4X runtime Rhino uses <a <a class="ex-ref"
href="http://xmlbeans.apache.org/">XMLBeans</a> library and if you would like to use E4X you need to add <tt>xbean.jar</tt> from XMLBeans distribution to your class path.</p> href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMAScript for XML</a> (E4X). To implement E4X runtime Rhino uses <a class="ex-ref"
href="http://xmlbeans.apache.org/">XMLBeans</a> library and if you
would like to use E4X you need to add <code class="filename">xbean.jar</code>
from XMLBeans distribution to your class path.</p>
<table class="data">
<table border=1 cellpadding=2 cellspacing=0>
<thead> <thead>
<tr> <tr>
<th>Release</th> <th scope="col">Release</th>
<th>Release Date</th> <th scope="col">Release Date</th>
<th>Change log</th> <th scope="col">Change log</th>
<th>Download link</th> <th scope="col">Download link</th>
</tr> </tr>
</thead> </thead>
<tbody>
<tbody>
<tr> <tr>
<td>Rhino 1.6R4</td> <td>Rhino 1.6R4</td>
<td>2006-09-10</td> <td>2006-09-10</td>
@ -144,30 +161,35 @@ href="http://xmlbeans.apache.org/">XMLBeans</a> library and if you would like to
<td><a href="ftp://ftp.mozilla.org/pub/mozilla.org/js/older-packages/rhino14R3.zip">rhino14R3.zip</a></td> <td><a href="ftp://ftp.mozilla.org/pub/mozilla.org/js/older-packages/rhino14R3.zip">rhino14R3.zip</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>If you are looking for <tt>js.jar</tt> for XSLT or for IBM's Bean <p>If you are looking for <code class="filename">js.jar</code> for XSLT
Scripting Framework (BSF), please read the following <a href="bsf.html#bsf-issue">note</a> and then download one of the zip files above and unzip it. </p> or for IBM's <dfn>Bean Scripting Framework (BSF)</dfn>, please read the
following <a href="bsf.html#bsf-issue">note</a> and then download one of
the zip files above and unzip it.</p>
<h3> Source</h3> <h2><a name="source" id="source">Source</a></h2>
The source code for Rhino is available under a dual <a <p>The source code for Rhino is available under <a
href="http://www.mozilla.org/MPL/MPL-1.1.html">MPL 1.1</a>/GPL 2.0 license. In addition to getting the href="http://www.mozilla.org/MPL/MPL-1.1.html">MPL 1.1</a>/GPL 2.0 license. In addition to
source from the zip files above, the source code for Rhino can be found in the getting the source from the zip files above, the source code for
CVS tree at mozilla/js/rhino. See <a Rhino can be found in the CVS tree at mozilla/js/rhino. See <a
href="http://www.mozilla.org/cvs.html">source code via cvs</a> for details on href="http://developer.mozilla.org/en/docs/Mozilla_Source_Code_Via_CVS">source code via cvs</a> for details on how to set up CVS, define your CVSROOT, and login. Once
how to set up CVS, define your CVSROOT, and login. Once you've done that, just you've done that, just execute the command</p>
execute the command
<pre>&nbsp;&nbsp;&nbsp; cvs co mozilla/js/rhino</pre> <pre class="code">&nbsp;&nbsp;&nbsp; cvs co mozilla/js/rhino
to get the tip source. </pre>
<p>to get the tip source.</p>
<p>The current tip can also be viewed using LXR at <a <p>The current tip can also be viewed using LXR at <a
href="http://lxr.mozilla.org/mozilla/source/js/rhino/"> href="http://lxr.mozilla.org/mozilla/source/js/rhino/">
http://lxr.mozilla.org/mozilla/source/js/rhino/</a> . See also <a href="changes.html">change log</a> for the current tip.</p> http://lxr.mozilla.org/mozilla/source/js/rhino/</a> . See also
<a href="changes.html">change log</a> for the current tip.</p>
<p> <p>
Rhino uses <a href="http://ant.apache.org/">Ant</a> as its build system and running <tt>ant</tt> command at the top directory of Rhino distribution should print the list of available build targets. Rhino uses <a class="ex-ref" href="http://ant.apache.org/">Ant</a> as its
</p> build system and running <tt>ant</tt> command at the top
<hr width="100%"><a href="index.html">back to top</a> <br> directory of Rhino distribution should print the list of
&nbsp; <br> available build targets.</p>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,55 +32,55 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="Author" content="Norris Boyd"> <meta name="Author" content="Norris Boyd">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<meta name="KeyWords" content="Rhino, JavaScript, Java"> <meta name="KeyWords" content="Rhino, JavaScript, Java">
<title>Rhino FAQ</title> <title>Rhino FAQ</title>
<link rel="up" href="./" title="Rhino project page">
</head> </head>
<body bgcolor="#FFFFFF"> <body>
<script src="owner.js"></script> <script type="text/javascript" src="owner.js"></script>
<center> <p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt;
<h1> <strong>Rhino FAQ</strong></p>
Frequently Asked Questions about Rhino</h1></center>
<script>document.write(owner());</script>
<br><script> <h1 style="text-align: center;">Frequently Asked Questions about Rhino</h1>
var d = new Date(document.lastModified); <script type="text/javascript">document.write(owner());</script>
document.write((d.getMonth()+1)+"/"+d.getDate()+"/"+d.getFullYear());
document.write('<br>');
</script>
<center> <dl>
<hr WIDTH="100%"></center>
<p><b><font size=+2>Q</font>.</b> <i>How do I create a Java array from <dt>How do I create a Java array from JavaScript?</dt>
JavaScript?</i> <dd>You must use Java reflection. For instance, to create an array
<p><b><font size=+2>A.</font></b> You must use Java reflection. For instance, of java.lang.String of length five, do
to create an array of java.lang.String of length five, do <pre class="code">
<blockquote><tt>var stringArray = java.lang.reflect.Array.newInstance(java.lang.String, var stringArray = java.lang.reflect.Array.newInstance(java.lang.String, 5);
5);</tt></blockquote> </pre>
Then if you wish to assign the string "hi" to the first element, simply <p>Then if you wish to assign the string "hi" to the first element, simply
execute <tt>stringArray[0] = "hi"</tt>. execute <var>stringArray[0] = "hi"</var>.</p>
<p>Creating arrays of primitive types is slightly different: you must use <p>Creating arrays of primitive types is slightly different: you must use
the TYPE field. For example, creating an array of seven ints can be done the TYPE field. For example, creating an array of seven ints can be done
with the code with the code</p>
<blockquote><tt>var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, <pre class="code">
7);</tt></blockquote> var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 7);
</pre><br><br></dd>
<p><br><b><font size=+2>Q</font>.</b> <i>When I try to execute a script <dt>When I try to execute a script I get the exception <code>Required security context missing</code>. What's going on?</dt>
I get the exception </i><tt>Required security context missing</tt><i>. <dd>You've likely missed placing the
What's going on?</i> <code class="filename">Security.properties</code> file in your class path at
<p><b><font size=+2>A.</font></b> You've likely missed placing the <tt>Security.properties</tt> <code class="filename">org.mozilla.javascript.resources</code>.</dd>
file in your class path at <tt>org.mozilla.javascript.resources</tt>.
<h3>
<hr WIDTH="100%"><br> </dl>
<a href="index.html">back to top</a></h3>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,25 +32,37 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Help with Rhino</title> <title>Help with Rhino</title>
<script src="owner.js"></script> <script type="text/javascript" src="owner.js"></script>
<style> <style type="text/css">
h1 { text-align: center } h1 { text-align: center; }
</style> </style>
<link rel="up" href="./" title="Rhino project page">
<link rel="section" href="#newsgroups" title="Newsgroup and Mail Gateway">
</head> </head>
<body> <body>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Help with Rhino</strong></p>
<h1>Help with Rhino</h1> <h1>Help with Rhino</h1>
<p>Have a question that you can't find answer to in the <a href="doc.html">documentation</a>? <p>Have a question that you can't find answer to in the <a href="doc.html">documentation</a>?
Here are some additional resources for help: Here are some additional resources for help:
</p> </p>
<h3>Newsgroup and Mail Gateway</h3> <h2><a name="newsgroups" id="newsgroups">Newsgroup and Mail Gateway</a></h2>
<p> <p>
The <a href="news:netscape.public.mozilla.jseng">netscape.public.mozilla.jseng</a> The <a href="news:netscape.public.mozilla.jseng">netscape.public.mozilla.jseng</a>
newsgroup answers questions about both Rhino and the C implementation of newsgroup answers questions about both Rhino and the C implementation of
@ -60,26 +72,22 @@ To post messages, send mail to <a href="mailto:mozilla-jseng@mozilla.org">mozill
To unsubscribe, mail with "unsubscribe" in the subject to <a href="mailto:mozilla-jseng-request@mozilla.org?subject=unsubscribe">mozilla-jseng-request@mozilla.org</a>. To unsubscribe, mail with "unsubscribe" in the subject to <a href="mailto:mozilla-jseng-request@mozilla.org?subject=unsubscribe">mozilla-jseng-request@mozilla.org</a>.
</p> </p>
<p> <p>
To view archived messages, try <a href="http://groups.google.com/groups?q=netscape.public.mozilla.jseng&hl=en&lr=&safe=off&site=groups">Google groups</a> or To view archived messages, try <a href="http://groups.google.com/groups?q=netscape.public.mozilla.jseng&amp;hl=en&amp;lr=&amp;safe=off&amp;site=groups">Google groups</a> or
other newsgroup services. other newsgroup services.
</p> </p>
<h3>Bug System</h3> <h2>Bug System</h2>
<p> <p>
Use <a href="http://bugzilla.mozilla.org/enter_bug.cgi?product=Rhino">Bugzilla</a> Use <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Rhino">Bugzilla</a>
to enter bugs against Rhino. Note that Rhino has its own product category. to enter bugs against Rhino. Note that Rhino has its own product category.
</p> </p>
<h3>Module Owner</h3> <h2>Module Owner</h2>
<p> <p>
The module owner,&nbsp;<script>document.write(owner());</script>, can The module owner,&nbsp;<script type="text/javascript">document.write(owner());</script>, can
be mailed for help as well, although he may copy his response to the newsgroup be mailed for help as well, although he may copy his response to the newsgroup
to help others. to help others.
</p> </p>
<p>
<hr WIDTH="100%"><a href="index.html">back to top</a>
<br>&nbsp;
<br>&nbsp;
</body> </body>
</html> </html>

Просмотреть файл

@ -32,89 +32,105 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Norris Boyd"> <meta name="Author" content="Norris Boyd">
<meta name="GENERATOR" content="Mozilla/4.72 [en]C-NSCP (WinNT; U) [Netscape]">
<title>JavaScript Requirements and Limitations</title> <title>JavaScript Requirements and Limitations</title>
<link rel="up" href="./" title="Rhino project page">
<link rel="section" href="#requirements" title="Requirements">
<link rel="section" href="#limitations" title="Limitations">
<link rel="section" href="#platforms" title="Platforms and JITs">
<link rel="section" href="#liveconnect" title="LiveConnect">
<link rel="section" href="#jsobject" title="JSObject">
</head> </head>
<body bgcolor="#FFFFFF">
<center> <body>
<h1>
Requirements and Limitations</h1></center>
<h2> <p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>JavaScript Requirements and Limitations</strong></p>
<b>Requirements</b></h2>
Rhino requires version 1.1 or greater of Java. <h1 style="text-align: center;">Requirements and Limitations</h1>
<h2><a name="requirements" id="requirements">Requirements</a></h2>
<p>Rhino requires version 1.1 or greater of Java.</p>
<p>To use the JavaAdapter feature or an optimization level of 0 or greater, <p>To use the JavaAdapter feature or an optimization level of 0 or greater,
Rhino must be running under a security manager that allows the definition Rhino must be running under a security manager that allows the definition
of class loaders. of class loaders.</p>
<p>
<hr WIDTH="100%">
<h2>
<b>Limitations</b></h2>
<h3> <h2><a name="limitations" id="limitations">Limitations</a></h2>
<b>Platforms and </b>JITs</h3>
Many platforms and JREs have problems converting decimal numbers to and <h3><a name="platforms" id="platforms">Platforms and JITs</a></h3>
<p>Many platforms and JREs have problems converting decimal numbers to and
from strings. These errors are usually boundary case errors and will show from strings. These errors are usually boundary case errors and will show
up as test failures in section 7.7.3. up as test failures in section 7.7.3.</p>
<p>Windows versions of the Symantec JIT prior to 3.00.029(i) will report <p>Windows versions of the Symantec JIT prior to 3.00.029(i) will report
internal errors for some generated class files. internal errors for some generated class files.</p>
<p>On the Symantec JIT and the AIX JVM, accessing a static field of a class <p>On the Symantec JIT and the AIX JVM, accessing a static field of a class
that has not yet loaded may not give the correct value of the field. For that has not yet loaded may not give the correct value of the field. For
example, accessing example, accessing
<tt>java.io.File.separatorChar</tt> before <tt>java.io.File</tt> <code class="filename">java.io.File.separatorChar</code> before <code class="filename">java.io.File</code>
has been loaded will return a value of 0. (This is a bug in the JIT; accessing has been loaded will return a value of 0. (This is a bug in the JIT;
the field should cause the class to be loaded.) accessing the field should cause the class to be loaded.)</p>
<p>The AIX Java version "JDK 1.1.6 IBM build a116-19980924 (JIT enabled: <p>The AIX Java version "JDK 1.1.6 IBM build a116-19980924 (JIT enabled:
jitc)" core dumps running several classes generated by Rhino. It also has jitc)" core dumps running several classes generated by Rhino. It also has
errors in java.lang.Math.pow that are reflected as failures in the JavaScript errors in java.lang.Math.pow that are reflected as failures in the
Math object's pow method. JavaScript Math object's pow method.</p>
<p>IBM Java for Linux version "JDK 1.1.8 IBM build l118-19991013 (JIT enabled: <p>IBM Java for Linux version "JDK 1.1.8 IBM build l118-19991013 (JIT
jitc)" has errors in java.lang.Math.pow that are reflected as test failures enabled: jitc)" has errors in java.lang.Math.pow that are reflected
in the JavaScript Math object's pow method. as test failures in the JavaScript Math object's pow method.</p>
<p>Solaris JDK 1.1.6 has errors in java.lang.Math.atan2 that are reflected <p>Solaris JDK 1.1.6 has errors in java.lang.Math.atan2 that are reflected
as test failures in the JavaScript Math object's atan2 method. as test failures in the JavaScript Math object's atan2 method.</p>
<br>&nbsp;
<h3>
<b>LiveConnect</b></h3>
If a JavaObject's field's name collides with that of a method, the value
of that field is retrieved lazily, and can be counter-intuitively affected
by later assignments:
<blockquote><tt>javaObj.fieldAndMethod = 5;</tt>
<br><tt>var field = javaObj.fieldAndMethod;</tt>
<br><tt>javaObj.fieldAndMethod = 7;</tt>
<br><tt>// now, field == 7</tt></blockquote>
You can work around this by forcing the field value to be converted to
a JavaScript type when you take its value:
<blockquote><tt>javaObj.fieldAndMethod = 5;</tt>
<br><tt>var field = javaObj.fieldAndMethod + 0; // force conversion now</tt>
<br><tt>javaObj.fieldAndMethod = 7;</tt>
<br><tt>// now, field == 5</tt></blockquote>
<h3> <h3><a name="liveconnect" id="liveconnect">LiveConnect</a></h3>
<b>JSObject</b></h3> <p>If a JavaObject's field's name collides with that of a method, the value
Rhino does NOT support the <tt>netscape.javascript.JSObject</tt> class. of that field is retrieved lazily, and can be counter-intuitively affected
<br>&nbsp; by later assignments:</p>
<h3>
<b>Date object</b></h3> <pre class="code">
The JavaScript Date object depends on time facilities of the underlying javaObj.fieldAndMethod = 5;
var field = javaObj.fieldAndMethod;
javaObj.fieldAndMethod = 7;
<span class="remark">// now, field == 7</span>
</pre>
<p>You can work around this by forcing the field value to be converted to
a JavaScript type when you take its value:</p>
<pre class="code">
javaObj.fieldAndMethod = 5;
var field = javaObj.fieldAndMethod + 0; <span class="remark">// force conversion now</span>
javaObj.fieldAndMethod = 7;
<span class="remark">// now, field == 5</span>
</pre>
<h3><a name="jsobject" id="jsobject">JSObject</a></h3>
<p>Rhino does <strong>NOT</strong> support the
<code class="filename">netscape.javascript.JSObject</code> class.</p>
<h3>Date object</h3>
<p>The JavaScript Date object depends on time facilities of the underlying
Java runtime to determine daylight savings time dates. Earlier JRE versions Java runtime to determine daylight savings time dates. Earlier JRE versions
may report a date for the daylight savings changeover that is a week off. may report a date for the daylight savings changeover that is a week off.
JRE 1.1.6 reports the correct date. JRE 1.1.6 reports the correct date.</p>
<p>Under the 1.1.6 JRE, evaluating <tt>(new Date(1998, 9, 25, 2)).toString()</tt> <p>Under the 1.1.6 JRE, evaluating <code class="command">(new Date(1998, 9, 25, 2)).toString()</code>
returns: returns:</p>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Oct 25 02:00:00 GMT-0800 (PST) 1998</pre> <pre class="code"> Sun Oct 25 02:00:00 GMT-0800 (PST) 1998
Earlier versions may return: </pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Oct 25 02:00:00 GMT-0700 (PDT) 1998</pre> <p>Earlier versions may return:</p>
(the JRE doesn't report the changeover until Nov. 1.) <pre class="code"> Sun Oct 25 02:00:00 GMT-0700 (PDT) 1998
<p>The Microsoft SDK 3.1 for Java also exhibits this problem. </pre>
<p> <p>(the JRE doesn't report the changeover until Nov. 1.)</p>
<hr WIDTH="100%"> <p>The Microsoft SDK 3.1 for Java also exhibits this problem.</p>
<br><a href="#">back to top</a>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,24 +32,34 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<HTML> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Norris Boyd">
<META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (WinNT; U) [Netscape]">
<TITLE>Optimization</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER> <html lang="en">
<H1>
Optimization</H1></CENTER>
<H2> <head>
Optimization settings</H2>
<P>The currently supported optimization settings are:</P>
<P><B>-1</B></P> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Norris Boyd">
<title>Optimization</title>
<link rel="up" href="./" title="Rhino project page">
</head>
<body>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Optimization</strong></p>
<h1 style="text-align: center;">Optimization</h1>
<h2>Optimization settings</h2>
<p>The currently supported optimization settings are:</p>
<p><b>-1</b></p>
<p>Interpretive mode is always used. The compilation time is minimized at the <p>Interpretive mode is always used. The compilation time is minimized at the
expense of runtime performance. No class files are generated, which may improve expense of runtime performance. No class files are generated, which may improve
@ -58,47 +68,40 @@ is that the interpreter performs tail-call elimination of recursive functions.
Also, you must use this optimization level if your code uses Continuation Also, you must use this optimization level if your code uses Continuation
objects. objects.
<p> <p>
If the optimization package is not available, then optimization acts as if it is always -1. <p>If the optimization package is not available, then optimization
</p> acts as if it is always -1.</p>
<P><B>0</B> <p><b>0</b></p>
<P>No optimizations are <p>No optimizations are performed. The bytecode compiler runs fastest
performed. The bytecode compiler runs fastest in this mode, but the generated byte code in this mode, but the generated byte code is less efficient.</p>
is less efficient.</P>
<P><B>1-9</B> <p><b>1-9</b></p>
<P>All optimizations are performed. Simple data &amp; type <p>All optimizations are performed. Simple data &amp; type
flow analysis is performed to determine which JavaScript variables can be flow analysis is performed to determine which JavaScript variables can
allocated to Java VM registers, and which variables are used only as Numbers. be allocated to Java VM registers, and which variables are used only as
Local common sub-expressions are collapsed (currently this only happens for Numbers. Local common sub-expressions are collapsed (currently this only
property lookup, but in the future more expressions may be optimized). All local happens for property lookup, but in the future more expressions may be
variables and parameters are allocated to Java VM registers. Function call optimized). All local variables and parameters are allocated to Java VM
targets are speculatively pre-cached (based on the name used in the source) so registers. Function call targets are speculatively pre-cached (based on
that dispatching can be direct, pending runtime confirmation of the actual the name used in the source) so that dispatching can be direct, pending
target. Arguments are passed as Object/Number pairs to reduce conversion runtime confirmation of the actual target. Arguments are passed as
overhead.</P> Object/Number pairs to reduce conversion overhead.</p>
<P>Note: <p>Note:</p>
<OL>
<LI>
Some language features (indirect calls to eval, use
of the arguments property of function objects) were previously not supported
in higher optimization levels. These features have been removed from the
language in ECMA, so higher optimization levels are now conformant.
<LI> <ol>
Future versions may allocate more aggressive <li>Some language features (indirect calls to eval, use
optimizations to higher optimization levels. For compatibility with future of the arguments property of function objects) were previously not supported
versions, use level 1. For maximal optimization, use level 9, but retest in higher optimization levels. These features have been removed from the
your application when upgrading to new versions.</LI> language in ECMA, so higher optimization levels are now conformant.</li>
</OL>
<li>Future versions may allocate more aggressive
optimizations to higher optimization levels. For compatibility with future
versions, use level 1. For maximal optimization, use level 9, but retest
your application when upgrading to new versions.</li>
</ol>
<P> </body>
<HR WIDTH="100%"> </html>
<BR><A HREF="index.html">back to top</A>
<br>
</BODY>
</HTML>

Просмотреть файл

@ -32,60 +32,75 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Norris Boyd"> <meta name="Author" content="Norris Boyd">
<meta name="GENERATOR" content="Mozilla/4.72 [en]C-NSCP (WinNT; U) [Netscape]">
<title>JavaScript Overview</title> <title>JavaScript Overview</title>
<link rel="up" href="./" title="Rhino project page">
<link rel="section" href="#language" title="Language">
<link rel="section" href="#deprec" title="Deprecated Language Features">
<link rel="section" href="#versions" title="JavaScript Language Versions">
<link rel="section" href="#security" title="Security">
</head> </head>
<body bgcolor="#FFFFFF">
<center> <body>
<h1>
Rhino Overview</h1></center>
<h3> <p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>JavaScript Overview</strong></p>
Overview of Rhino</h3>
Most people who have used JavaScript before have done so by adding scripts <h1 style="text-align: center;">Rhino Overview</h1>
<h2>Overview of Rhino</h2>
<p>Most people who have used JavaScript before have done so by adding scripts
to their HTML web pages. However, Rhino is an implementation of the core to their HTML web pages. However, Rhino is an implementation of the core
language only and doesn't contain objects or methods for manipulating HTML language only and doesn't contain objects or methods for manipulating HTML
documents. documents.</p>
<p>Rhino contains <p>Rhino contains</p>
<ul> <ul>
<li> <li>All the features of JavaScript 1.5</li>
All the features of JavaScript 1.5</li> <li>Allows direct scripting of Java</li>
<li>A JavaScript shell for executing JavaScript scripts</li>
<li> <li>A JavaScript compiler to transform JavaScript source files into Java class
Allows direct scripting of Java</li>
<li>
A JavaScript shell for executing JavaScript scripts</li>
<li>
A JavaScript compiler to transform JavaScript source files into Java class
files</li> files</li>
</ul> </ul>
<h3> <h2><a name="language" id="language">Language</a></h2>
Language</h3> <p>The JavaScript language itself is standardized by Standard ECMA-262
The JavaScript language itself is standardized by Standard ECMA-262 <i>ECMAScript: <i>ECMAScript: A general purpose, cross-platform programming language</i>.
A general purpose, cross-platform programming language</i>. Rhino 1.5 implements Rhino 1.5 implements JavaScript 1.5, which conforms to Edition 3 of
JavaScript 1.5, which conforms to Edition 3 of the Standard. The Standard the Standard. The Standard may be <a class="ex-ref" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">downloaded</a>
may be <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">downloaded</a> or or obtained by mail from</p>
obtained by mail from ECMA, 114 Rue du Rh&ocirc;ne, CH1204 Geneva, Switzerland.
<p>Rhino 1.6 also implements ECMA-357 <i>ECMAScript for XML (E4X)</i>. See the <a href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">specification</a> for more information on the standard, and <a href="rhino16R1.html#E4X">Rhino version 1.6R1</a> for details on the implementation in Rhino. <address>ECMA,<br>
114 Rue du Rh&ocirc;ne,<br>
CH1204 Geneva,
<br>Switzerland.</address>
<p>Rhino 1.6 also implements ECMA-357 <i>ECMAScript for XML (E4X)</i>.
See the <a class="ex-ref" href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">specification</a>
for more information on the standard, and
<a href="rhino16R1.html#E4X">Rhino version 1.6R1</a> for details on
the implementation in Rhino.</p>
<p>In addition, Rhino has implemented JavaAdapters, which allows JavaScript <p>In addition, Rhino has implemented JavaAdapters, which allows JavaScript
to implement any Java interface or extend any Java class with a JavaScript to implement any Java interface or extend any Java class with a JavaScript
object. See the <tt>enum.js</tt> example for more information. object. See the <code class="filename">enum.js</code> example for more
<p>Numerous books and tutorials on JavaScript are available. information.</p>
<br>&nbsp; <p>Numerous books and tutorials on JavaScript are available.</p>
<br>&nbsp;
<h3> <h3><a name="deprec" id="deprec">Deprecated Language Features</a></h3>
Deprecated Language Features</h3> <p>Several language features introduced in JavaScript 1.2 are now deprecated.
Several language features introduced in JavaScript 1.2 are now deprecated.
These features allow "computational reflection": that is, the ability for These features allow "computational reflection": that is, the ability for
a script to determine and influence aspects of the way it is evaluated. a script to determine and influence aspects of the way it is evaluated.
These features are generally not broadly useful, yet they impose significant These features are generally not broadly useful, yet they impose significant
@ -93,92 +108,90 @@ constraints on implementations that hamper or prevent optimization. The
deprecated features are the <tt>__proto__</tt> and <tt>__parent__</tt> deprecated features are the <tt>__proto__</tt> and <tt>__parent__</tt>
properties, and the constructors <tt>With</tt>, <tt>Closure</tt>, and <tt>Call</tt>. properties, and the constructors <tt>With</tt>, <tt>Closure</tt>, and <tt>Call</tt>.
Attempts to invoke these constructors with the language version 1.4 will Attempts to invoke these constructors with the language version 1.4 will
result in an error. For other versions, a warning will be generated. result in an error. For other versions, a warning will be generated.</p>
<br>&nbsp;
<br>&nbsp; <h3>Internationalization</h3>
<h3> <p>The messages reported by the JavaScript engine are by default retrieved
Internationalization</h3> from the property file <code class="filename">org/mozilla/javascript/resources/Messages.properties</code>.
The messages reported by the JavaScript engine are by default retrieved
from the property file <tt>org/mozilla/javascript/resources/Messages.properties</tt>.
If other properties files with extensions corresponding to the current If other properties files with extensions corresponding to the current
locale exist, they will be used instead. locale exist, they will be used instead.</p>
<br>&nbsp;
<br>&nbsp; <h3><a name="versions" id="versions">JavaScript Language Versions</a></h3>
<h3> <p>Some behavior in the JavaScript engine is dependent on the
<a NAME="versions"></a>JavaScript Language Versions</h3> language version. In browser embeddings, this language version is selected
Some behavior in the JavaScript engine is dependent on the language version. using the LANGUAGE attribute of the SCRIPT tag with values such as
In browser embeddings, this language version is selected using the LANGUAGE "JavaScript1.2". <p>Version 1.3 and greater are ECMA conformant.</p>
attribute of the SCRIPT tag with values such as "JavaScript1.2". <p><b>Operators <tt>==</tt> and <tt>!=</tt></b></p>
<p>Version 1.3 and greater are ECMA conformant.
<p><b>Operators <tt>==</tt> and <tt>!=</tt></b>
<p>Version 1.2 only uses strict equality for the == and != operators. In <p>Version 1.2 only uses strict equality for the == and != operators. In
version 1.3 and greater, == and != have the same meanings as ECMA. The version 1.3 and greater, == and != have the same meanings as ECMA. The
operators === and !== use strict equality in all versions. operators === and !== use strict equality in all versions.</p>
<p><b>ToBoolean</b> <p><b>ToBoolean</b></p>
<p><tt>Boolean(new Boolean(false))</tt> is false for all versions before <p><tt>Boolean(new Boolean(false))</tt> is false for all versions before
1.3. It is true (and thus ECMA conformant) for version 1.3 and greater. 1.3. It is true (and thus ECMA conformant) for version 1.3 and greater.
<p><b>Array.prototype.toString and Object.prototype.toString</b> <p><b>Array.prototype.toString and Object.prototype.toString</b>
<p>Version 1.2 only returns array or object literal notation ("[1,2,3]" <p>Version 1.2 only returns array or object literal notation ("[1,2,3]"
or "{a:1, b:2}" for example). In version 1.3 and greater these functions or "{a:1, b:2}" for example). In version 1.3 and greater these functions
are ECMA conformant. are ECMA conformant.</p>
<p><b>Array constructor</b> <p><b>Array constructor</b></p>
<p><tt>Array(i)</tt> for a number argument <tt>i</tt> constructs an array <p><code>Array(i)</code> for a number argument <var>i</var> constructs an
with a single element equal to <tt>i</tt> for version 1.2 only. Otherwise array with a single element equal to <var>i</var> for version 1.2 only.
the ECMA conformant version is used (an array is constructed with no elements Otherwise the ECMA conformant version is used (an array is constructed
but with length property equal to <tt>i</tt>). with no elements but with length property equal to <var>i</var>).</p>
<p><b>String.prototype.substring</b> <p><b>String.prototype.substring</b></p>
<p>For version 1.2 only, the two arguments are not swapped if the first <p>For version 1.2 only, the two arguments are not swapped if the first
argument is less than the second one. All other versions are ECMA compliant. argument is less than the second one. All other versions are ECMA compliant.
<p><b>String.prototype.split</b> <p><b>String.prototype.split</b></p>
<p>For version 1.2 only, split performs the Perl4 special case when given <p>For version 1.2 only, split performs the Perl4 special case when given
a single space character as an argument (skips leading whitespace, and a single space character as an argument (skips leading whitespace, and
splits on whitespace). All other versions split on the space character splits on whitespace). All other versions split on the space character
proper as specified by ECMA. proper as specified by ECMA.</p>
<br>&nbsp;
<br>&nbsp; <h2><a name="security" id="security">Security</a></h2>
<h3> <p>The security features in Rhino provide the ability to track the origin
Security</h3>
The security features in Rhino provide the ability to track the origin
of a piece of code (and any pieces of code that it may in turn generate). of a piece of code (and any pieces of code that it may in turn generate).
These features allow for the implementation of a traditional URL-based These features allow for the implementation of a traditional URL-based
security policy for JavaScript as in Netscape Navigator. Embeddings that security policy for JavaScript as in Netscape Navigator. Embeddings that
trust the JavaScript code they execute may ignore the security features. trust the JavaScript code they execute may ignore the security features.</p>
<p>Embeddings that run untrusted JavaScript code must do two things to <p>Embeddings that run untrusted JavaScript code must do two things to
enable the security features. First, every <tt>Context</tt> that is created enable the security features. First, every <code>Context</code> that is
must be supplied an instance of an object that implements the <tt>SecuritySupport</tt> created must be supplied an instance of an object that implements the
interface. This will provide Rhino the support functionality it needs to <tt>SecuritySupport</tt> interface. This will provide Rhino the support
perform security-related tasks. functionality it needs to perform security-related tasks.</p>
<p>Second, the value of the property <tt>security.requireSecurityDomain</tt>
should be changed to <tt>true</tt> in the resource bundle <tt>org.mozilla.javascript.resources.Security</tt>. <p>Second, the value of the property
<code class="filename">security.requireSecurityDomain</code>
should be changed to <var>true</var> in the resource bundle <code class="filename">org.mozilla.javascript.resources.Security</code>.
The value of this property can be determined at runtime by calling the The value of this property can be determined at runtime by calling the
<tt>isSecurityDomainRequired</tt> <code>isSecurityDomainRequired</code>
method of <tt>Context</tt>. Setting this property to true requires that method of <code>Context</code>. Setting this property to true requires that
any calls that compile or evaluate JavaScript must supply a security domain any calls that compile or evaluate JavaScript must supply a security domain
object of any object type that will be used to identify JavaScript code. object of any object type that will be used to identify JavaScript code.
In a typical client embedding, this object might be a string with the URL In a typical client embedding, this object might be a string with the URL
of the server that supplied the script, or an object that contains a representation of the server that supplied the script, or an object that contains a
of the signers of a piece of code for certificate-based security policies. representation of the signers of a piece of code for certificate-based
security policies.</p>
<p>When JavaScript code attempts a restricted action, the security domain <p>When JavaScript code attempts a restricted action, the security domain
can be retrieved in the following manner. The class context should be obtained can be retrieved in the following manner. The class context should be
from the security manager (see <tt>java.lang.SecurityManager.getClassContext()</tt>). obtained from the security manager (see <code class="command">java.lang.SecurityManager.getClassContext()</code>).
Then, the class of the code that called to request the restricted action Then, the class of the code that called to request the restricted action
can be obtained by looking an appropriate index into the class context can be obtained by looking an appropriate index into the class context
array. If the caller is JavaScript the class obtained may be one of two array. If the caller is JavaScript the class obtained may be one of two
types. First, it may be the class of the interpreter if interpretive mode types. First, it may be the class of the interpreter if interpretive mode
is in effect. Second, it may be a generated class if classfile generation is in effect. Second, it may be a generated class if classfile generation
is supported. An embedding can distinguish the two cases by calling <tt>isInterpreterClass()</tt> is supported. An embedding can distinguish the two cases by calling
in the <tt>Context</tt> class. If it is the interpreter class, call the <code class="command">isInterpreterClass()</code>
getInterpreterSecurityDomain() method of Context to obtain the security in the <code class="filename">Context</code> class. If it is the
domain of the currently executing interpreted script or function. Otherwise, interpreter class, call the getInterpreterSecurityDomain() method of
it must be a generated class, and an embedding can call <tt>getSecurityDomain()</tt> Context to obtain the security domain of the currently executing
in the class implementing interpreted script or function. Otherwise, it must be a generated class,
<tt>SecuritySupport</tt>. When the class was and an embedding can call <code class="command">getSecurityDomain()</code>
in the class implementing <code>SecuritySupport</code>. When the class was
defined and loaded, the appropriate security domain was associated with defined and loaded, the appropriate security domain was associated with
it, and can be retrieved by calling this method. Once the security domain it, and can be retrieved by calling this method. Once the security domain
has been determined, an embedding can perform whatever checks are appropriate has been determined, an embedding can perform whatever checks are
to determine whether access should be allowed. appropriate to determine whether access should be allowed.</p>
<p>
<hr WIDTH="100%">
<br><a href="index.html">back to top</a>
</body> </body>
</html> </html>

Просмотреть файл

@ -32,86 +32,123 @@
- -
- ***** END LICENSE BLOCK ***** --> - ***** END LICENSE BLOCK ***** -->
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head> <html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Norris Boyd"> <head>
<meta name="GENERATOR" content="Mozilla/4.5 [en]C-NSCP (WinNT; I) [Netscape]">
<title>Performance Hints</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> <meta http-equiv="Content-Language" content="en">
<body bgcolor="#FFFFFF"> <meta http-equiv="Content-Style-Type" content="text/css">
<meta name="Author" content="Norris Boyd">
<title>Performance Hints</title>
<link rel="up" href="./" title="Rhino project page">
<link rel="section" href="#varstatements" title="Var statements">
<link rel="section" href="#arrays" title="Arrays">
<link rel="section" href="#eval" title="eval">
<link rel="section" href="#with" title="with">
</head>
<body>
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> &gt; <strong>Performance Hints</strong></p>
<h1 style="text-align: center;">Performance Hints</h1>
<h3><a name="varstatements" id="varstatements"><code>var</code> Statements</a></h3>
<p>Use <code>var</code> statements when possible. Not only is it good
programming practice, it can speed up your code by allowing the compiler
to generate special code to access the variables. For example, you could
rewrite</p>
<pre class="code">
function sum(a) {
result = 0;
for (i=0; i &lt; a.length; i++)
result += a[i];
return result;
}
</pre>
<p>as</p>
<pre class="code">
function sum(a) {
var result = 0;
for (var i=0; i &lt; a.length; i++)
result += a[i];
return result;
}
</pre>
<center>
<h1>
Performance Hints</h1></center>&nbsp;
<h3>
<tt>var</tt> Statements</h3>Use <tt>var</tt> statements when possible. Not only is it good
programming practice, it can speed up your code by allowing the compiler to
generate special code to access the variables. For example, you could rewrite
<p><tt>function sum(a) {</tt>
<br><tt>&nbsp;&nbsp;&nbsp; result = 0;</tt>
<br><tt>&nbsp;&nbsp;&nbsp; for (i=0; i &lt;
a.length; i++)</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result += a[i];</tt>
<br><tt>&nbsp;&nbsp;&nbsp; return result;</tt>
<br><tt>}</tt>
<p>as
<p><tt>function sum(a) {</tt>
<br><tt>&nbsp;&nbsp;&nbsp; var result = 0;</tt>
<br><tt>&nbsp;&nbsp;&nbsp; for (var i=0; i
&lt; a.length; i++)</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result += a[i];</tt>
<br><tt>&nbsp;&nbsp;&nbsp; return result;</tt>
<br><tt>}</tt>
<p>This is not equivalent code because the second version does <p>This is not equivalent code because the second version does
not modify global variables <tt>result</tt> and <tt>i</tt>. However, if you don't intend for any other function to not modify global variables <code>result</code> and <code>i</code>.
access these variables, then storing them globally is probably wrong anyway However, if you don't intend for any other function to access these
(what if you called another function that had a loop like the one in <tt>sum</tt>!). variables, then storing them globally is probably wrong anyway
<br>&nbsp; (what if you called another function that had a loop like the one
<h3> in <code>sum</code>!).</p>
Arrays</h3>Use the forms of the Array constructor that
specify a size or take a list of initial elements. For example, the code <h3><a name="arrays" id="arrays">Arrays</a></h3>
<p><tt>var a = new Array();</tt>
<br><tt>for (var i=0; i &lt; n; i++)</tt> <p>Use the forms of the Array constructor that specify a size or
<br><tt>&nbsp;&nbsp;&nbsp; a[i] = i;</tt> take a list of initial elements. For example, the code</p>
<p>could be sped up by changing the constructor call to <tt>new Array(n)</tt>. A constructor call like that indicates to
the runtime that a Java array should be used for the first <i>n</i> entries of the array. Similarly, <pre class="code">
<tt>new var a = new Array();
Array(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;)</tt> or <tt>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</tt> will cause a 3-element for (var i=0; i &lt; n; i++)
Java array to be allocated to hold the contents of the JavaScript array. a[i] = i;
<br>&nbsp; </pre>
<br>&nbsp;
<h3> <p>could be sped up by changing the constructor call to
<tt>eval</tt> and <tt>new Function</tt></h3>Avoid calling <tt>eval</tt> when <code>new Array(n)</code>. A constructor call like that indicates
possible. Calls to <tt>eval</tt> are slow because the script to the runtime that a Java array should be used for the first
being executed must be compiled. Constructing a new function object can be slow <var>n</var> entries of the array. Similarly,<br><br>
for the same reason, while function expressions are more efficient because the <code>new Array(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;)</code><br>
function can be compiled. For example, the code or<br>
<p><tt>function MyObject(a) {</tt> <code>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</code><br><br>
<br><tt>&nbsp;&nbsp;&nbsp; this.s = a;</tt> will cause a 3-element Java array to be allocated to hold the
<br><tt>&nbsp;&nbsp;&nbsp; this.toString = new contents of the JavaScript array.</p>
Function(&quot;return this.s&quot;);</tt>
<br><tt>}</tt> <h3><a name="eval" id="eval"><code>eval</code> and <code>new Function</code></a></h3>
<p>could be written more efficiently as
<p><tt>function MyObject(a) {</tt> <p>Avoid calling <code>eval</code> when possible. Calls to
<br><tt>&nbsp;&nbsp;&nbsp; this.s = a;</tt> <code>eval</code> are slow because the script being executed must
<br><tt>&nbsp;&nbsp;&nbsp; this.toString = be compiled. Constructing a new function object can be slow for
function () { return this.s }</tt> the same reason, while function expressions are more efficient
<br><tt>}</tt> because the function can be compiled. For example, the code</p>
<p>Beginning with Rhino 1.4 Release 2, code
passed to eval and new Function will be interpreted rather than compiled to <pre class="code">
class files. function MyObject(a) {
<br>&nbsp;</p> this.s = a;
<h3> this.toString = new Function(&quot;return this.s&quot;);
with</h3>Using the <tt>with</tt> }
statement prevents the compiler from generating code for fast access to local </pre>
variables. You're probably better off explicitly accessing any properties of the
object. <p>could be written more efficiently as</p>
<br>&nbsp;
<p> <pre class="code">
<hr WIDTH="100%"> function MyObject(a) {
<br><a href="index.html">back to top</a> this.s = a;
<br> this.toString = function () { return this.s }
}
</pre>
<p>Beginning with Rhino 1.4 Release 2, code passed to eval and
new Function will be interpreted rather than compiled to class
files.</p>
<h3><a name="with" id="with"><code>with</code></a></h3>
<p>Using the <code>with</code> statement prevents the compiler
from generating code for fast access to local variables. You're
probably better off explicitly accessing any properties of the
object.</p>
</body> </body>
</html> </html>