Граф коммитов

421 Коммитов

Автор SHA1 Сообщение Дата
norris%netscape.com ff977ce6cd fix NullPointerException 2000-03-16 22:43:03 +00:00
norris%netscape.com f9ed21e9a7 clean up regressions in test suite from last fix 2000-03-15 19:40:53 +00:00
norris%netscape.com 27bba05faa Fix regressions caused by support for function expression statements. 2000-03-15 17:18:12 +00:00
norris%netscape.com 3c721d3a11 31251 NervousText.js applet doesn't work 2000-03-14 01:20:45 +00:00
beard%netscape.com fbc3531947 added mozilla/js/rhino/org/mozilla/javascript/tools/jsc/Main.java 2000-03-14 00:24:23 +00:00
norris%netscape.com abdd921231 generalize on number of threads, add synchronization point so test case behaves as advertised 2000-03-13 21:45:02 +00:00
norris%netscape.com 5726b14bcc Implement distinction between function statements, function expressions, and function expression-statements. 2000-03-13 18:27:42 +00:00
norris%netscape.com 879940613f Fix 31639 Oldstyle Java property method names no longer work with defineClass 2000-03-13 17:12:36 +00:00
norris%netscape.com 66de3cd3ca Make Wrapper an API class. 2000-03-10 20:55:36 +00:00
rginda%netscape.com d4f8429909 Removing debug output 2000-03-10 19:06:36 +00:00
mccabe%netscape.com 98328c4bf4 Replace some ternary expressions
step += (InLeapYear(t) ? 29 : 28);

with the form

    if (InLeapYear(t))
        step += 29;
    else
        step += 28;

to work around an apparent JRE bug in which the code always returns 28.
2000-03-10 02:05:41 +00:00
beard%netscape.com 032380c1b3 now includes all of the optimizer classes 2000-03-10 01:05:28 +00:00
norris%netscape.com 86a0519973 javadoc comment. 2000-03-10 01:03:59 +00:00
beard%netscape.com c23475c1ca imports js.mcp.xml into js-all.mcp 2000-03-10 01:03:58 +00:00
norris%netscape.com 199f666ef8 Fix command line 2000-03-09 23:33:06 +00:00
norris%netscape.com 122be924b1 Add html page for the NervousText applet. 2000-03-09 23:06:54 +00:00
norris%netscape.com 530119248e Fixes for NervousText example. 2000-03-09 21:50:14 +00:00
norris%netscape.com 5d42d30699 Try to fix Solaris/Linux failures. 2000-03-09 21:46:42 +00:00
rogerl%netscape.com 2723ceea9b Put NonGreedy back in. 2000-03-09 02:39:58 +00:00
rogerl%netscape.com 3cb2d2174b Fixed handling of {1,} quantifiers 2000-03-08 01:24:55 +00:00
rogerl%netscape.com 4bbd0fa59e Reduced stack usage for greedy matching. 2000-03-08 01:08:32 +00:00
norris%netscape.com cd66c924c2 Clean up debugging interfaces. 2000-03-03 21:46:44 +00:00
norris%netscape.com 1f65a6474f Clean up examples to use current jsFunction_ and jsGet_ method forms. 2000-03-03 19:15:51 +00:00
rogerl%netscape.com a4f173e8ff Added lineTerminator test back into \s & \S atoms 2000-03-03 19:07:16 +00:00
norris%netscape.com 1562a17939 Fix js1_2/function/Function_object.js 2000-03-03 17:18:49 +00:00
rogerl%netscape.com 95c0fa78cd Switch to using new DToA stuff for numberToString(). 2000-03-02 00:30:01 +00:00
rogerl%netscape.com 27bf8b62c9 Fix endian bug for BigInteger constructor. 2000-03-01 23:25:23 +00:00
rogerl%netscape.com ef2e5e54d8 Hmm, better do that negate. 2000-03-01 22:20:48 +00:00
rogerl%netscape.com 748b87a17e Oops, remove debugging hack. 2000-03-01 22:20:09 +00:00
rogerl%netscape.com a008ae5e92 Fixing Unicode ECMA 3 compliance issues 2000-03-01 22:15:35 +00:00
rogerl%netscape.com e151b3c183 Fixing Unicode ECMA 3 compliance issues.
Fixed bug in $ handling for ECMA 3 (don't support \$)
2000-03-01 22:14:34 +00:00
norris%netscape.com 5f47eeafb0 Fix bug 6063. 2000-03-01 21:35:38 +00:00
norris%netscape.com b83c29fdca Switch back to using getDeclaredMethods--I was able to get it working with a
security manager.
2000-03-01 18:26:43 +00:00
beard%netscape.com 08212e4ea0 importable XML project file for CWPro5 (with CWPro4 Java Tools) 2000-03-01 01:12:20 +00:00
beard%netscape.com fa18215c91 CWPro5 format project (using CWPro4 Java tools). 2000-03-01 01:00:38 +00:00
beard%netscape.com f110483063 added LazilyLoadedCtor.java 2000-03-01 00:57:29 +00:00
norris%netscape.com 6263da13e6 1. Implement a new method of Context that allows embedders to disable or clear cached items
2. Change from using Class.getDeclaredMethods to Class.getMethods since the former may cause
   security problems. Implement a cache to ameleorate the possible performance degredation.
3. Add a new class to lazily load constructors to improve performance
2000-02-29 21:35:45 +00:00
norris%netscape.com 892c58dabf Remove reference to parent scope for Java methods. This was resulting in dangling
references that were never released to a large pool of objects.
2000-02-29 17:27:56 +00:00
norris%netscape.com 27fe170e77 Guard against possible NullPointerException if the Context has not been properly entered. 2000-02-28 18:40:34 +00:00
norris%netscape.com b3abf5ad73 Some users with JDK 1.1 but JDK 1.2 security were getting NullPointerExceptions here. 2000-02-28 18:38:37 +00:00
norris%netscape.com 878bf1fad6 Fix warning. 2000-02-28 18:32:19 +00:00
norris%netscape.com b7b070831b Generalize error test to catch any catches appearing after a catch-all. 2000-02-28 18:28:45 +00:00
norris%netscape.com c66aafca3a Enable catchguard with new 'if' syntax.
Implement check.
2000-02-24 19:35:22 +00:00
rogerl%netscape.com b7638d4d26 Ported toFixed, toExponential & toPrecision to NativeNumber from C sources. 2000-02-23 18:46:36 +00:00
norris%netscape.com 97b2229648 Fix wrapping of InvocationTargetException. Thanks to Kurt Westerfeld for pointing this out. 2000-02-18 17:38:11 +00:00
norris%netscape.com 0a702e28d6 Add equals() and equalsIgnoreCase() to the String object, at the suggestion of Tom Beauvais <tbeauvais@bowstreet.com> 2000-02-18 17:37:27 +00:00
rogerl%netscape.com d72f2d137f Added decode/encode URI handling. 2000-02-18 00:22:02 +00:00
norris%netscape.com 7c93fc996d Fix cases of LiveConnected classes that have a field and methods with the same name.
Also clean up Bean properties, making implementation more efficient.
2000-02-17 22:32:37 +00:00
norris%netscape.com dd21b7e32d Remove untrue comment. 2000-02-17 22:31:43 +00:00
norris%netscape.com aefac0c5f0 Update implementation version. 2000-02-17 22:31:16 +00:00
norris%netscape.com b73bd41b86 Add support for dynamic scopes and fix remaining test failures in the tip. 2000-02-16 17:40:53 +00:00
norris%netscape.com 2029e26895 Avoid static never-released reference to streams; causes problems for Patrick Beard's use of the shell. 2000-02-15 17:08:31 +00:00
norris%netscape.com 711b1a24cc Fix contributors list. 2000-02-15 00:09:58 +00:00
beard%netscape.com 8068795290 added DTOA.java 2000-02-09 23:15:27 +00:00
rogerl%netscape.com 04e79bc44a Changed implementation of toString(<base>) to use Waldemar's code from
SpiderMonkey.
2000-02-09 19:52:31 +00:00
norris%netscape.com 80ced8d288 Remove unused private method. 2000-01-31 18:49:07 +00:00
norris%netscape.com b49fb2bee4 Propagate changes from Rhino150R1_BRANCH. 2000-01-27 17:35:29 +00:00
norris%netscape.com e32e0ceabf Propagate changes from 1.5 branch. 2000-01-26 18:57:00 +00:00
beard%netscape.com ffb65b9c0b changed all "try { s = (Scriptable) obj; } catch (ClassCastException e) {...}" to "if (obj instanceof Scriptable) { ... }". This will generally be more efficient NOT to use exception handling where instanceof will do. 2000-01-22 04:41:30 +00:00
beard%netscape.com 8210812d99 fix case for anonymous functions. 2000-01-22 03:28:04 +00:00
norris%netscape.com ef65d489ce Fix ecma_3/ExecutionContexts/10.1.3.js
r=rogerl
2000-01-20 20:59:56 +00:00
rogerl%netscape.com 7253eff213 Bug #24023, infinite loop in interpreter when catch clause has a throw.
This was caused by a previous bug fix in which I moved the try stack
decrement to the end of the catch clause because it was getting skipped
by the final statement in the try block (which is always a goto around the
catch block). Better is to make sure the endTry is the statment just before
that goto, and do the try stack decrement in the catch the way god intended.
2000-01-19 22:50:27 +00:00
rogerl%netscape.com 03f7fd3c7a Bug #23609 - optimization in IRFactory for post-increment was incomplete. 2000-01-19 19:32:45 +00:00
norris%netscape.com 45e50c92ec Fix icode printing for call opcodes. 2000-01-19 18:38:42 +00:00
norris%netscape.com ea827c112d Propagate fix from branch. 2000-01-06 16:28:43 +00:00
rogerl%netscape.com 783fd83ec9 Need to update the value of newly created closure. 1999-12-24 00:49:44 +00:00
rogerl%netscape.com 81a5119396 Clean-up message text 1999-12-23 00:16:07 +00:00
norris%netscape.com 9f5f5b9010 Fix Counter example. 1999-12-16 22:49:50 +00:00
norris%netscape.com af3dc99891 Make it possible to report multiple errors. 1999-12-16 18:47:27 +00:00
norris%netscape.com 9bfc309105 Remove unused member variable. 1999-12-09 23:37:18 +00:00
beard%netscape.com 5036447688 fixes case where an InterpretedFunction has both a closure and needs an activation. 1999-12-09 22:05:09 +00:00
rogerl%netscape.com 14f48a28d6 smaller faster better - it'll probably burn up on entry. 1999-12-09 00:26:09 +00:00
rogerl%netscape.com 2d5d12f031 Added 'flat' argument to NewRegExp to force literal interpretation of
entire string.
1999-12-08 01:48:03 +00:00
rogerl%netscape.com da6ac159a6 Needed a quick-and-dirty constructor from a string. 1999-12-08 01:47:13 +00:00
rogerl%netscape.com d038781fa8 Added 'flat' argument to NewRegExp to force literal interpretation of
entire string.
Fixed String.replace to not coerce first arg to regexp.
Fixed behaviour of replace w.r.t. $
1999-12-08 01:46:43 +00:00
rogerl%netscape.com ed43b28960 Added 'flat' argument to NewRegEXp to force literal interpretation of
entire string.
1999-12-08 01:44:08 +00:00
norris%netscape.com e9d1f871b7 Fix ecma_3/ExecutionContexts/10.1.4-1.js 1999-12-06 19:03:21 +00:00
beard%netscape.com b930468a1d removed NativeClosure.java. 1999-12-04 00:32:16 +00:00
norris%netscape.com 33535e3b14 Fix instanceof. 1999-12-04 00:21:41 +00:00
norris%netscape.com 3c8d260145 eval() called indirectly should throw an EvalError 1999-12-03 23:44:58 +00:00
norris%netscape.com aeab7546b9 Fix ecma_2/Exceptions/exception-006.js 1999-12-03 23:32:46 +00:00
norris%netscape.com 6213e7ae3f Fix regressions. 1999-12-03 21:50:42 +00:00
rogerl%netscape.com 0f9eca4866 Switch to ECMA error. 1999-12-03 02:58:29 +00:00
rogerl%netscape.com 4c286f0250 Don't let Undefined prototype be assigned to new objects, revert to Object
instead. Also, detect Undefined prototype in hasInstance and bail.
1999-12-03 00:10:36 +00:00
norris%netscape.com 51068bf196 Fix the following bug:
Subject:
            Rhino request URGENT
       Date:
            Thu, 02 Dec 1999 15:58:40 -0500
      From:
            slobo@espialgroup.com
        To:
            Norris Boyd <norris@netscape.com>
 References:
            1 , 2




Hello Norris

In Rhino, the following script gives the error : "function does not always return a value" during the parsing phase. The script
runs perfectly fine in Netscape 4.61. It is an urgent requirement. Many thanks in advance.

Steven

///////////////////////////////////////////////////////SCRIPT  BEGIN  ///////////////////////////////////////////////
function test (a) {
  this.arg = a;
  if (a>20)
        return;
  return this;
}

//print = alert;

function joe() {
a = new test (20);
print (a.arg);


a = new test (25);
print (a.arg);
}

joe();
///////////////////////////////////////////////////////SCRIPT   END  ///////////////////////////////////////////////
1999-12-03 00:04:46 +00:00
norris%netscape.com 136d21ac6f EvaluatorExceptions should set an exit error code. 1999-12-02 19:12:34 +00:00
norris%netscape.com 54912ce1a7 Pass a scope to ScriptRuntime.call so we can throw EcmaErrors if need be. 1999-12-02 18:17:22 +00:00
rogerl%netscape.com 68e586ec9e Added missing null scope parameter. 1999-12-02 01:33:22 +00:00
rogerl%netscape.com 2f671616d5 Passing scope down into parser/IRFactory/NodeTransformer so that syntax
errors can be packaged as ECMA Error objects.
1999-12-02 01:16:02 +00:00
rogerl%netscape.com e01b13c759 Bug #19980 - insist on curly-brace after catch block rather than just
accepting it - forces error that allows catch block to span lines for
interactive input.
1999-12-01 23:12:58 +00:00
norris%netscape.com 35ed67ffec Fix js1_3/regress/in-001.js 1999-12-01 18:43:12 +00:00
norris%netscape.com ec2aef2474 Fix test ecma_2/Exceptions/string-001.js 1999-12-01 18:05:49 +00:00
rogerl%netscape.com a5c0875b49 Call createFunctionObject on closure created InterpretedFunction objects
so they can be real JS objects like they're supposed to be -with prototypes
and everything.
1999-12-01 02:45:58 +00:00
norris%netscape.com 5ad67e721a anal: fix indentation 1999-11-30 23:54:51 +00:00
norris%netscape.com bb088da102 delete of non-reference just evaluates to true. 1999-11-23 17:36:17 +00:00
norris%netscape.com eadef0d104 Add ConversionError and make it work for undefined.foo. 1999-11-23 17:30:31 +00:00
norris%netscape.com bf8cbd877b Remove commented-out code. 1999-11-23 17:29:53 +00:00
norris%netscape.com 5a2dba3040 Fix formatting. 1999-11-23 17:29:34 +00:00
norris%netscape.com bce104a346 Fix test failures:
ecma_2/Exceptions/expression-020.js
js1_4/Regress/date-001-n.js
js1_4/Regress/toString-001-n.js
1999-11-22 23:48:06 +00:00
norris%netscape.com f3b2f0b638 Fix
Testcase ecma_2/Exceptions/expression-020.js failed
Failure messages were:
result = this.eval("NaN") (threw No exception thrown) = NaN FAILED! expected: Passed
1999-11-22 19:35:59 +00:00
norris%netscape.com 0343b19f7f 'thisArg' could be null, so use 'fun' for scope. 1999-11-22 19:35:20 +00:00
norris%netscape.com ca76b17037 Fix ecma_2/Expressions/instanceof-003-n.js
ScriptRuntime::instanceOf now needs a scope parameter that it can use to construct an exception object
1999-11-20 00:19:00 +00:00
norris%netscape.com eb298c15ba argument.caller shouldn't be defined in the default version 1999-11-19 23:02:52 +00:00
rginda%netscape.com 215c9fb617 * Global.java
Cleared global.exitCode in quit() just to be safe.
* Main.java
  Adjusted exit code constants to match the js and xpcshells.
1999-11-17 20:26:17 +00:00
norris%netscape.com 0bc8473ac6 Make -f semantics match those of the C engine. 1999-11-17 00:04:17 +00:00
norris%netscape.com cc086cb5fe Add contributor. 1999-11-16 23:58:11 +00:00
norris%netscape.com 607deed027 rginda's changes for having quit() take an exit code. 1999-11-16 23:57:23 +00:00
rogerl%netscape.com 37cda6d0ce Removed NativeClosure 1999-11-09 18:24:40 +00:00
norris%netscape.com 025bfe6158 Fix 18229: Bogus class file names being generated on Windows 1999-11-08 17:24:10 +00:00
norris%netscape.com a4e924fe2a Unify evaluation code to improve consistency and improve code size. 1999-11-05 22:18:24 +00:00
norris%netscape.com 38a8ca4e67 Remove JSuncaughtExceptionLine, use an error reporter to report line number info instead. 1999-11-05 21:48:05 +00:00
norris%netscape.com 8ad5772c17 Improve performance of the non-error call code. 1999-11-05 21:23:10 +00:00
rogerl%netscape.com 17f55ab4a6 Removed - not an ECMA thing and supplanted by a different mechanism. 1999-11-04 00:01:00 +00:00
rogerl%netscape.com 448bd845c0 Fix back-reference parsing from going too far in source string 1999-11-04 00:00:14 +00:00
rogerl%netscape.com a9e5d64d21 Replaced Closure object with FunctionObject clone 1999-11-03 23:59:35 +00:00
rogerl%netscape.com 97edcab2f0 Removed NativeClosure 1999-11-03 23:58:51 +00:00
rogerl%netscape.com cbb133796d Fix nested finally endless loop.
Replaced Closure object with FunctionObject clone.
1999-11-03 23:57:56 +00:00
rogerl%netscape.com 94ebb494f8 Add closure support 1999-11-03 23:56:28 +00:00
rogerl%netscape.com a474444e6a Removing NativeClosure 1999-11-03 23:55:59 +00:00
rogerl%netscape.com 5a9571975a Added Kurt Westerfeld's fix for 'undefined is not a function' message. 1999-11-02 22:52:10 +00:00
rogerl%netscape.com 485e507c0f More RegExp back reference specification mucking about. 1999-11-02 20:04:57 +00:00
rogerl%netscape.com babd0a87b2 Fixed up for Java vs. ECMA definitions in edge cases 1999-11-02 20:04:16 +00:00
norris%netscape.com 18cde77084 Fix spelling of contributor's name. 1999-10-28 17:43:43 +00:00
rogerl%netscape.com 18fd9855d1 Error message for apply argument type 1999-10-27 22:17:44 +00:00
rogerl%netscape.com 81c0d08d38 ECMA handling of undefined args for call & apply. 1999-10-27 22:17:05 +00:00
rogerl%netscape.com cc732387b7 Handle LINE & SOURCEFILE in dumpIcode
Fix bug in multiple try/catch clauses after a catch - the tryStackTop was
being decremented twice.
1999-10-27 22:16:15 +00:00
rogerl%netscape.com d935bcc715 Handle missing arg in match_or_replace 1999-10-27 22:14:46 +00:00
rogerl%netscape.com a5795eb216 ECMA specified handling of NaN inputs for max & min 1999-10-27 22:11:43 +00:00
rogerl%netscape.com 9bbac00b7f Subsumed ConversionError into TypeError 1999-10-27 22:10:36 +00:00
norris%netscape.com f568b465b6 Remove method duplication in NativeGlobal.
Add javadoc comments to EcmaError.
1999-10-26 17:22:23 +00:00
norris%netscape.com 272cd30a80 Get filename and line number into uncaught exception reports. 1999-10-26 17:06:12 +00:00
norris%netscape.com 67c18acd0c Add contributors. 1999-10-25 17:52:48 +00:00
norris%netscape.com 43d6dcf526 Add license text. 1999-10-25 17:41:49 +00:00
norris%netscape.com 608c323aba Add license boilerplate. 1999-10-25 17:36:20 +00:00
norris%netscape.com fa8870089d Should get ReferenceError exception for name not found. 1999-10-25 16:41:24 +00:00
norris%netscape.com 3b332c3835 Add contributors. 1999-10-25 16:40:30 +00:00
beard%netscape.com 923861d24d synched. 1999-10-22 22:39:51 +00:00
beard%netscape.com 71f6a206ac changed SharedGlobal.java to Global.java 1999-10-22 22:39:23 +00:00
norris%netscape.com b5bbaa31df Changes for improved errors-as-exceptions handling. 1999-10-22 22:02:58 +00:00
norris%netscape.com fc4ba15202 Use simpler, more widely applicable structure for global. Also avoids test failure for Function called as a function. 1999-10-22 22:00:21 +00:00
norris%netscape.com b29858df93 A NativeString object shouldn't be unwrapped to a primitive. 1999-10-22 21:58:54 +00:00
norris%netscape.com 079455f8ab Fix formatting. 1999-10-22 16:58:30 +00:00
norris%netscape.com 38c1cad9a0 Fix javadoc 1999-10-22 16:56:56 +00:00
norris%netscape.com 33f79a9fa4 Fixed bug. We weren't loading classes in bottom-up dependency order.
Subject:
            Re: another getClassLoader exception
       Date:
            Mon, 18 Oct 1999 22:01:24 -0400
      From:
            Andrew Wason <aw@softcom.com>
        To:
            norris@netscape.com (Norris Boyd)
        CC:
            Howard Lin <howard@softcom.com>
 References:
            1 , 2




At 05:03 PM 10/18/99 -0700, Norris Boyd wrote:
>Are you still seeing this problem?


Yes.  I just did a CVS update to get the latest stuff and we still have
this problem.

I wrote a standalone sample program that duplicates the problem.  Run
JSSupport and you should get this exception:

defineClass org.mozilla.javascript.gen.c2
Exception in thread "main" java.lang.NoClassDefFoundError:
org/mozilla/javascript/gen/c1
         at java.lang.ClassLoader.resolveClass0(Native Method)
         at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
         at
JSSupport$MySecuritySupport$DataClassLoader.loadClass(JSSupport.java:89)
         at JSSupport$MySecuritySupport.defineClass(JSSupport.java:47)
         at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java,
Compiled Code)
         at org.mozilla.javascript.Context.compile(Context.java:1761)
         at org.mozilla.javascript.Context.compile(Context.java:1691)
         at org.mozilla.javascript.Context.compileReader(Context.java:810)
         at org.mozilla.javascript.Context.evaluateReader(Context.java:725)
         at org.mozilla.javascript.Context.evaluateString(Context.java:692)
         at JSSupport.<init>(JSSupport.java:20)
         at JSSupport.main(JSSupport.java:9)



Andrew



>--N
>
>Andrew Wason wrote:
>
> > At 04:54 PM 10/12/99 -0700, Norris Boyd wrote:
> > >I just checked in changes so that the class calling ScriptRuntime (c5
> in your
> > >case) will load the class itself using the normal Java classloading
> mechanism
> > >rather than an explicit call to the class loader. I pushed the bits up
> to the
> > >ftp site, but it takes a bit to propagate.
> >
> > I get this exception now (debugging statements are from my code):
> >
> > SecuritySupport.defineClass org.mozilla.javascript.gen.c5
> > DataClassLoader.loadClass org.mozilla.javascript.gen.c5
> > DataClassLoader.loadClass org.mozilla.javascript.gen.c4
> > using default loader com.softcom.realjava.PluginClassLoader@da9486a0
> > java.lang.NoClassDefFoundError: org/mozilla/javascript/gen/c4
> >          at java.lang.ClassLoader.resolveClass0(Native Method)
> >          at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
> >          at
> >
> com.softcom.realjava.plugins.RealJavaScript$RealJavaScriptSecuritySupport$Da
> > taClassLoader.loadClass(RealJavaScript.java:410)
> >          at
> >
> com.softcom.realjava.plugins.RealJavaScript$RealJavaScriptSecuritySupport.de
> > fineClass(RealJavaScript.java:352)
> >          at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java,
> > Compiled Code)
> >          at org.mozilla.javascript.Context.compile(Context.java:1761)
> >          at org.mozilla.javascript.Context.compile(Context.java:1691)
> >          at org.mozilla.javascript.Context.compileReader(Context.java:810)
> >
> > So when c5 is being loaded by my SecuritySupport, it also needs to load c4.
> > I decompiled org.mozilla.javascript.gen.c5 and it's constant pool
> > references CLASS org.mozilla.javascript.gen.c4, so c5 is dependent on c4
> > being loadable.  Is the problem that c5 is being loaded before the
> > optimizer has defined c4?
> >
> > I get the above exception for some classes and not others.  It seems
> > consistent that I always get it for classes with dependencies on other
> > optimizer classes that haven't been generated yet.
> >
> > Andrew
> >
> > --
> > Andrew Wason
> > SoftCom, Inc.
> > aw@softcom.com

--
Andrew Wason
SoftCom, Inc.
aw@softcom.com



   JSSupport.java

                  Name:
                         JSSupport.java
                   Type:
                         Java Source File (text/java)
                Encoding:
                         base64
1999-10-19 16:38:23 +00:00
norris%netscape.com 8635d8f06a Fix following problem:
Subject:
        another getClassLoader exception
   Date:
        Tue, 12 Oct 1999 10:39:26 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com (Norris Boyd)
    CC:
        Howard Lin <howard@softcom.com>




Norris,

It looks like the classes the optimizer generates call
ScriptRuntime.defineFunction which calls getClassLoader.  This throws a
SecurityException.

java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader )
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java
, Compiled Code)
at java.security.AccessController.checkPermission(AccessController.java,
Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled
Code)
at java.lang.Class.getClassLoader(Class.java, Compiled Code)
at
org.mozilla.javascript.ScriptRuntime.defineFunction(ScriptRuntime.java:2045)
at org.mozilla.javascript.gen.c5.initScript(order.js)
at org.mozilla.javascript.gen.c5.exec(order.js)
at org.mozilla.javascript.Context.evaluateReader(Context.java:728)
[...]



Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-12 23:54:03 +00:00
norris%netscape.com ab592add8e Remove redundant import. 1999-10-12 21:46:50 +00:00
norris%netscape.com b6ec0294ae Fix release date, add contributor. 1999-10-12 16:52:13 +00:00
norris%netscape.com 1f04796183 Fix bug:
Subject:
        optimizer SecurityException
   Date:
        Mon, 11 Oct 1999 17:37:51 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com (Norris Boyd)
    CC:
        Howard Lin <howard@softcom.com>




We use our own SecuritySupport implementation in Rhino.  This is properly
getting called by the optimizer to generate new classes (e.g.
org.mozilla.javascript.gen.c5 etc.)

However, after defining the class, Codegen.compile calls getClassLoader()
on the new class.  The default SecurityManager doesn't allow
getClassLoader() to be called and so an exception is thrown:

java.lang.RuntimeException: Malformed optimizer package
java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader )
        at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:138)
        at org.mozilla.javascript.Context.compile(Context.java:1761)
        at org.mozilla.javascript.Context.compile(Context.java:1691)
        at org.mozilla.javascript.Context.compileReader(Context.java:810)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:725)
        [...]

This is kind of a pain to duplicate outside of our application, but if you
require a test case I can create one.

Codegen is attempting to call loadClass() after it uses
SecuritySupport.defineClass().  Our SecuritySupport calls loadClass()
internally in its defineClass() implementation.  This is what JavaAdapter
expects.

This is from Codegen.compile():

                         if (securitySupport == null) {
                             if (Context.isSecurityDomainRequired())
                                 throw new SecurityException("Required " +
                                             "security context missing");
                             if (classLoader == null)
                                 classLoader = new JavaScriptClassLoader();
                             clazz = classLoader.defineClass(name, classFile);
                         } else {
                             clazz = securitySupport.defineClass(name,
classFile,
                                                                 securityDom
securityDomain);
                         }
                         ClassLoader loader = clazz.getClassLoader();
                         clazz = loader.loadClass(name);


This is from JavaAdapter.createAdapterClass():


         SecuritySupport ss = cx.getSecuritySupport();
         if (ss != null)  {
             Object securityDomain = cx.getSecurityDomainForStackDepth(-1);
             return ss.defineClass(adapterName, bytes, securityDomain);
         } else {
             if (classLoader == null)
                 classLoader = new MyClassLoader();
             classLoader.defineClass(adapterName, bytes);
             return classLoader.loadClass(adapterName, true);
         }


So JavaAdapter is assuming SecuritySupport.defineClass() will call
ClassLoader.loadClass() on the new class, while Codegen is assuming it
needs to call ClassLoader.loadClass() on the class defined by
SecuritySupport.defineClass().

These should be made consistent, and in both cases it should be assumed
that SecuritySupport will both define and load the class.


Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-11 22:48:13 +00:00
rogerl%netscape.com 3321dd12a5 Fixed 14060 - calling exec on java methods was gettmg caught by exec
trapping nonsense.
1999-10-08 22:55:33 +00:00
norris%netscape.com 59ad20ea51 Fix 15711 Can't call java.lang.Class methods from JS 1999-10-07 18:27:21 +00:00