mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
137 lines
5.9 KiB
HTML
137 lines
5.9 KiB
HTML
<!-- ***** BEGIN LICENSE BLOCK *****
|
|
- Version: MPL 1.1/GPL 2.0
|
|
-
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
- the License. You may obtain a copy of the License at
|
|
- http://www.mozilla.org/MPL/
|
|
-
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
- for the specific language governing rights and limitations under the
|
|
- License.
|
|
-
|
|
- The Original Code is Rhino code, released May 6, 1999.
|
|
-
|
|
- The Initial Developer of the Original Code is
|
|
- Netscape Communications Corporation.
|
|
- Portions created by the Initial Developer are Copyright (C) 1997-1999
|
|
- the Initial Developer. All Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
-
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
- the GNU General Public License Version 2 or later (the "GPL"), in which
|
|
- case the provisions of the GPL are applicable instead of those above. If
|
|
- you wish to allow use of your version of this file only under the terms of
|
|
- the GPL and not to allow others to use your version of this file under the
|
|
- MPL, indicate your decision by deleting the provisions above and replacing
|
|
- them with the notice and other provisions required by the GPL. If you do
|
|
- not delete the provisions above, a recipient may use your version of this
|
|
- file under either the MPL or the GPL.
|
|
-
|
|
- ***** END LICENSE BLOCK ***** -->
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<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>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>
|
|
|
|
<body>
|
|
|
|
<p class="crumbs"><em>You are here:</em> <a href="./">Rhino project page</a> > <strong>JavaScript Requirements and Limitations</strong></p>
|
|
|
|
<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,
|
|
Rhino must be running under a security manager that allows the definition
|
|
of class loaders.</p>
|
|
|
|
<h2><a name="limitations" id="limitations">Limitations</a></h2>
|
|
|
|
<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
|
|
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
|
|
internal errors for some generated class files.</p>
|
|
<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
|
|
example, accessing
|
|
<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 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:
|
|
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 Math object's pow method.</p>
|
|
<p>IBM Java for Linux version "JDK 1.1.8 IBM build l118-19991013 (JIT
|
|
enabled: jitc)" has errors in java.lang.Math.pow that are reflected
|
|
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
|
|
as test failures in the JavaScript Math object's atan2 method.</p>
|
|
|
|
<h3><a name="liveconnect" id="liveconnect">LiveConnect</a></h3>
|
|
<p>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:</p>
|
|
|
|
<pre class="code">
|
|
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
|
|
may report a date for the daylight savings changeover that is a week off.
|
|
JRE 1.1.6 reports the correct date.</p>
|
|
<p>Under the 1.1.6 JRE, evaluating <code class="command">(new Date(1998, 9, 25, 2)).toString()</code>
|
|
returns:</p>
|
|
<pre class="code"> Sun Oct 25 02:00:00 GMT-0800 (PST) 1998
|
|
</pre>
|
|
<p>Earlier versions may return:</p>
|
|
<pre class="code"> Sun Oct 25 02:00:00 GMT-0700 (PDT) 1998
|
|
</pre>
|
|
<p>(the JRE doesn't report the changeover until Nov. 1.)</p>
|
|
<p>The Microsoft SDK 3.1 for Java also exhibits this problem.</p>
|
|
|
|
</body>
|
|
</html>
|