Commit Graph

1754 Commits

Author SHA1 Message Date
rogerl%netscape.com
813e07ff5f Converting value type for setter method to match declared type.
git-svn-id: svn://10.0.0.236/trunk@43187 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 18:33:48 +00:00
rogerl%netscape.com
d8b79d08e2 Factored out convertArg so that it can be called from ScriptableObject
for setter methods.


git-svn-id: svn://10.0.0.236/trunk@43186 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 18:31:34 +00:00
rogerl%netscape.com
787b4d4b45 Undo captures from failed OPT child
git-svn-id: svn://10.0.0.236/trunk@43156 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 04:34:52 +00:00
rogerl%netscape.com
567d4e7159 Tentative fix for allowing call to 'exec' on RegExp objects.
git-svn-id: svn://10.0.0.236/trunk@43155 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 04:34:05 +00:00
rogerl%netscape.com
572469bdd1 Fix 'zero' & 'one' to use byte instead of Double
git-svn-id: svn://10.0.0.236/trunk@43154 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 04:33:08 +00:00
rogerl%netscape.com
f140a7f1f2 Fixed lastIndex test - value is ignored for non-global regexp.
git-svn-id: svn://10.0.0.236/trunk@43153 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-11 04:31:19 +00:00
rogerl%netscape.com
bd3a0a9823 Fixed limit parameter interpretation to match ecma_2 spec.
git-svn-id: svn://10.0.0.236/trunk@43088 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 23:36:23 +00:00
rogerl%netscape.com
10faff314a Fixed test results to match new spec.
git-svn-id: svn://10.0.0.236/trunk@43003 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 19:25:00 +00:00
rogerl%netscape.com
f37e17b7f0 Re-wrote the string_split algorithm to match new spec.
git-svn-id: svn://10.0.0.236/trunk@42991 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 18:36:46 +00:00
mccabe%netscape.com
1999447bdb Changes to the xpidl compiler -
Error if an interface is declared [scriptable], but contains methods that can't be scripted because they refer to native-declared types, unless the method is declared [noscript].

This change is intended to make it easier to determine when an interface is not scriptable, and to make it easier to see what changes need to be made to make it scriptable.

As many of the .idl files in the tree defined [scriptable] interfaces that contained non-scriptable methods, I've sprinkled [noscript] throughout.  As the interfaces weren't scriptable anyway, this shouldn't change their visibility to javascript.


git-svn-id: svn://10.0.0.236/trunk@42960 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 12:18:01 +00:00
jband%netscape.com
ff333a38ba updating tests
git-svn-id: svn://10.0.0.236/trunk@42939 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 06:12:06 +00:00
toshok%hungry.com
ac965d16c1 we need keyCompare functions to these hashtables.
git-svn-id: svn://10.0.0.236/trunk@42932 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-10 05:25:14 +00:00
jband%netscape.com
5630b79f6c adding enumeration of CLSIDs and ProgIDs using code from Robert Ginda <rginda@ix.netcom.com>
git-svn-id: svn://10.0.0.236/trunk@42738 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-09 05:02:25 +00:00
brendan%mozilla.org
7c7947dd9f - Tighten up code in gc_root_marker that now allows for roots to contain jsvals
(tagged machine words, some of which when untagged are 8-byte-aligned GC heap
  pointers).
- Fix bad effects of rogue global-replace of JS_FREE by free.


git-svn-id: svn://10.0.0.236/trunk@42693 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-08 02:32:00 +00:00
jband%netscape.com
1e3a93ad77 add JS based test for nsISupportsPrimitives. Run using 'xpcshell xpctest_primitive.js'
git-svn-id: svn://10.0.0.236/trunk@42434 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-06 09:43:45 +00:00
norris%netscape.com
59fb3fb2dc Fix problem found by Andrew Wason <aw@softcom.com>:
Subject:
        reflection and illegal package access
   Date:
        Wed, 04 Aug 1999 21:56:20 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com (Norris Boyd)
    CC:
        Howard Lin <howard@softcom.com>




If you run Rhino under JDK1.2 with a security manager:

java -Djava.security.manager=java.lang.SecurityManager
org.mozilla.javascript.tools.shell.Main

Then reflection fails for objects that are in a restricted access package
(e.g. sun.*).  Rhino is reflecting based on the dynamic type of the object
instead of the declared static return type.

In this example, createImage is declared to return java.awt.Image, but it
returns sun.awt.image.OffScreenImage.  Attempting to reflect this class
results in a java.security.AccessControlException for
java.lang.RuntimePermission accessClassInPackage.sun.awt.image.

Here is the script.  You will need to type it in because you won't be able
to load it from a file due to the security manager.

var f = new java.awt.Frame();
f.setVisible(true);
var i = f.createImage(10,10);


git-svn-id: svn://10.0.0.236/trunk@42306 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-05 16:49:20 +00:00
rogerl%netscape.com
0c56f34afc Fixed tests for back-reference case
git-svn-id: svn://10.0.0.236/trunk@42228 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 23:40:13 +00:00
rogerl%netscape.com
a5ad66924f Fixed off by one error and expected output text.
git-svn-id: svn://10.0.0.236/trunk@42227 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 23:38:34 +00:00
norris%netscape.com
b4bfaa137d Fix problem found by Andrew Wason <aw@softcom.com>:
Subject:
        null arguments
   Date:
        Wed, 04 Aug 1999 13:22:35 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




When I try to pass a null argument to an interface implemented in JS, I get:

js: Cannot convert null to an object.
js: uncaught JavaScript exception:
org.mozilla.javascript.EvaluatorException: Cannot convert null to an object.


var b = new Packages.javax.swing.border.Border() {
        getBorderInsets : function(c) {
                return new Insets(0,0,0,0);
        }
};
b.getBorderInsets(null);


Here is the stack trace where the exception is happening:

java.lang.reflect.InvocationTargetException:
org.mozilla.javascript.EvaluatorException: Cannot convert null to an object.
         at
org.mozilla.javascript.tools.ToolErrorReporter.runtimeError(ToolErrorReporte
r.java:106)
         at org.mozilla.javascript.Context.reportRuntimeError(Context.java:484)
         at org.mozilla.javascript.Context.reportRuntimeError(Context.java:500)
         at
org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:529)
         at org.mozilla.javascript.Context.toObject(Context.java:1107)
         at adapter0.getBorderInsets(<adapter>)
         at java.lang.reflect.Method.invoke(Native Method)
         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:691)
         at
org.mozilla.javascript.tools.shell.Main.processSource(Main.java, Compiled Code)
         at org.mozilla.javascript.tools.shell.Main.main(Main.java:146)


Context.toObject does not allow wrapping nulls.
JavaAdapter.generateOverride should generate bytecode to check if an
argument is null and if it is not call Context.toObject.

I'll take a look at fixing this after the other JavaAdapter patches get
checked in so we don't get out of sync.

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


git-svn-id: svn://10.0.0.236/trunk@42225 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 23:14:57 +00:00
rogerl%netscape.com
fe3d1f0753 The lastIndex property is defined to be an integer which we're allowed to
keep as 32 bits, so the tests for 33 bits were too demanding.


git-svn-id: svn://10.0.0.236/trunk@42219 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 22:27:31 +00:00
rogerl%netscape.com
831a14fdaf Missing '\' before \n. Trailing '|' in expected output was not correct.
git-svn-id: svn://10.0.0.236/trunk@42218 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 22:26:07 +00:00
rogerl%netscape.com
4c5f8c91da Was using 'g' flag instead of 'm' and wasn't really testing the multiline
functionality (assuming I interpreted the intent correctly).


git-svn-id: svn://10.0.0.236/trunk@42217 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 22:24:57 +00:00
rogerl%netscape.com
90cd3cd063 Added Linux/sparc component
git-svn-id: svn://10.0.0.236/trunk@42197 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 20:46:58 +00:00
norris%netscape.com
e0486b8b6a Fix bug 11077 "ScriptableObject.defineFunctionProperties() uses invalid signature check."
The check was actually okay, but the error message didn't state the error correctly.


git-svn-id: svn://10.0.0.236/trunk@42166 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 19:37:51 +00:00
norris%netscape.com
e1c36e7f50 * Take advantage of the new semantics of Context.enter & exit to save codesize.
* Accept patch from Andrew Wason <aw@softcom.com>:

Subject:
        Re: partial interface problem
   Date:
        Wed, 04 Aug 1999 13:04:37 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        Howard Lin <howard@softcom.com>




>I'm having a problem implementing a Java interface in JS where I don't
>implement all the methods, and one of the methods I don't define returns
>non-void.

I have a patch for this.  I generate bytecode in
JavaAdapter.generateReturnResult to check the return type on the stack from
JavaAdapter.callMethod.  If it is Undefined, return null.

I'm not positive this is the right way to fix this - maybe it should be
fixed closer to the source (e.g. prevent callMethod from returning
Undefined to begin with)

Andrew

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


git-svn-id: svn://10.0.0.236/trunk@42148 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 17:43:18 +00:00
norris%netscape.com
f33a289889 Accept patch (with modifications) from Andrew Wason <aw@softcom.com>:
Subject:
        default JavaAdapter patch
   Date:
        Tue, 20 Jul 1999 15:35:01 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        mccabe@netscape.com, rogerl@netscape.com




Attached is a patch to the patch I sent a while ago for the JavaAdapter stuff.

If a SecurityManager is installed, attempting to access the
"org.mozilla.javascript.JavaAdapter" system property can throw a
SecurityException.  This should not prevent the default JavaAdapter
implementation from being used.

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


git-svn-id: svn://10.0.0.236/trunk@42146 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 16:56:18 +00:00
jband%netscape.com
11316e2c3b adding modifications to support enumeration of interfaces from Robert Ginda <rginda@ix.netcom.com>. Also extending nsIXPCScriptable to support a set of flags - the only one implemented now allows for indicating that the objects static properties shouyld not be enumerated
git-svn-id: svn://10.0.0.236/trunk@42118 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 06:22:27 +00:00
mccabe%netscape.com
85b0673c2b Added missing ImporterTopLevel.java and ListenerCollection.java files to the source list.
Thanks to Andrew Wason <aw@softcom.com> for noticing this problem.


git-svn-id: svn://10.0.0.236/trunk@42090 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-04 02:50:47 +00:00
rogerl%netscape.com
f74e4a5fc6 Updated internal name of exec function to match new naming rules.
git-svn-id: svn://10.0.0.236/trunk@42044 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 22:41:57 +00:00
mccabe%netscape.com
d751032e4b - Added OS_TARGET-switched definition of CLASSPATHSEP, to support building under Windows NT with GNU make. Thanks to Andew Wason <aw@softcom.com> for this fix.
- Removed outdated references to JSDEBUG_JAR.


git-svn-id: svn://10.0.0.236/trunk@42034 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 22:15:02 +00:00
norris%netscape.com
d7970d2406 Adding patch (with slight modifications for javadoc) from Andrew Wason <aw@softcom.com>:
Subject:
        Rhino reflection patch
   Date:
        Wed, 28 Jul 1999 18:14:52 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        mccabe@netscape.com, rogerl@netscape.com, Howard Lin <howard@softcom.com>




When JavaAdapter generates an adapter class, it does not take into account
the types of method parameters when wrapping the generated methods arguments.

This means that if a non-public class implements a public interface the
non-public class type will be wrapped instead of the declared public
interface - and methods cannot be invoked via the wrapper.

I have attached sample code (reflect-demo.zip) which shows this.  The
JavaScript caller.js generates an adapter implementing the CallerInterface
interface.  CallerInterface has a method (doSomething) which takes an
argument of type pkg.Interface.  pkg.Target is a non-public class that
implements pkg.Interface.  If an instance of pkg.Target is passed to the
CallerInterface adapter doSomething method, an Error is thrown because
pkg.Target.doSomething is called (instead of pkg.Interface.doSomething) and
pkg.Target is not public.

I have attached a patch to Context.java, ScriptRuntime.java and
JavaAdapter.java.  I overloaded toObject in Context and ScriptRuntime to
take a 3rd argument which is the declared type of the object being
wrapped.  This is passed to NativeJavaObject.wrap so that it generates the
correct wrapper. I changed JavaAdapter.generateOverride to generate
bytecode calling Context.toObject passing the declared Class type of the
argument.

Context.java also includes my previously submitted patch for dealing with
SecurityExceptions and the JavaAdapter property (because this patch has not
been checked into CVS yet).

Andrew

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



   reflect-patch.txt

                Name:
                      reflect-patch.txt
                 Type:
                      Plain Text (text/plain)




   reflect-demo.zip

                   Name:
                         reflect-demo.zip
                    Type:
                         Zip Compressed Data (application/x-zip-compressed)
                Encoding:
                         base64


git-svn-id: svn://10.0.0.236/trunk@42025 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 21:24:39 +00:00
norris%netscape.com
97d3d62d46 Remove unused clone() method.
git-svn-id: svn://10.0.0.236/trunk@42004 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 20:40:25 +00:00
rogerl%netscape.com
f11f9ed504 Fixed test cases for non-global regexp. case - the result array should be
exactly the same as that returned by simply 'exec'ing the regexp against
the input string.


git-svn-id: svn://10.0.0.236/trunk@41909 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 00:51:23 +00:00
mccabe%netscape.com
41dabd483b Further fix to properly include classes from the org.mozilla.classfile package in the generated .jar file.
Thanks to Andrew Wason <aw@softcom.com> for his continued work on the Rhino make system.


git-svn-id: svn://10.0.0.236/trunk@41898 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-03 00:25:30 +00:00
mccabe%netscape.com
acd7046b06 Add the classes defined in org/mozilla/classfile to js.jar.
git-svn-id: svn://10.0.0.236/trunk@41806 18797224-902f-48f8-a5cc-f745e15eee43
1999-08-02 09:01:19 +00:00
jband%netscape.com
626574bd3c fix for bug 10998 pointed out by rginda@ix.netcom.com. This was really just a refcounting bug
git-svn-id: svn://10.0.0.236/trunk@41728 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-31 18:53:40 +00:00
briano%netscape.com
40fcdcda46 OpenVMS-specific addition to force a POSIX build of jscpucfg.
git-svn-id: svn://10.0.0.236/trunk@41652 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-31 00:38:25 +00:00
jband%netscape.com
b9048d178d 1) fix the xpconnect factories to not use static objects.
2) add a test that acts as a sample for doing oberloaded methods on xpconnect wraped natives.
3) add a NOT_IMPLEMENTED method to wrapped native for getting the prototype JS object.
4) Set the global object of the JSContext as the wrapped native JSObject's parent when creating this JSObject. This makes JS code compiled against the wrapper actuall work!
5) fix the refcounting on factories in the tests/components module


git-svn-id: svn://10.0.0.236/trunk@41648 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-31 00:26:35 +00:00
jband%netscape.com
3d2fbbfb1c copy in most of the better error reporter from js.c
git-svn-id: svn://10.0.0.236/trunk@41646 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-31 00:19:50 +00:00
briano%netscape.com
2087356d68 Trivial elimination of some pointless macros as discussed in bug 8568. Approved by leaf@mozilla.org.
git-svn-id: svn://10.0.0.236/trunk@41509 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-29 01:18:12 +00:00
brendan%mozilla.org
e0f64c2c6e Fix warnings reported at http://tinderbox.mozilla.org/SeaMonkey/warnings.html, mostly unsigned/signed bothers.
git-svn-id: svn://10.0.0.236/trunk@41445 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-28 06:48:44 +00:00
briano%netscape.com
684f6b2907 Cleaned it up and changed the name of libreg.{a,so} to libmozreg.{a,so} to fix the conflict reported in bug 8568.
git-svn-id: svn://10.0.0.236/trunk@41354 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 23:27:44 +00:00
waldemar%netscape.com
fbd0c2defc Updated for recent semantic engine changes. Changed the meaning of (?= to match Perl.
git-svn-id: svn://10.0.0.236/trunk@41196 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 01:05:59 +00:00
waldemar%netscape.com
a4f0c9a69e Updated for recent semantic engine changes
git-svn-id: svn://10.0.0.236/trunk@41195 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 01:05:27 +00:00
waldemar%netscape.com
ec765d7d20 Implemented partial order for operator precedences. Removed global array functions and reformatted 'length' and 'empty' functions.
git-svn-id: svn://10.0.0.236/trunk@41194 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 01:03:19 +00:00
waldemar%netscape.com
ecdb80d8ef Implemented partial order for operator precedences. Removed global array functions and reformatted 'length' and 'empty' functions. Made lexer-actions into global function calls.
git-svn-id: svn://10.0.0.236/trunk@41193 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 01:02:21 +00:00
waldemar%netscape.com
8043665f0e Made lexer-actions into global function calls
git-svn-id: svn://10.0.0.236/trunk@41192 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 01:00:05 +00:00
waldemar%netscape.com
c326c80d5d Added partial order library
git-svn-id: svn://10.0.0.236/trunk@41191 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 00:58:44 +00:00
waldemar%netscape.com
c60aaadd1e Replaced :unit by :empty-10
git-svn-id: svn://10.0.0.236/trunk@41190 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 00:58:01 +00:00
waldemar%netscape.com
1ee91d2685 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@41188 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 00:57:03 +00:00