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

1392 Коммитов

Автор SHA1 Сообщение Дата
waldemar%netscape.com 1178f50d75 Changed syntax of getters and setters to "get name" and "set name". Relaxed grammar constraints on definitions. Changed over to colon syntax for types. Added local visibility and block modifiers. 1999-10-20 00:46:31 +00:00
waldemar%netscape.com aab1c75cc8 Removed octal escapes. Replaced bottom by throw of syntax error. 1999-10-20 00:43:58 +00:00
waldemar%netscape.com cf8b608c8c Removed octals. Removed rational-to-integer, which was replaced by semantic subtyping. Replaced bottom by throw of syntax error. 1999-10-20 00:43:22 +00:00
waldemar%netscape.com 890dfc92af Removed rational-to-integer and types in bottom calls, which were replaced by semantic subtyping 1999-10-20 00:42:17 +00:00
waldemar%netscape.com 20e07c2f9d Removed rational-to-integer, which was replaced by semantic subtyping 1999-10-20 00:41:59 +00:00
waldemar%netscape.com 2588b24207 Added semantic subtyping, throw, and catch 1999-10-20 00:40:55 +00:00
waldemar%netscape.com 333e67f4e1 Fixed bug that would sometimes emit a newline between a backslash and its following escaped character 1999-10-20 00:40:04 +00:00
rogerl%netscape.com ff8324352d r=norris
Delayed functionDef from creating property until after the body parses
succesfully.
1999-10-19 21:07:45 +00:00
rogerl%netscape.com 1beeb9a9fa r=norris
Fixed bug #12951 - var if for..in statement should always be of type
string.
1999-10-19 21:06:03 +00:00
norris%netscape.com aec69cc2f4 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
jband%netscape.com 021034bc23 trivial fix to get rid of warning from copy/paste error - was passing unused argument to printf 1999-10-19 08:00:29 +00:00
beard%netscape.com abc5e4e01f changed NSLibraryStartup.o to NSComponentStartup.o, since it's really a component. r=jband 1999-10-19 06:31:49 +00:00
jband%netscape.com c897592a24 fixing brendan's copy/paste bug that broke gc. r=shaver 1999-10-19 05:58:07 +00:00
cls%seawood.org b82455a5f6 Use PR_TRUE instead of c++ keyword "true" in case of broken/out-of-date compilers.
r=syd
1999-10-19 05:38:27 +00:00
jband%netscape.com 63c50e078a checking in code to fix bug 12768 submitted by Dan.Oscarsson@trab.se. Needed a 'const char*' tmp varible to work with a 'const char*' buffer that was passed in. The same problem is in both js.c and xpcshell.cpp. r=jband 1999-10-18 23:45:39 +00:00
jband%netscape.com d99faca17a checking in bug 16629 fix to cbegle's xpconnect tests submitted by green@FreeBSD.org. This fixes screwy longlong test methods. r=jband 1999-10-18 23:20:16 +00:00
rogerl%netscape.com c617326211 Changed tests for ECMA 3 definition of array.length handling. 1999-10-18 16:55:44 +00:00
jband%netscape.com ce4c41ef7d r=mccabe (I'll be adding more comments to the headers as requested)
Implement nsIXPCNativeCallContext to meet user feature
requirements. This allows simpler implementation of reflection of
native classes into JavaScript in cases where they need to
support legacy interfaces that include optional parameters and
method name overloading. This also provides a general mechanism
for native methods to discover if they were called from JS code,
exactly what JS parameters were passed, explicitly return jsvals,
and throw explicit jsvals without interference from xpconnect.
With test cases.
1999-10-18 02:53:04 +00:00
neeti%netscape.com b6a3ba2192 Converted dll to use nsIModule -bug 14034, r=jband 1999-10-16 03:04:16 +00:00
fur%netscape.com f4b621e214 Renamed variable to avoid a compiler warning. R: mccabe 1999-10-15 21:38:04 +00:00
mccabe%netscape.com a1db28e781 Fix line editing support for the standalone XPCOM-enabled JavaScript shell. To aid debugging on unix platforms.
To use, define JS_READLINE when compiling mozilla/js/src/xpconnect/shell.

r=shaver
1999-10-15 21:23:53 +00:00
waterson%netscape.com 2fd7083138 Add xpcnativecallcontext.cpp for jband. 1999-10-15 07:08:15 +00:00
brendan%mozilla.org 8371c29ee7 1. Fixed missing JS_LOCK_GC in JS_YieldRequest, commented other badness there.
2.  Cleaned up ugly JS_GC_Flag typedef name and put XXXbe comment in there for
    next time: someone seems to have patched around a deadlock that has since
    bit chouck@geocast.com.
3.  Fixed gcDisabled by moving it from cx to rt and updating it atomically.
4.  Fixed ECMA violation where for (var i, j in o) ... was permitted; only one
    variable is allowed.
(Item 4 was a bug on rogerl's list, since closed?  r=shaver@mozilla.org.)
1999-10-15 05:46:42 +00:00
jband%netscape.com d4d440258b adding new empty placeholder file to the build. Will also add it to Mac project via camelot and put real stuff in it after all is stable. r=jband :) 1999-10-15 05:09:08 +00:00
shaver%netscape.com 34010403ff fix obj_getCount to property destroy state and propagate error (r=jband) 1999-10-15 04:32:46 +00:00
brendan%mozilla.org ff9dec8d40 Rename ToSource to uneval (r=shaver@mozilla.org,terry@geocast.com). 1999-10-15 04:07:59 +00:00
jband%netscape.com 959b9a190e r=shaver
- Fixed two similar cases where code was missing one level of
pointer dereference in terminating a copied string. Was trashing
data further up the stack.
- Use 'nsAllocator::Free' in two similar cases where 'delete' was
mistakenly used. Error pointed out by Purify.
1999-10-15 03:31:09 +00:00
shaver%netscape.com c182ce4717 make xpcshell use jsrtsvc, and let jsrtsvc handle JS_Shutdown (r=jband) 1999-10-15 03:05:48 +00:00
mgleeson1%netscape.com ad3478d01d r=pepper HPUX specific change - enable 64-bit int for js 1999-10-14 23:20:27 +00:00
jband%netscape.com 27ff1e76cb Fixing leaks found by beard...
- Fixed leaked nsID ptr. bug 16373. This alsothrows a JS
exception when JS callers call createInstance or getService
using an (optional) param that is not an iid. This had been a
'XXX' in the code.
- Moved a release call out of just the error condition block in
setting up a ServiceReleaser. I should have caught this one, but
few of my tests use services :(  I have hopes that the whole
ServiceReleaser will become unnecessary as the ServiceManager
system changes and simply calling NS_RELEASE on a service becomes
sufficient.
- Cleaned up an addref/release pair in a setter (need to move to
nsComPtrs!) r=beard
1999-10-14 23:08:59 +00:00
cbegle%netscape.com ff236233af * removed stuff from the idl file that caused warnings
* fixed a typo that caused a warning (nsIsupports)
* fixed values of constants that caused warnings
* use a macro instead of assinging a long long value directly

r=jband
1999-10-13 00:11:21 +00:00
norris%netscape.com 3700676b23 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 8a23341b00 Fix unix build warning.
Reviewed by rogerl@netscape.com.
1999-10-12 22:48:17 +00:00
norris%netscape.com 809bf6aa85 Remove redundant import. 1999-10-12 21:46:50 +00:00
norris%netscape.com bc2eb782ee Fix release date, add contributor. 1999-10-12 16:52:13 +00:00
cbegle%netscape.com f456d33c1b new files.
new tests for xpconnect.  r=jband.
1999-10-12 00:12:43 +00:00
rogerl%netscape.com 0ac353dd25 NOT A PART OF SEAMONKEY BUILD
- fixed test ECMA references,
- added test to -002
1999-10-11 22:59:25 +00:00
norris%netscape.com 11fd4bbe0e 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 ecb681ee1d NOT A PART OF SEAMONKEY BUILD
- removed redundant test & fixed test for 'super' to detect syntax error
1999-10-11 22:38:40 +00:00
jband%netscape.com b93e33a858 Much of this is under the auspices of bug 15794. r=mccabe.
- map xpcshell's 'quit()' to a loop exit rather than calling
'exit(0)' so that the cleanup and leak detection code will still
get called.

- add NS_InitXPCOM and NS_ShutdownXPCOM to xpcshell to run said
cleanup and leak detection code.

- use more NS_IF_* macros

- fix numerous places where code assumed that
nsXPConnect::GetXPConnect() does not add a new ref on the
xpconnect singleton object (the behavior changed some time back
but not all the uses did - brainfade!).

- fix nsXPCException::NewException to automatically trim
'dataless' native stackframes off of the front of a stack trace.
The old system of manually telling it how many frames to trim was
not working well. We really want the first frame showing to be an
'interesting' frame so that callers who get exceptions thrown at
them will see some useful information rather than an empty native
frame that represents (but says nothing about) some native frame
in the xpconnect runtime.

- remove an extra addref from the trimming loop in
nsXPCException::NewException.

- Stop building XPCJSStack objects. XPConnect stacks are singly
linked lists of XPCJSStackFrame objects with refcounted links. I
had this stupid idea that each object would have a refcounted
link to a XPCJSStack object that would tie together the lifetimes
of all objects in the chain. This was overcomplex and
unnecessary. The linked list was enough. Any frame without a
refcount deserved to be deleted because it is simply unreachable.
There was no reason to tie together all the lifetimes of each
object in the chain. So this has been simplified in a big way.

- fixed place in xpcthrower.cpp where we were leaking a refcount
on the xpconnect singleton each time an xpcexception was thrown.

- do cleanup and gc() at the end of xpctest_echo.js to use for
leak testing - all wrappers should go away.
1999-10-09 06:01:57 +00:00
rogerl%netscape.com a5bd278835 Fixed 14060 - calling exec on java methods was gettmg caught by exec
trapping nonsense.
1999-10-08 22:55:33 +00:00
cbegle%netscape.com cafc7b6951 Adding new files. Tests for XPConnect. These files are not part of the
build.  R=jband@netscape.com
1999-10-08 20:45:37 +00:00
kipp%netscape.com 65f6ba5343 Cleanup moz-decl-counter usage and fix NS_LOG_ADDREF usage 1999-10-08 20:41:19 +00:00
warren%netscape.com 8c71c45537 Fixed AddRef/Release problems to eliminate negative refcounts in Bloaty. 1999-10-08 01:49:06 +00:00
jband%netscape.com 68de88b11a fix warning of old style C++ variable scope declared in 'for'. bug 15778. r=slamm 1999-10-08 00:11:05 +00:00
rogerl%netscape.com 59df6ba2b7 Fixed build failures - these files are NOT part of the seamonkey build. 1999-10-07 20:45:27 +00:00
rogerl%netscape.com 0f3e5543f2 Fixed error reporting to not smack the source line with a zero, but use
copyN instead - things were failing when very last line of input had an
error and didn't end with '\n'. r=mccabe
1999-10-07 20:44:40 +00:00
rogerl%netscape.com 00c8daeea3 Fixed build warnings by removing macros with '{..}'.
Made str_escape available for jsfile.
r=mccabe
1999-10-07 20:42:20 +00:00
rogerl%netscape.com a6311b8044 Making str_escape available for jsfile use. r=mccabe. 1999-10-07 20:41:15 +00:00
rogerl%netscape.com dac74252b1 Bug #12168. Catch new Array(NaN). r=mccabe. 1999-10-07 20:40:17 +00:00
norris%netscape.com 41f9794d2f Fix 15711 Can't call java.lang.Class methods from JS 1999-10-07 18:27:21 +00:00
norris%netscape.com 6757acf35a Subject:
Re: NPL vs. MPL
       Date:
            Wed, 06 Oct 1999 18:30:34 -0400
      From:
            "Ian D. Stewart" <idstewart@softhome.net>
        To:
            Norris Boyd <norris@netscape.com>
 References:
            1 , 2 , 3




Norris Boyd wrote:

  Great. So I'd like to change this copyright text

  /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
  4 -*-
   *
   * The contents of this file are subject to the Mozilla Public License
   * Version 1.0 (the "MozPL"); you may not use this file except in
   * compliance with the MozPL.  You may obtain a copy of the MozPL at
   * http://www.mozilla.org/NPL/
   *
   * Software distributed under the MozPL is distributed on an "AS IS"
  basis,
   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  MozPL
   * for the specific language governing rights and limitations under the
   * MozPL.
   *
   * The Initial Developer of this code under the MozPL is Ian D. Stewart.

   * Portions created by Ian D. Stewart are Copyright (C) 1998, 1999
   * Ian D. Stewart.
   * All Rights Reserved.
   */

  to this:

  /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset:
  4 -*-
   *
   * The contents of this file are subject to the Netscape 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/NPL/
   *
   * Software distributed under the License is distributed on an "AS
   * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
   * implied. See the License for the specific language governing
   * rights and limitations under the License.
   *
   * The Original Code is ListenerCollection, released
   * May 15, 1998.
   *
   * The Initial Developer of the Original Code is Ian D. Stewart.
   * Portions created by Ian D. Stewart are Copyright (C) 1998, 1999
   * Ian D. Stewart.
   * Rights Reserved.
   *
   * Contributor(s):
   * Ian D. Stewart
   *
   * Alternatively, the contents of this file may be used under the
   * terms of the GNU Public License (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 NPL, indicate your decision by
   * deleting the provisions above and replace 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 NPL or the GPL.
   */

  Can you give me your approval for this change?

Make it so.


Ian
1999-10-07 16:57:01 +00:00
rogerl%netscape.com 0b5779e73c More errors-as-exceptions stuff 1999-10-06 23:55:33 +00:00
norris%netscape.com 032b7f4436 More license wrangling: fix the release date (1999, not 1998). 1999-10-06 21:52:17 +00:00
jband%netscape.com 0da203c7c3 - the rest of the fix for bug 14738 - detect JSErrors with
JSErrorReports when thrown as exceptions. Extract JSErrorReport
and convert to an xpcexception. This restores functionality that
was whacked when JS errors-as-exceptions was enabled in the JS
engine.
- add conversion support for string-with-length as part of array
support mentioned in bug 13420. All the array stuff is basically
in with minimal testcases. More comprehensive tests need to be
written to verify and tune the code.
- fix a broken #undef
- switch to using PR_Alloc/PR_Free internally in nsjsid where we
were using new/delete before. This is prompted by warren's change
to nsID::ToString that uses PR_Alloc were before it used new.
This fixes an alloc/delete mismatch detected by Purify.
r=mccabe
1999-10-06 21:35:27 +00:00
sspitzer%netscape.com 295700338f fix for #15197 (and a whole bunch of duplicates).
fix by vidur, r=rogerl
1999-10-06 21:31:34 +00:00
beard%netscape.com 5eebed5f4a added EcmaError.java, NativeError.java 1999-10-06 21:07:04 +00:00
norris%netscape.com 55b6742fed Update contributors, add some license text. 1999-10-06 20:50:04 +00:00
cbegle%netscape.com 27ff0f3d29 tests for javascript errors as exceptions, a feature that was recently
added to the javascript engine.

not part of the build.
1999-10-06 20:45:44 +00:00
norris%netscape.com 52141616b0 Make sure creation of class loader is inside a try block to handle security exceptions. 1999-10-06 17:39:48 +00:00
brendan%mozilla.org 78daa5976c Fix Object.prototype.toSource so it parenthesizes outermost-toSource literals for eval roundtrips. 1999-10-06 09:09:31 +00:00
brendan%mozilla.org 8f10045f6d Top-level ToSource function for primitive type roundtrips. 1999-10-06 06:37:55 +00:00
brendan%mozilla.org bb6510becd Fix two multi-threaded GC-rooting bugs:
- js_NewFunction wasn't initializing (clearing) JSFunction members before it
  linked the JSFunction to a JSObject that the GC could reach from a root.
- Make sure frame.scopeChain is cleared before linking frame via cx->fp, even
  though we set frame.scopeChain to some object later (another signal that we
  should rework js_Invoke to inline it and otherwise optimize it).
1999-10-06 06:29:43 +00:00
rogerl%netscape.com a881374871 Added version 150, changed version testing in regexp 1999-10-06 00:10:27 +00:00
rogerl%netscape.com f775195a30 Bug #14545 - get array length exceptions working with non-Number array
contructor arguments.
1999-10-05 22:11:57 +00:00
jband%netscape.com 8e2a51ab02 the JS engine part of the fix for bug 14738. This does two things: 1) expose the JSClass for JSError so that it is possible to detect from the outside if a given JSObject is of that JSError class, and 2) expose an api call via which the JSErrorReport can be extracted from a JSError (if present). This change required renaming the JSClass used for JSError, so many lines were touched 1999-10-05 21:07:23 +00:00
rogerl%netscape.com fe413b9972 Errors as exceptions working from generated code. 1999-10-05 19:44:24 +00:00
kipp%netscape.com e0e02e284d r=jband; fixed a memory leak 1999-10-05 14:56:41 +00:00
mccabe%netscape.com 1fbb1a0a36 Initial checkin of TestScan.java, a simple driver for generating and printing various kinds of parse trees, and for profiling scanning, parsing and compiling. 1999-10-05 03:47:04 +00:00
dmose%mozilla.org 0f48266224 update license boilerplate to NPL dual w/GPL, r=norris@netscape,a=norris@netscape.com 1999-10-05 01:42:01 +00:00
dmose%mozilla.org 9d7478e8be update license boilerplate to NPL dual w/GPL, r=norris@netscape,a=norris@netscape.com 1999-10-05 00:44:05 +00:00
rogerl%netscape.com 079188169c First cut at errors as exceptions - These changes should be benign since
the errors are being wrapped by runtime exceptions and still need to be
explicitly caught (this is happening in the interpreter, but not in
generated code).
1999-10-05 00:21:07 +00:00
waterson%netscape.com 2efd076b82 Bug 15367. Dump 'class' instead of 'file/line' for NS_LOG_REFCNT. r=shaver,dp 1999-10-05 00:07:54 +00:00
norris%netscape.com 4c4cc4d82a Fix up makefiles; previous patch was mis-applied. 1999-10-04 21:31:21 +00:00
norris%netscape.com b1ecbb62ba Fix bug found by Andrew Wason (see below).
Problem was that one transformation of a node to GETVAR wasn't protected by a check of inWithStatement().

======================================
Subject:
        multiple scopes
   Date:
        Fri, 01 Oct 1999 12:39:14 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




When I create two scopes, and one scope evaulates a string in the other
scope, it works.  However, if I do this while handling an exception thrown
within a JavaAdapter method, it fails with an exception.

Run the attached Java program with the two script files.  scope1.js
evaluates a string "printMessage" in the scope of scope2.js.  This returns
a function object which is then invoked.  This works in 3 cases, but fails
in the 4th (in the catch in the JavaAdapter).  Even in the 4th case where
it fails, printing the function object looks normal.

Am I doing something wrong, or is there a bug here?

java CrossScope scope1.js scope2.js

Outside of JavaAdapter
works before exception
works after exception
Inside of JavaAdapter
works before exception
Caught exception
pma=
function printMessage(msg) {
     java.lang.System.out.println(msg);
}

Exception in thread "main" org.mozilla.javascript.JavaScriptException:
org.mozilla.javascript.EvaluatorException: The undefined value has no
properties.
         at
org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException
.java:61)
         at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java,
Compiled Code)
         at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1256)
         at org.mozilla.javascript.Interpreter.interpret(Interpreter.java,
Compiled Code)
         at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:49)
         at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:37)
         at org.mozilla.javascript.Context.evaluateReader(Context.java:697)
         at CrossScope.<init>(CrossScope.java:30)
         at CrossScope.main(CrossScope.java:10)


Thanks,
Andrew

import java.io.*;
import org.mozilla.javascript.*;

public class CrossScope {
	private Context m_jsContext;
	private Scriptable m_scope1;
	private Scriptable m_scope2;

	public static void main(String args[]) throws Exception {
		new CrossScope(args[0], args[1]);
	}

	private CrossScope(String strFile1, String strFile2) throws Exception {
		// Associate Context with main thread
		m_jsContext = Context.enter();
                m_jsContext.setOptimizationLevel(-1);

		// Init scope1, expose Scope object
  		m_scope1 = m_jsContext.initStandardObjects(new ImporterTopLevel());
		m_scope1.put("Scope", m_scope1, this);

		// Init scope2
		m_scope2 = m_jsContext.initStandardObjects(new ImporterTopLevel());

		// Run script in scope2
		Reader r2 = new FileReader(strFile2);
		m_jsContext.evaluateReader(m_scope2, r2, strFile2, 1, null);

		// Eval input JS in scope1 - it can in turn eval JS over in scope2
		Reader r1 = new FileReader(strFile1);
		Object obj = m_jsContext.evaluateReader(m_scope1, r1, strFile1, 1, null);
		if (obj instanceof Throwable)
			((Throwable)obj).printStackTrace();

		m_jsContext.exit();
	}

	public Object scope1Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope1, str, "scope1EvalString", 1, null);
			cx.exit();
			return objResult;
	}

	public Object scope2Eval(String str) throws JavaScriptException {
			Context cx = Context.enter(m_jsContext);
			Object objResult = cx.evaluateString(m_scope2, str, "scope2EvalString", 1, null);
			cx.exit();
			return objResult;
	}
}


// Scope1

importPackage(java.lang);

System.out.println("Outside of JavaAdapter");

try {
	var pm = Scope.scope2Eval("printMessage");
	pm("works before exception");
	System.arraycopy(null, 5, null, 5, 100);
} catch (e) {
	var pma = Scope.scope2Eval("printMessage");
	pma("works after exception");
}

var obj = new Runnable() {
	run: function() {
		System.out.println("Inside of JavaAdapter");
		try {
			var pm = Scope.scope2Eval("printMessage");
			pm("works before exception");
			System.arraycopy(null, 5, null, 5, 100);
		} catch (e) {
			System.out.println("Caught exception");
			var pma = Scope.scope2Eval("printMessage");
			System.out.println("pma=" + pma);
			pma("works after exception");
		}
	}
};

obj.run();



// Scope2

function printMessage(msg) {
	java.lang.System.out.println(msg);
}
1999-10-04 18:27:30 +00:00
beard%netscape.com 208d328010 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:47:12 +00:00
beard%netscape.com 9eae33066d changed from directly using "MSL DropInRuntime.Lib" to using "NSComponentStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:46:23 +00:00
beard%netscape.com 0a7a3c72b6 changed from directly using "MSL ShLibRuntime.Lib" to using "NSLibraryStartup.o" to enable GC leak detector. r=smfr 1999-10-03 20:23:01 +00:00
norris%netscape.com d21c5596fd Fix the following bugs:
14443 "Same origin" security policy may be circumvented using docu
14820 Fixing up the relationship between nsCodeBasePrincipal and n
14919 Crash in JS MM code
Reviewed by mstoltz, approved by scc.
1999-10-02 03:41:37 +00:00
norris%netscape.com 9169791d48 Contribution from Andrew Wason:
Subject:
        optimizer Makefiles
   Date:
        Fri, 01 Oct 1999 14:50:05 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




Norris,

Here are patches to the Rhino Makefiles to build the optimizer package and
the jsc compiler.  They also fix a problem with "gmake clean".

Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-10-01 22:58:48 +00:00
norris%netscape.com cf9f713ecb \t doesn't work on Windows. 1999-10-01 22:56:30 +00:00
kipp%netscape.com 0ca8147bb6 Convert to a module from a component 1999-09-30 21:47:04 +00:00
kipp%netscape.com 3dc38d7da4 Fixed shutdown related memory leaks 1999-09-30 21:12:33 +00:00
beard%netscape.com 978fa797c2 fixed output directory 1999-09-29 16:11:58 +00:00
beard%netscape.com 1803aa06ab fixed source folder name 1999-09-29 16:10:25 +00:00
beard%netscape.com d54d7ae821 build debugger with CW Pro 4. 1999-09-29 16:07:22 +00:00
beard%netscape.com cf51c97bad builds the optimizer using CW Pro 4. 1999-09-29 15:55:29 +00:00
sfraser%netscape.com 65d0896a12 More type mismatch fixing for shavear 1999-09-29 03:07:27 +00:00
shaver%netscape.com 7a5b9d5e55 nsIRegistry scriptability update, r=dveditz,dp,alecf a=leaf,chofmann 1999-09-29 02:36:54 +00:00
dmose%mozilla.org 16e0d1f95e update license boilerplate to NPL-1.1 dual-licensed with the GPL. a=brendan, r=brendan. 1999-09-28 23:12:09 +00:00
norris%netscape.com edd009bad1 Add example of classfile generation. 1999-09-27 23:21:01 +00:00
norris%netscape.com 40f1ee60cc Changes for classfile generation. 1999-09-27 23:17:29 +00:00
rogerl%netscape.com 854aa7f8a3 Better error handling for interpreter. 1999-09-27 17:47:51 +00:00
rogerl%netscape.com 4953124561 Changes from Kurt Westerfield to improve error messages from Interpreter
by passing line/file data through bytecode.
1999-09-27 17:47:05 +00:00
rogerl%netscape.com 861193d030 Stash originating source file for error reporting 1999-09-27 17:45:26 +00:00
rogerl%netscape.com 0f93133878 ECMA 3 array length error handling. 1999-09-27 17:44:30 +00:00
rogerl%netscape.com 4238d6f520 Execute exec in the global scope. 1999-09-27 17:43:40 +00:00
rogerl%netscape.com 08abcd5436 New tokens to support better error messages from Interpreter. 1999-09-27 17:43:07 +00:00
rogerl%netscape.com 0bdd913940 Added -c <classpath> option to specify, you guessed it, a classpath. 1999-09-27 17:41:44 +00:00
shaver%netscape.com 44047c7580 unlock in fun_enumProperty, r,a=brendan 1999-09-27 08:24:36 +00:00
shaver%netscape.com 8d0545f569 properly unlock object, preventing ugly crash with |if (foo in noFoo)| 1999-09-27 06:04:54 +00:00
shaver%netscape.com 63cbd3c409 Fix leak of native path in AutoRegisterComponents.
Save registry data for failed components.
Make the loader work again (fix suffix length and init crash).
Better error reporting.
1999-09-27 02:22:25 +00:00
kipp%netscape.com 29c7fcb9b4 new 1999-09-25 20:11:47 +00:00
kipp%netscape.com a04392a6c0 Init all variables, not just some of them 1999-09-25 20:07:20 +00:00
beard%netscape.com 9675752f93 Fixed looking up 'length' property in Function objects: needed to look up prototype chain for zero arguments. Cleaned up some more, always storing Boolean.TRUE in local hash tables, rather than the method, methodKey or methodName. 1999-09-25 09:24:23 +00:00
beard%netscape.com 620e43cd95 Added ClassSignature, a key for caching generated adapter classes. Now passing superName, rather than superClass to constructor generation methods. 1999-09-25 08:11:24 +00:00
beard%netscape.com 38ef2b2d81 Fixed generateSuper when override has void return type. 1999-09-25 01:37:32 +00:00
norris%netscape.com e6517361c6 Shorten name to make Mac developers happy. 1999-09-24 21:05:41 +00:00
norris%netscape.com d51c86ce41 Patches from Kurt Westerfeld for JavaScript property access to JavaBeans.
Subject:
        Re: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class with duplicate field/method]
   Date:
        Mon, 13 Sep 1999 20:57:32 -0400
   From:
        "Kurt Westerfeld" <kurt@westerfeld.com>
     To:
        "Norris Boyd" <norris@netscape.com>




I do have a patch for this, but it is intermixed with some other changes
that I have implemented for the get/set on Java instances (per my LC3
proposal).  The bug requires changes that are a little involved actually;
basically it seems that when getting the default value for a "field and
methods" (which combines the same-named entities), the prototype of the
parent scope is deref-ed, and the parent scope is null.  Hence, the scope
must be passed into the the cloned field and method values.

Also, the NativeJavaClass implementation passed "false" for isStatic on the
constructor of the FieldAndMethods Hashtable, which results in classes
having instance methods.  Bad.  I haven't filed a bug on that yet.
Additionally, I fixed a couple other NullPointerException nigglies thrown in
when exceptions are propagated in the same area.  Finally, when getting the
default value for the field, it is helpful to convert a Scriptable to string
when that is requested (as when typing in the console).

I am attaching the changed files.  The LC3++ code can be removed if you
want, which I can do for you but it will take a little longer.  What is your
preference?

-----Original Message-----
From: Norris Boyd <norris@netscape.com>
To: Kurt Westerfeld <kurt@westerfeld.com>
Date: Monday, September 13, 1999 4:54 PM
Subject: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class
with duplicate field/method]


>Kurt,
>
>Is this the bug that your patch fixes?
>
>Thanks,
>Norris
>
1999-09-24 20:41:43 +00:00
norris%netscape.com f69a840b1e Remove '.js' from SECTION. 1999-09-24 20:16:55 +00:00
norris%netscape.com 250df9809f Propagate files from old netscape code. 1999-09-24 20:05:59 +00:00
norris%netscape.com ec0d89055e Implement the "cast" of java class objects so that js objects in java adapters can
use 'this' for the implemented java interface.
1999-09-24 18:20:08 +00:00
beard%netscape.com b0a911e500 Added "generateSuper" which generates a method called "super$method()" which when called calls "super.method()." This is provided to support full sub-classing of Java classes from JavaScript. 1999-09-24 18:17:05 +00:00
beard%netscape.com 5185946b51 added a prototype field, so that a wrapped JavaAdapter can preserve the delegate object's original prototype chain. 1999-09-24 16:52:23 +00:00
beard%netscape.com 24a3e9d1a9 setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine. 1999-09-24 16:51:25 +00:00
mscott%netscape.com 0c4f5eb9c9 fix build bustage for dp. 1999-09-24 02:52:46 +00:00
dp%netscape.com 0642f2e13a Fixing jsloader not to hold reference to component manager. (shaver)
Some initialization of members and checking at desctruction. (dp)
1999-09-24 01:37:44 +00:00
rogerl%netscape.com 167a47ffdb New error for wacky array lengths, ECMA 3 1999-09-23 23:19:00 +00:00
cbegle%netscape.com fc84d5f9c3 update script to report an error if no tests passed. 1999-09-23 23:00:38 +00:00
cbegle%netscape.com 9476968b49 just changing the section name so it doesn't break norris's script. 1999-09-23 22:59:20 +00:00
norris%netscape.com faa7950d23 Fix some Array tests in the ecma suite. 1999-09-23 20:37:56 +00:00
norris%netscape.com a6ed48495a change FAILED color to red 1999-09-23 17:26:22 +00:00
norris%netscape.com 91b5e29282 Add test driver for rhino. 1999-09-23 17:24:14 +00:00
rogerl%netscape.com 71eb1ee9d3 Can't assume object in reportConversionError is scriptable, so call more
generic java.object.toString instead.
1999-09-22 22:06:14 +00:00
norris%netscape.com f8b25c9abd Allow a java.lang.String to be converted to a primitive string in getDefaultValue 1999-09-22 16:30:49 +00:00
norris%netscape.com 9a0f128be4 Fix "wapper". 1999-09-22 16:25:21 +00:00
beard%netscape.com d080c25c1d JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. 1999-09-22 08:22:53 +00:00
beard%netscape.com 1b108bb46a JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. Simplified callMethod to only call Context.enter() if methodId property is defined in Scriptable object. 1999-09-22 08:22:47 +00:00
brendan%mozilla.org d70aa0ef6b - Enable JS_HAS_NEW_OBJ_METHODS (Object.prototype.hasOwnProperty, isPrototypeOf
and propertyIsEnumerable) for JS1.5.
- Optimize obj_propertyIsEnumerable to avoid extra lookup code bloat, requiring
  fix to js_GetAttributes (unset out param on successful early retunr) that it
  exposed.
- Use more righteous else-if style in shaver's jsarray.c change.
1999-09-22 05:54:44 +00:00
shaver%netscape.com c254a808f0 new Array("string") should be ["string"], not silent failure (14545, r=brendan) 1999-09-22 04:36:28 +00:00
beard%netscape.com 0bb5087bad renamed "name" parameter "adapterName", removed explicit StringBuffer in favor of "adapter" + serial++ for clarity. 1999-09-22 03:54:00 +00:00
shaver%netscape.com b42e435cb0 add componentType to nsIModule::RegisterSelf 1999-09-22 03:18:27 +00:00
beard%netscape.com ee2e476427 changed createAdapterClass() to only generate methods for properties defined in the wrapped object itself, not for properties defined in prototypes. This makes sense, as the prototype for the wrapped object becomes the LiveConnect wrapper, thus prototype properties become inaccessible anyway. 1999-09-22 01:32:05 +00:00
shaver%netscape.com 826cb30406 having evicted default.js from components/, we reclaim our *.js birthright 1999-09-21 22:10:03 +00:00
brendan%mozilla.org 8e655a2992 JS_VERSION 140 lacked JS_HAS_NUMBER_FORMATS #define. 1999-09-21 21:33:38 +00:00
shaver%netscape.com 1a3efafe34 turn on JS loader on Windows 1999-09-21 20:08:38 +00:00
shaver%netscape.com 4a5a6fe48f fixed Windows makefile goop and fixed __stdcall issue 1999-09-21 19:42:09 +00:00
rogerl%netscape.com d6ea115852 ECMA errors as exceptions changes - conformance to latest spec for
hierarchy and names etc. Added attempt to make the base exceptions be
instanceof equal across contexts.
1999-09-21 18:58:51 +00:00
shaver%netscape.com aacd538f0b Errors-as-Exceptions and catchguards, because people want/need them 1999-09-21 18:48:43 +00:00
brade%netscape.com efff4a9f90 not currently part of the build (a=leaf); add libraries for xpcom and js so optimized will link 1999-09-21 15:55:56 +00:00
brade%netscape.com 97aaae768d First Checked In. 1999-09-21 14:55:39 +00:00
shaver%netscape.com b472e3d9ce define some key names locally until we export them properly from xpcom 1999-09-21 14:54:39 +00:00
shaver%netscape.com 32d3521175 remove unused file and add initial windows build foo 1999-09-21 14:43:45 +00:00
shaver%netscape.com fae1a32ebc add include of nsIModule.h -- why was this working before? 1999-09-21 14:38:50 +00:00
shaver%netscape.com 320f129e1c fix =/== idiocy, abort if we fail to get runtime and better diagnostics 1999-09-21 14:36:40 +00:00
waterson%netscape.com c3182c1f1c Add some curly braces so that the rest of the world can run. 1999-09-21 04:20:17 +00:00
shaver%netscape.com ae64fff204 build JS component loader by default 1999-09-21 01:09:33 +00:00
shaver%netscape.com a15321335a fix typo before I inflict it on the world 1999-09-21 01:08:21 +00:00
brendan%mozilla.org 94a86fe442 - Bumped default compile-time JS version from 1.4 to 1.5.
- Add JS1.5 getter/setter support in all its glory:

  * getter function SN() {return ++x} at top-level or as a closure binds an SN
    property getter than returns the incremented value of x.  Likewise for
    setter function SN(y) {return y = x}.

  * getters and setters may be defined in an object literal:
      o = {p getter:function() {return ++this.x},
           p setter:function(y){return this.x = y},
           x:42};

  * getter= and setter= operators (compound tokens) may be used to bind getter
    and setter properties dynamically:
      o = new Object;
      o.p getter= function() {return ++this.x};
      o.p setter= function(y){return this.x = y};
      o.x = 42;

    Waldemar is concerned that this form will collide semantically with JS2, so
    I am not committing to keeping it in JS1.5.  I'd like to check my code in
    ASAP so shaver can use it, and I'd also like to see this form get used (or
    not) during Mozilla betas.  Caveat emptor, and if you find this "dynamic"
    or "imperative" form necessary and hard to substitute, please let me know.
    If this proves important to users, then I think JS1.5 should keep it.

- Cleaned up property flags (in a binary-incompatible fashion -- who cares?) by
  eliminating JSPROP_ASSIGNHACK and JSPROP_TINYIDHACK.

- Added JS_DONT_PRETTY_PRINT flag to be ORed with the indent argument to the
  several JS_Decompile*() API calls.  This avoids any newlines or identation in
  the decompiled string.
 
- Improved and extended (for getter/setter non-reservation) scanner lookahead
  by using a circular (power-of-2 sized) token buffer.

- Fix ECMA Edition 3 deviation where function f(){function g(){}} bound f.g by
  mistake (it should arrange to make a closure named g in activations of f, but
  it should not bind a property of function f).
1999-09-21 00:13:48 +00:00
rogerl%netscape.com 2d8fcffd6b (Bug #13416)
Turned off 'super' keyword - was letting through some cut'n'pasted java
code quietly and blowing big chunks out of the codegen/interpreter later.
Anybody know why 'super' had an interesting value here? - there was no
support for it on any path that I could see.
1999-09-20 22:21:24 +00:00