Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Go to file
nboyd%atg.com 82bd85bfce Fix for problem:
Subject:
             Rhino Exception Handling: Inconsistency btw Old/New Versions of 1.5
        Date:
             Mon, 05 Feb 2001 06:07:07 -0800
       From:
             Timothy Bergeron <bergeron@resumerabbit.com>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng




I've been using Rhino for about a year with almost no problems. However,
I downloaded the latest Rhino tip (rhino15R2pre) and discovered a
significant difference in exception handling.

I rely heavily on JavaScript code like the following:

try {
   var em  = new ExceptionMaker();
   em.npe();  // method throws a java.lang.NullPointerException
   //em.ae();  // method throws a Packages.AutomationException
}
catch (e if (e instanceof java.lang.NullPointerException)) {
   java.lang.System.out.println("Caught a NullPointerException");
   e.printStackTrace();
}
catch (e if (e instanceof Packages.AutomationException)) {
   java.lang.System.out.println("Caught an AutomationException");
}
catch (e) {
   java.lang.System.out.println("Caught an unexpected exception: "+e);
}
finally {
   java.lang.System.out.println("Finally!");
}

Previous Rhino versions worked as expected. The exception thrown from
within the host object would be caught and the appropriate actions could
be taken.

With the most recent tip, the thrown exceptions simply are not caught
within the JavaScript. They propagate back to the Java function invoking
the (in my case) Context.evaluateReader() method.

Running the above JS fragement with the older tip displayed the
following stack trace (when the NullPointerException was caught):

Rhino Version: JavaScript-Java 1.5 release 1 2000 03 15
Caught a NullPointerException
java.lang.NullPointerException
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at java.lang.RuntimeException.<init>(RuntimeException.java:39)
        at
java.lang.NullPointerException.<init>(NullPointerException.java:45)
        at ExceptionMaker.jsFunction_npe(ExceptionMaker.java:13)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:497)
        at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1205)
        at org.mozilla.javascript.gen.c1.call(exception.js:3)
        at org.mozilla.javascript.gen.c1.exec(exception.js)
        at
org.mozilla.javascript.Context.evaluateReader(Context.java:739)
        at js.main(js.java:14)
Finally!

When run with the latest tip, the output is:

Rhino Version: JavaScript-Java 1.5 release 1 2000 03
15                                          Finally!
Exception in thread "main" java.lang.NullPointerException
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at java.lang.RuntimeException.<init>(RuntimeException.java:39)
        at
java.lang.NullPointerException.<init>(NullPointerException.java:45)
        at ExceptionMaker.jsFunction_npe(ExceptionMaker.java:13)
        at inv2.invoke()
        at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:843)
        at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:486)
        at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1199)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.gen.c1.exec(Unknown Source)
        at
org.mozilla.javascript.Context.evaluateReader(Context.java:778)
        at js.main(js.java:14)

Curiously, both Rhino versions seem to be returning the same string from
Context.getImplementionVerison();

Anyway, the results from the two runs are clearly different: In the
first case, the exception is thown, the correct catch block is invoked
(hence the stace trace), and the finally block is invoked. In the second
case, the exception is thrown, the finally block is invoked, and the
exception is handled by the calling Java method rather than being
handled by the JavaScript code.

After some research, it appears this change was introducted by a
modification to FunctionObject.call()  (See
http://bugzilla.mozilla.org/show_bug.cgi?id=64788) which used to have:

       try {
            Object result = (method != null)
                            ? method.invoke(thisObj, invokeArgs)
                            : ctor.newInstance(invokeArgs);
            return hasVoidReturn ? Undefined.instance : result;
        }

but now has:

            Object result = method == null ?
ctor.newInstance(invokeArgs)
                                           : doInvoke(thisObj,
invokeArgs);

If I comment out the new code and replace it with the old, the expected
exception handling returns. Is this just an oversight or the new
expected behavior? Are there any negative side effects (other then the
speed decrease in method invocation) if I use the latest tip but use the
old method invocation procedure in FunctionObject.call() rather than the
new?
2001-02-08 18:56:58 +00:00
apache/gzip/src
build adding embedding/components 2001-02-07 04:00:41 +00:00
calendar
caps Optimization for scheme comparison of URIs. See bug 66577 for details. r=darin, sr=brendan@mozilla.org 2001-01-31 01:33:03 +00:00
cck fix for bug#57340; custom components not showing up in build;added additional field 2000-12-08 04:00:29 +00:00
chrome #66450 2001-02-03 00:01:52 +00:00
cmd
config 65845: sr=leaf r=waterson 2001-02-07 02:19:29 +00:00
content Fix hotaix bustage, also see bug 67961. 2001-02-07 13:02:11 +00:00
db remove unused code r/sr mscott,waterson no bug 2001-01-09 22:23:05 +00:00
dbm Tinderbox break - change OS/2 only code - third time is a charm 2000-07-10 20:38:41 +00:00
directory backing out inadvertant checkin; not in default build 2001-02-07 03:32:44 +00:00
docshell A left over change for the optimization in bug 66577. r=mstoltz, sr=shaver, brendan. 2001-02-07 01:14:37 +00:00
dom bug 67527 -- cleaning up psm module registration (both psm 1.x and PIP). r=javi, sr=brendan. 2001-02-06 23:10:16 +00:00
editor preventdefault on drag&drop over non-editable fields 2001-02-07 13:42:24 +00:00
ef
embedding More REQUIRES fixing for senna bustage. 2001-02-07 12:40:35 +00:00
expat Bug 34168, report error instead of crashing if we encounter a parameter entity containing double percent sign. Fix from James Clark. r=nisheeth, a=vidur. 2001-01-04 23:03:32 +00:00
extensions bug 67644, cookies added in wrong order, r=freax@pandora.be, sr=alecf@netscape.com 2001-02-07 01:10:41 +00:00
gc/boehm Bug 61571. Improve speculative RTTI heuristics by adding one more instruction to the signature for typeinfo(). r=brendan, sr=beard 2000-12-06 00:05:45 +00:00
gconfig
gfx r=mkaply, a=blizzard 2001-02-07 03:44:21 +00:00
gfx2 adding imageframe/container to xlib 2001-01-23 20:46:36 +00:00
grendel Added contribution from Ian Clarke. 2000-04-08 06:16:32 +00:00
htmlparser Removing files that are no longer used. Not part of build. 2001-02-07 06:52:24 +00:00
include clean out refs to FALSE: bug 63834 r=bryner sr=brendan 2001-01-26 02:40:12 +00:00
intl Fix for 67978; invalid reg key 2001-02-07 20:10:01 +00:00
java r=ccarlen, sr=rpotts. 65925. making webprogress listeners support weak ref 2001-01-31 21:04:10 +00:00
jpeg Removing dead .toc files. Not part of build. a=sfraser. 2001-01-03 01:32:06 +00:00
js Fix for problem: 2001-02-08 18:56:58 +00:00
js2 add some directories to the common makefile 2001-02-08 06:08:42 +00:00
l10n Messages are downloaded and deleted if user doesn't have write permissions for inbox (by Keyser Sosez, 62480). r=doron sr=mscott 2001-02-07 01:05:51 +00:00
layout fix for #68031. 2001-02-08 17:30:17 +00:00
lib Just correct a comment in this file, which is not part of the default build. 2001-01-22 23:18:50 +00:00
mailnews more work on db view NOT PART OF BUILD 2001-02-08 17:46:54 +00:00
modules Bug 67857 - Profile Mgr resets all prefs which is SLOW. r=racham, sr=alecf 2001-02-07 07:56:10 +00:00
msgsdk
mstone http stuff 2000-05-10 23:20:05 +00:00
netwerk Bug #63193 --> if we can't find a protocol handler for the specified scheme then create the default protocol handler 2001-02-07 05:54:35 +00:00
network/protocol/http
nsprpub fix for bug 66508. r=pinkerton, sr=sfraser. Landing fix from 6.0 branch to detect orderlyDisconnects. 2001-02-07 01:03:35 +00:00
nunet
parser Removing files that are no longer used. Not part of build. 2001-02-07 06:52:24 +00:00
plugin/oji/MRJ MRJPlugin 1.0b2 release. sr=bnesse, r=tnoyes@mac.com 2001-01-26 23:32:56 +00:00
privacy
profile Bug 67857 - Profile Mgr resets all prefs which is SLOW. r=racham, sr=alecf 2001-02-07 07:56:10 +00:00
rdf Fix for 67435. sr=ben 2001-02-07 07:45:36 +00:00
README Adding newline, testing 2000-12-14 15:53:14 +00:00
security First Checked In. 2001-02-08 02:25:25 +00:00
silentdl
string Fix build bustage by removing extra right paren. 2001-02-07 03:04:46 +00:00
suite
sun-java No longer build unused sun-java stubs. r=edburns@acm.org, jeff.dyer@compilercompany.com. 2001-02-03 03:23:55 +00:00
themes Editor overlay smilie menus. r=syd, sr=sfraser, checking in for 2001-02-07 07:52:02 +00:00
timer
tools Add brendan's js regexp fu. 2001-02-08 06:45:38 +00:00
tripledb
uriloader Part of fix for bug 45225. I forget to rename the class nsAppleFileDecoder before the initial checkin. SR=mscott 2001-02-07 06:44:07 +00:00
view Removed unused code in view module. bug 62675 sr=roc+moz r=rods@netscape.com 2001-02-01 06:00:02 +00:00
wallet
webshell removing nsIWebBrowserChrome::FindNamedBrowserItem per 5 Feb 01 API review. functionality has been moved to nsDocShellTreeOwner. r=scc,valeski 2001-02-07 04:59:43 +00:00
webtools Fix for bug 22041: Bug page title now includes bug summary. Patch by st.n@gmx.net (Stephan Niemz (faniz)) 2001-02-02 03:44:47 +00:00
widget fix for 30841. r=pinkerton, sr=hyatt, a=blizzard 2001-02-08 00:44:36 +00:00
xpcom r=dougt, a=blizzard 2001-02-07 04:32:24 +00:00
xpfc
xpfe Bookmarks on personal toolbar don't do anything when clicked. r=jag sr=blizzard (one of the .8 critical bugs) 2001-02-07 20:15:05 +00:00
xpinstall part of backout of dbragg, suggested dveditz, r=dbragg. bug 68001 2001-02-07 20:50:27 +00:00
.cvsignore Ignore .mozconfig.mk and .mozconfig.out (made by client.mk) 2000-03-23 23:29:16 +00:00
aclocal.m4
allmakefiles.sh now building embedding components 2001-02-07 03:09:15 +00:00
client.mak Add a depend target for xpconnect_standalone. No effect on mozilla builds. r=cls 2001-02-01 19:58:12 +00:00
client.mk sed regex needs to be quoted 2001-01-27 18:42:15 +00:00
configure Automated update 2001-02-07 04:00:09 +00:00
configure.in Re-enable the autoconf test that fixes the nsCOMPtr operator== ambiguities on Linux and HP now that we know it works correctly on HP. b=65664 r=scc@mozilla.org sr=brendan@mozilla.org 2001-02-07 03:56:31 +00:00
embed.mak Fixed a few problems building from clean, including missing widget/timer dependency & problems with psm modules when BUILD_PSM is not defined. 2000-12-20 15:06:36 +00:00
embed.mk Second cut at an embedding makefile. This is not part of the seamonkey build. 2000-11-22 18:39:16 +00:00
LEGAL
LICENSE
Makefile.in Fix for bug 64501 - allow embedding apps to specify app registry location. Moves appfilelocprovider into xpcom. r=dougt@netscape.com, sr=brendan@mozilla.org 2001-01-18 22:51:57 +00:00
makefile.win Fix for bug 64501 - allow embedding apps to specify app registry location. Moves appfilelocprovider into xpcom. r=dougt@netscape.com, sr=brendan@mozilla.org 2001-01-18 22:51:57 +00:00
nglayout.mac
nglayout.mk
trex.mak
trex.mk