Commit Graph

59085 Commits

Author SHA1 Message Date
putterman%netscape.com
e25d9a73e7 Backing out troy's changes to fix various UI blocker bugs. 2000-04-24 22:21:56 +00:00
putterman%netscape.com
42e26161e8 Backing out troy's changes to fix various UI blocker bugs. 2000-04-24 22:15:55 +00:00
putterman%netscape.com
f6b930c9e6 backing out troy's changes to fix various ui not working blocker bugs. 2000-04-24 22:05:39 +00:00
rginda%netscape.com
cdf10d48f2 adding comments 2000-04-24 21:43:49 +00:00
rpallath%eng.sun.com
e6fe7452fe modified README 2000-04-24 21:28:42 +00:00
rginda%netscape.com
9366e18dd5 NotARegister check in GenericBranch::print() 2000-04-24 20:08:16 +00:00
norris%netscape.com
600d365e30 Patch from Matthias Radestock <rade@logee.com>:
Subject:
             JavaAdapter return type conversion
        Date:
             Wed, 19 Apr 2000 12:12:47 +0100
       From:
             Matthias Radestock <rade@logee.com>
 Organization:
             Logee
         To:
             norris@netscape.com
         CC:
             mccabe@netscape.com, beard@netscape.com, rogerl@netscape.com




Dear Rhino team,

When returning an array from a scripted Java object (i.e. a JS object
that implements a Java interface), no type conversion is performed, ie.
a NativeArray is returned instead of a Java array. Example:

Java:
interface Foo {
        public String[] boo();
        }

JS:
FooI = {
        boo: function() { return ["Boo"];}
        }
myFoo = new Packages.Foo(FooI);
myFoo.boo(); //==> breaks with a ClassCastException


Looking at the JavaAdapter code, there is no code for array conversion.
This is particularly bad because precisely such a conversion *does*
happen when calling a Java method from JS. So we end up with a
discrepancy.

See attachment for a patch to fix this and little test program. The
patch works by calling the coerceType function on NativeJavaObject,
which is the function responsible for doing the conversion when calling
from JS to Java. I've simplified the code so that this function gets
called for all non-primitive return type, not just arrays. There are
probably more efficient solutions but I'm not a Java bytecode hacker.


Matthias
PS: I didn't open a bug for this because I wasn't sure whether you guys
would agree that this is indeed a problem ;)





public interface JSReturnTest {

  public boolean returnBoolean();
  public char returnChar();
  public int returnInt();
  public String returnString();
  public org.mozilla.javascript.Scriptable returnScriptable();
  public Object returnObject();
  public boolean[] returnBooleanA();
  public char[] returnCharA();
  public int[] returnIntA();
  public String[] returnStringA();
  public org.mozilla.javascript.Scriptable[] returnScriptableA();
  public Object[] returnObjectA();
  public Object[][] returnObjectAA();
}




Index: JavaAdapter.java
===================================================================
RCS file: /cvsroot/mozilla/js/rhino/org/mozilla/javascript/JavaAdapter.java,v
retrieving revision 1.21
diff -r1.21 JavaAdapter.java
54c54,59
<
---
>
>     public static Object convertResult(Object result, String classname)
>     throws ClassNotFoundException {
>         return NativeJavaObject.coerceType(Class.forName(classname),
>                                            result);
>     }
467,474c472,474
<         } else  if (retType.equals(String.class)) {
<             cfw.add(ByteCode.INVOKESTATIC,
<                     "org/mozilla/javascript/Context",
<                     "toString", "(Ljava/lang/Object;)",
<                     "Ljava/lang/String;");
<             cfw.add(ByteCode.ARETURN);
<         } else if (retType.equals(Scriptable.class)) {
<             cfw.add(ByteCode.ALOAD_0);  // load 'this' to find scope from
---
>         } else {
>             String retTypeStr = retType.getName();
>             cfw.addLoadConstant(retTypeStr);
476,477c476,477
<                     "org/mozilla/javascript/Context",
<                     "toObject",
---
>                     "org/mozilla/javascript/JavaAdapter",
>                     "convertResult",
479,500c479,480
<                      "Lorg/mozilla/javascript/Scriptable;)",
<                     "Lorg/mozilla/javascript/Scriptable;");
<             cfw.add(ByteCode.ARETURN);
<         } else {
<             // If it is a wrapped type, cast to Wrapper and call unwrap()
<             cfw.add(ByteCode.DUP);
<             cfw.add(ByteCode.INSTANCEOF, "org/mozilla/javascript/Wrapper");
<             // skip 3 for IFEQ, 3 for CHECKCAST, and 5 for INVOKEINTERFACE
<             cfw.add(ByteCode.IFEQ, 11);
<             cfw.add(ByteCode.CHECKCAST, "org/mozilla/javascript/Wrapper");
<             cfw.add(ByteCode.INVOKEINTERFACE,
<                     "org/mozilla/javascript/Wrapper",
<                     "unwrap", "()", "Ljava/lang/Object;");
<
<             // If Undefined, return null
<             cfw.add(ByteCode.DUP);
<             cfw.add(ByteCode.INSTANCEOF, "org/mozilla/javascript/Undefined");
<             // skip 3 for IFEQ, 1 for ACONST_NULL, 1 for ARETURN
<             cfw.add(ByteCode.IFEQ, 5);
<             cfw.add(ByteCode.ACONST_NULL);
<             cfw.add(ByteCode.ARETURN);
<
---
>                     "Ljava/lang/String;)",
>                     "Ljava/lang/Object;");
502,503c482
<             String retTypeStr = retType.getName().replace('.', '/');
<             cfw.add(ByteCode.CHECKCAST, retTypeStr);
---
>             cfw.add(ByteCode.CHECKCAST, retTypeStr.replace('.', '/'));



   testpatch.js

               Name:
                     testpatch.js
                Type:
                     JavaScript Program (application/x-javascript)
             Encoding:
                     7bit
2000-04-24 19:36:51 +00:00
rpallath%eng.sun.com
59eca4c85a New Tests for getAlignment 2000-04-24 19:02:42 +00:00
rpallath%eng.sun.com
c3291b195e getAlignment tests for API -> LEFT 2000-04-24 18:58:18 +00:00
rpallath%eng.sun.com
1adee25c28 GetAlignment API tests 2000-04-24 18:55:25 +00:00
rpallath%eng.sun.com
171e857827 New files for Killer app on Win32 2000-04-24 18:52:40 +00:00
rginda%netscape.com
9c545008e5 quieting linux warnings 2000-04-24 18:41:05 +00:00
rpallath%eng.sun.com
b381bf0be3 Added README and BWTest.lst
Updated some test cases
2000-04-24 18:25:27 +00:00
brade%netscape.com
b46ef0737b fixing build bustage; submitted by Philip.Blundell@pobox.com (a=granrose) 2000-04-24 15:42:15 +00:00
dveditz%netscape.com
8789b40a77 fixing clobber bustage 2000-04-24 15:03:47 +00:00
ftang%netscape.com
9f75eb5a87 Change the implementation to use nsILocalFile as the first step to fix
non ASCII problem. We will change to use the unicode version of the method in the
near future. The unicode version is put in the comment for now. After we validate the
nsILocalFile version have no problem. We will switch to it's unicode version of method
r=dougt
2000-04-24 14:51:48 +00:00
dcone%netscape.com
262b63dad4 Round the stikewidth properly.. instead of truncation. 2000-04-24 14:32:58 +00:00
dveditz%netscape.com
64d77c0aef First cut at chrome install 2000-04-24 13:53:38 +00:00
dveditz%netscape.com
15bbd2c7a4 added missing dependency 2000-04-24 13:36:06 +00:00
dcone%netscape.com
06fccd4174 Adjusted the subscript height for the font. 2000-04-24 13:34:07 +00:00
jfrancis%netscape.com
c207f78168 lots of improvements to block transformations: 1) looks inside inlines for breaks; 2) fixes the "extra break when unlisting" bug 3) changing paragraph style to normal consistently gets breaks 4) any splitting needed occurs when blocks inserted plus a lot of small bug fixes 2000-04-24 11:51:12 +00:00
rjc%netscape.com
fc8da5b029 Remove "category.rdf"... its been replaced with "search.rdf" which is now in the default profile directory. 2000-04-24 09:39:40 +00:00
rjc%netscape.com
27b2ab9c87 When downloading new search engines/images, check HTTP status against 200 level success. 2000-04-24 08:49:59 +00:00
alecf%netscape.com
14539e2d9f fix strres js so that the string bundle service is retrieved via getService, not createInstance()
(otherwise there were 2 createinstances for every creation of a stringbundle!)
2000-04-24 08:04:06 +00:00
rickg%netscape.com
634e686818 more WIP on strict DTD 2000-04-24 07:35:37 +00:00
tbogard%aol.net
4e41e11bd7 Added getContentDocShell to allow access to the browser docShell. 2000-04-24 06:31:30 +00:00
rickg%netscape.com
9590b2c4d4 first pass (of many) to bring us into alignment with Strict DTD 2000-04-24 06:09:04 +00:00
dougt%netscape.com
b63f84a202 Adding critical check for null.
removing unneded assignment to temp var.
2000-04-24 06:08:48 +00:00
sspitzer%netscape.com
a5bf878c6b fix warnings, remove unused code. 2000-04-24 05:37:34 +00:00
sspitzer%netscape.com
94a652a4bd fix for #14313, don't migrate on top of an existing directory. 2000-04-24 05:28:49 +00:00
scc%netscape.com
4fc9172ea9 makings string conversions explicit 2000-04-24 05:19:20 +00:00
scc%netscape.com
3f0250495b making string conversions explicit 2000-04-24 05:11:18 +00:00
tbogard%aol.net
1a7002f08c Added comment for when to add win_start in just like the win_stop. 2000-04-24 05:06:51 +00:00
tbogard%aol.net
7b4745b063 Added new flag for a timed out net connection. 2000-04-24 05:03:49 +00:00
tbogard%aol.net
9ef4ea40e7 Instead of getting the interface off the treeowner, do a GetInterface off the docShell to get a prompter. 2000-04-24 05:00:34 +00:00
scc%netscape.com
5187e669d8 making string conversions explicit 2000-04-24 04:55:38 +00:00
scc%netscape.com
8a404c62cc making string conversions explicit 2000-04-24 04:47:32 +00:00
joki%netscape.com
bbb0086bfe fixes for 5995, 7304, 10573, 22832, and 9668.
Changes to event handling to deal with reentrant events, cursor fixes, and return value fixes.
2000-04-24 04:41:27 +00:00
scc%netscape.com
c938845535 making string conversions explicit 2000-04-24 04:36:57 +00:00
dcone%netscape.com
da4105b736 Put in the Tiling call from the RenderingContextImpl. 2000-04-24 04:36:05 +00:00
waterson%netscape.com
05bfe47153 Bug 35815. Implement <bindings> for XUL templates. 2000-04-24 04:22:26 +00:00
conrad%ingress.com
3d07f48e15 Made access paths within the CW folder more specific. 2000-04-24 03:49:08 +00:00
conrad%ingress.com
9c83923bc7 In SetTopLevelWindow, no longer calling AddProgressListener. This is redundant because the call to nsIWebBrowser::SetTopLevelWindow already makes the chrome the progress listening parent. The redundancy makes each of the nsIWebProgressListener methods in the chrome get called an extra time. 2000-04-24 03:47:43 +00:00
bienvenu%netscape.com
1cd3759e93 avoid cell api's, get yarn directly from column, performance win, r=waterson 2000-04-24 03:42:15 +00:00
conrad%ingress.com
cb2d3585f7 Removed BeginDocumentLoad/EndDocumentLoad. This functionality is handled by OnStatusNetStart/OnStatusNetStop. 2000-04-24 03:40:53 +00:00
conrad%ingress.com
a883264dcd Removed implementation of nsIDocumentLoaderObserver. Its functionality is now handled by nsIWebProgressListener. 2000-04-24 03:37:55 +00:00
conrad%ingress.com
0003fa9f28 1. Removed implementation of nsIDocumentLoaderObserver. Its functionality is now handled by nsIWebProgressListener. 2. Fixed OnStatusChange. More than one status bit could be set and it was not handling this. 2000-04-24 03:37:10 +00:00
dougt%netscape.com
c0b55af16c Fix for bug 35751. Caching type and creator information for nsLocalFileMac. This is so that files can be created with a given type/creator tag after the initialization of the ifile.. r=warren and sfraser. 2000-04-24 03:24:49 +00:00
sspitzer%netscape.com
3c304df995 fix build bustage. 2000-04-24 03:15:52 +00:00
cata%netscape.com
027a868fef Fixing tree bustage. 2000-04-24 03:13:46 +00:00