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

1035 Коммитов

Автор SHA1 Сообщение Дата
brade%netscape.com fdee7cf9ca remove mac compiler warnings 1999-08-20 13:30:39 +00:00
cls%seawood.org 0991be09fa Removed all references to obsolete OBJDIR variable.
Removed various sections of config.mk & rules.mk that were only used by OBJDIR or by a non-autoconf build.
1999-08-20 06:52:59 +00:00
mgleeson1%netscape.com a16b5c49c6 #
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL.  You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation.  Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.  All Rights
# Reserved.
#

DEPTH		= ../../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

LIBRARY_NAME	= xpconnect
MODULE		= xpconnect

CPPSRCS		= \
		nsXPConnect.cpp \
		xpcarbitrary.cpp \
		xpccomponents.cpp \
		xpccontext.cpp \
		xpcconvert.cpp \
		xpcjsid.cpp \
		xpclog.cpp \
		xpcmaps.cpp \
		xpcmodule.cpp \
		xpcstack.cpp \
		xpcthreadcontext.cpp \
		xpcthrower.cpp \
		xpcwrappedjs.cpp \
		xpcwrappedjsclass.cpp \
		xpcwrappednative.cpp \
		xpcwrappednativeclass.cpp \
		xpcwrappednativejsops.cpp \
		$(NULL)

include $(topsrcdir)/config/config.mk

# XXX hackage!
# only copy the .so to components dir on platforms where xptcall is supported

# Unixish x86
ifneq (,$(filter SunOS Linux FreeBSD NetBSD BSD_OS,$(OS_ARCH)))
ifeq (86,$(findstring 86,$(OS_TEST)))
IS_COMPONENT	= 1
endif
endif

# Neutrino Cross-Compiled for x86
ifneq (,$(filter NTO,$(OS_TARGET)))
ifeq (86,$(findstring 86,$(OS_TEST)))
IS_COMPONENT	= 1
endif
endif

# Solaris/sparc
ifeq ($(OS_ARCH),SunOS)
ifneq (86,$(findstring 86,$(OS_TEST)))
IS_COMPONENT	= 1
endif
endif

# Linux/sparc
ifeq ($(OS_ARCH),Linux)
ifeq ($(OS_TEST),sparc)
IS_COMPONENT    = 1
endif
endif

# NetBSD/m68k
ifeq ($(OS_ARCH),NetBSD)
ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST)))
IS_COMPONENT	= 1
endif
endif

# BeOS/Intel
ifeq ($(OS_ARCH),BeOS)
ifeq ($(OS_TEST),BePC)
IS_COMPONENT	= 1
endif
endif

# HPUX
ifeq ($(OS_ARCH),HP-UX)
ifneq ($(CC),gcc)
IS_COMPONENT	= 1
endif
endif

# AIX
ifeq ($(OS_ARCH),AIX)
IS_COMPONENT	= 1
endif

# IRIX
ifeq ($(OS_ARCH),IRIX)
ifneq ($(basename $(OS_RELEASE)),5)
IS_COMPONENT	= 1
endif
endif

# OpenVMS (Alpha only at this point)
ifeq ($(OS_ARCH),OpenVMS)
ifeq ($(CPU_ARCH),Alpha)
IS_COMPONENT	= 1
endif
endif

# Linux or NetBSD ARM
ifneq (,$(filter Linux NetBSD,$(OS_ARCH)))
ifeq (arm,$(findstring arm,$(OS_TEST)))
IS_COMPONENT	= 1
endif
ifeq (sa110,$(findstring sa110,$(OS_TEST)))
IS_COMPONENT	= 1
endif
endif

include $(topsrcdir)/config/rules.mk

# this is automatically discovered under BeOS
ifneq ($(OS_ARCH),BeOS)
LIBS		+= \
		-lmozjs \
		-lxpcom \
		-lmozreg \
		$(NSPR_LIBS) \
		$(NULL)
endif

DEFINES		+= -DJSFILE -DJS_THREADSAFE
1999-08-19 21:30:47 +00:00
jband%netscape.com 3854fff49d Fixing xptinfo bug with getting information about the type of an interface pointer parameter of a method when the method is inherited from another interface in another typelib file. The api needs to also pass along the method index in order to convey enough information to always give the right answer. Got that? :) Fixing users of this modified api also. 1999-08-19 10:12:30 +00:00
tbogard%aol.net c96570c9fa XPCOM Cleanup: Fixed error checking on AggregatedQueryInterface agruments. 1999-08-19 05:48:10 +00:00
tbogard%aol.net c8c8eea4c0 XPCOM Cleanup: Fixed Aggregation macros in nsAgg.h to do aggregation correctly. Fixed usages and implementation of aggregation using these macros through out the tree. 1999-08-19 05:36:30 +00:00
norris%netscape.com 179e277ffe Add a comment. 1999-08-16 18:54:47 +00:00
beard%netscape.com 2fdb417734 js now propagates ThreadDeath exceptions 1999-08-14 02:32:20 +00:00
beard%netscape.com dcae8601b3 added mozilla/js/rhino/org/mozilla/javascript/tools/shell/SharedGlobal.java 1999-08-14 02:01:00 +00:00
norris%netscape.com f317859421 Fix more importerTopLevel problems. 1999-08-13 20:44:46 +00:00
norris%netscape.com 4ae628be8d Fix problem:
The fix sort of works. But there are some new problems. I enclosed two JavaScript files, button.js and image.js.

If I load button.js first and then image.js, I got the following:

js> load("button.js");
js> load("image.js");
Ambiguous import: [JavaClass javax.swing.ImageIcon] and [JavaClass javax.swing.ImageIcon]
js> load("image.js");
Ambiguous import: [JavaClass java.net.URL] and [JavaClass java.net.URL]
js> load("image.js");
Ambiguous import: [JavaClass java.lang.System] and [JavaClass java.lang.System]
js> load("image.js");
loadImage for 0
Ambiguous import: [JavaClass java.awt.Toolkit] and [JavaClass java.awt.Toolkit]
js> load("image.js");
loadImage for 0
js>

If I load imag.js first and then button.js, I got the following:

js> load("image.js");
loadImage for 0
js: [JavaPackage java.lang.URL] is not a function.
[JavaPackage java.lang.URL] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("button.js");
js: [JavaPackage java.lang.JButton] is not a function.
[JavaPackage java.lang.JButton] is not a function.
js> load("button.js");
js: [JavaPackage java.lang.JButton] is not a function.
[JavaPackage java.lang.JButton] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js>

It looks like something wrong in the image.js file but this should not interfere with button.js. It looks like some arbitary package objects are created, like java.lang.URL. This happened in NativeJavaPackage.get method. If a class of java.lang.URL is not found, a package object is then created. So next time the interpreter encounters URL, it somehow uses the object java.lang.URL instead of the correct class object java.net.URL.. This is one problem. The interference between button.js and jmage.js is another problem.

Howard
  ----- Original Message -----
  From: Norris Boyd
  To: \ Howard\\ Xuhua Lin
  Sent: Thursday, August 12, 1999 12:58 PM
  Subject: Re: ImporterTopLevel problem


  Sorry I've been slow. I finished up the fix this morning and have posted it on the ftp site and checked into cvs.
  Let me know if it works for you.

  --Norris

  \"Howard\" Xuhua Lin wrote:

    Hi, Norris, what's the status of the ImporterTopeLevel problem (i.e if you use importPackage twice, you will get an "Ambiguous import" exception)? Are you still working on it? Howard
1999-08-13 17:25:14 +00:00
norris%netscape.com abc0613496 Fix the following problem:
Subject:
        ImporterTopLevel problem
   Date:
        Fri, 6 Aug 1999 15:42:50 -0400
   From:
        "\"Howard\" Xuhua Lin" <howard@softcom.com>
     To:
        "Norris Boyd" <norris@netscape.com>
    CC:
        "Andrew Wason" <aw@softcom.com>




Hi, The following script will cause an EvaluatorException: Ambiguous import: [JavaPackage java.awt.JButton] and [JavaPackage
java.awt.Packages.javax.swing.JButton] in the js shell:

js>importPackage(java.awt);
js>importPackage(Packages.javax.swing);
js>new JButton();.

The current JS shell will not print this exception message, even though the comment says "// Already printed message, so just fall
through". I add System.err.println(ee.getMessage()); for this exception.

The problem is that in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, a
NativeJavaPackage object is created and passed back to ImporterTopLevel.get Method. So in ImporterTopLevel.get method, object v
is always not NOT_FOUND and the ambiguous exception will be thrown. Object v is supposed to be a Class object but it actually is
a Package object.

The fix can be either (1) in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, return a
NOT_FOUND object (you may still create a Package object) or (2) in ImporterTopLevel.get method, make sure the returned object
from NativeJavaPackage.get method is of NativeJavaClass type.

Howard
1999-08-12 16:59:29 +00:00
rogerl%netscape.com 0fb847d2e5 Converting value type for setter method to match declared type. 1999-08-11 18:33:48 +00:00
rogerl%netscape.com f7d87ad41d Factored out convertArg so that it can be called from ScriptableObject
for setter methods.
1999-08-11 18:31:34 +00:00
rogerl%netscape.com 1d17ab4d1f Undo captures from failed OPT child 1999-08-11 04:34:52 +00:00
rogerl%netscape.com 6c61f8bdb0 Tentative fix for allowing call to 'exec' on RegExp objects. 1999-08-11 04:34:05 +00:00
rogerl%netscape.com 949625b502 Fix 'zero' & 'one' to use byte instead of Double 1999-08-11 04:33:08 +00:00
rogerl%netscape.com 6734615a71 Fixed lastIndex test - value is ignored for non-global regexp. 1999-08-11 04:31:19 +00:00
rogerl%netscape.com d7aeb2cd5a Fixed limit parameter interpretation to match ecma_2 spec. 1999-08-10 23:36:23 +00:00
rogerl%netscape.com 0c0ff5606b Fixed test results to match new spec. 1999-08-10 19:25:00 +00:00
rogerl%netscape.com 499ee153d4 Re-wrote the string_split algorithm to match new spec. 1999-08-10 18:36:46 +00:00
mccabe%netscape.com d6e7410f31 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.
1999-08-10 12:18:01 +00:00
jband%netscape.com 28a2bd53f1 updating tests 1999-08-10 06:12:06 +00:00
toshok%hungry.com f8a04a2364 we need keyCompare functions to these hashtables. 1999-08-10 05:25:14 +00:00
jband%netscape.com 3f75ebc9ff adding enumeration of CLSIDs and ProgIDs using code from Robert Ginda <rginda@ix.netcom.com> 1999-08-09 05:02:25 +00:00
brendan%mozilla.org 45c305e973 - 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.
1999-08-08 02:32:00 +00:00
jband%netscape.com bb288dc200 add JS based test for nsISupportsPrimitives. Run using 'xpcshell xpctest_primitive.js' 1999-08-06 09:43:45 +00:00
norris%netscape.com 00f712e786 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);
1999-08-05 16:49:20 +00:00
rogerl%netscape.com cc0f36d7ec Fixed tests for back-reference case 1999-08-04 23:40:13 +00:00
rogerl%netscape.com bddae3b849 Fixed off by one error and expected output text. 1999-08-04 23:38:34 +00:00
norris%netscape.com 7c5ca20070 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
1999-08-04 23:14:57 +00:00
rogerl%netscape.com 729d969253 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.
1999-08-04 22:27:31 +00:00
rogerl%netscape.com c93ef4e649 Missing '\' before \n. Trailing '|' in expected output was not correct. 1999-08-04 22:26:07 +00:00
rogerl%netscape.com 1355cfb383 Was using 'g' flag instead of 'm' and wasn't really testing the multiline
functionality (assuming I interpreted the intent correctly).
1999-08-04 22:24:57 +00:00
rogerl%netscape.com d47169e539 Added Linux/sparc component 1999-08-04 20:46:58 +00:00
norris%netscape.com 452bf1af92 Fix bug 11077 "ScriptableObject.defineFunctionProperties() uses invalid signature check."
The check was actually okay, but the error message didn't state the error correctly.
1999-08-04 19:37:51 +00:00
norris%netscape.com b8ad6df8ca * 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
1999-08-04 17:43:18 +00:00
norris%netscape.com 94b8197903 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
1999-08-04 16:56:18 +00:00
jband%netscape.com eb1a8d0cf3 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 1999-08-04 06:22:27 +00:00
mccabe%netscape.com 6618e19762 Added missing ImporterTopLevel.java and ListenerCollection.java files to the source list.
Thanks to Andrew Wason <aw@softcom.com> for noticing this problem.
1999-08-04 02:50:47 +00:00
rogerl%netscape.com 5e4cc01584 Updated internal name of exec function to match new naming rules. 1999-08-03 22:41:57 +00:00
mccabe%netscape.com 56ac346458 - 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.
1999-08-03 22:15:02 +00:00
norris%netscape.com 14d89e5bff 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
1999-08-03 21:24:39 +00:00
norris%netscape.com e48746d3bd Remove unused clone() method. 1999-08-03 20:40:25 +00:00
rogerl%netscape.com 49598375a1 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.
1999-08-03 00:51:23 +00:00
mccabe%netscape.com 71d9e10c3c 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.
1999-08-03 00:25:30 +00:00
mccabe%netscape.com 3824e4ce66 Add the classes defined in org/mozilla/classfile to js.jar. 1999-08-02 09:01:19 +00:00
jband%netscape.com 1e78c7d4c9 fix for bug 10998 pointed out by rginda@ix.netcom.com. This was really just a refcounting bug 1999-07-31 18:53:40 +00:00
briano%netscape.com b1ebcd6eb3 OpenVMS-specific addition to force a POSIX build of jscpucfg. 1999-07-31 00:38:25 +00:00
jband%netscape.com dce27dd602 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
1999-07-31 00:26:35 +00:00