Closed Bug 68557 Opened 21 years ago Closed 21 years ago

function.caller broken

Categories

(Core :: JavaScript Engine, defect, P2)

x86
Other
defect

Tracking

()

VERIFIED DUPLICATE of bug 65683

People

(Reporter: bht237, Assigned: rogerl)

Details

o.k., it's deprecated. I know. And try{} catch{} is nice, too (theoretically).

But commercial systems without a stack trace in global error handlers just don't
fly because they are not maintainable.

IE4, IE5 and IE5.5 support it (don't know about IE6 - any comments?), so Mozilla
should have it, too.

I think in terms of uncaught exceptions, similar to Java, where a simple
printStackTrace() always does the required job.

JavaScript, the language that we are supposed to use for applications is quite
handicapped in comparison, mainly because of cross-browser compatibility issues.

try{}catch{} cannot even be used today because the syntax throws JavaScript
compile-time errors in the majority of browsers in use today!

Time is running out for Mozilla. We need this stuff  - NOW - in the early
adoption phase where these errors are most likely to occur!

The current situation is highly discouraging from a commercial point of view.

The appplications build out there on the web are likely to use an even more
evolutionary development process than a browser such as Mozilla. Consequently,
errors are a large part of the picture and sooner or later, these errors will
all have to be transmitted back to the server for analysis by the poor person
who is in charge of fixing them.

Yust imagine what this person would think of THE ONLY browser that does not
return the information that is required to perform the job!
Severity: normal → critical
Priority: -- → P2
If you want to use try/catch, you need to specify TYPE="text/javascript;
version=1.5" or LANGUAGE="JavaScript1.5" in the SCRIPT tag.  Just as you would
in 1998 (1.2 instead of 1.5) if you wished to use a switch statement.  This is
nothing new.

/be

*** This bug has been marked as a duplicate of 65683 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Thanks Brendan. I wish I have overlooked something or someone could please help
me wipe Internet Explorer off the planet. I tried the following in IE5.5 but it
doesn't see the script although it supports the try/catch statement:
<!--/*
<SCRIPT LANGUAGE="JavaScript1.5">
*/-->
<SCRIPT TYPE="text/javascript; version=1.5">

function tryStuff(){
    try{
        noSuchFunction();
    }catch(e){
        alert("caught");
    }
}
</SCRIPT>
However, I don't really want to drag anyone into these cross-browser
compatibility problems - that's not my point and I am sure you have better
things to do. I just would like to see the full potential of Mozilla being
usable as soon as possible.
Marking Verified -


I don't know about Microsoft's implementation of JavaScript; I do know that 
IE4.7 can only handle script tags for "JavaScript1.1" and "JavaScript1.2".
NN4.7 can handle Netscape JavaScript implementations 1.1 - 1.3.


Mozilla and N6 cover Netscape JavaScript implementations 1.1 - 1.5.
Status: RESOLVED → VERIFIED
Thanks a lot. I feel a bit guilty following up on this but the subject is more
complicated than it should be.

Microsoft IE5.5 has try/catch support.

However I (and Martin Honnen who I discussed this with in the
comp.lang.javascript NG) do not know of any way that try/catch can be coded even
in a pure Microsoft environment without throwing a compile time error in earlier
versions (IE5.0x and IE4.x) because try/catch can't be hidden.
It just doesn't work like so many other things with this broken piece of software.

Following this logic, try/catch can't be coded on the internet at all if
Microsoft browsers are to be supported.

Given what's left, nt having a functional basic window.onerror and window.caller
(both is currently the case) in Netscape6 and Mozilla is more than just trouble.

It's the combination of facts in real life that makes it so difficult.

Mozilla needs:

1) To be equal in performance with version 4 browsers
1.1) basic window.onerror
1.2) funcion.caller (without warnings in strict mode, please)

2) To be ahead of the rest and future proof
2.1) window.onerror column number 4th parameter

With 1) and 2) implemented, Mozilla will hit the 100% mark and I wouldn't know
what else to ask for. But less than 100% in error handling is pretty useless IMHO.
BHT: if MSIE doesn't support JS versioning well enough to use try/catch, your
server is just going to have to sniff user-agent and serve try/catch-free JS to
the downrev MSIE versions.  If the problem then is the cost of supporting both
versions, just tell users to upgrade -- or stop using try/catch.  For several
years it was possible to write defensive JS without either onerror or try/catch
-- what changed?

Your numbered list needs to correspond to bugs entered in bugzilla.mozilla.org,
or it's just noise.  Can you cite or file bugs?  Also, your comments fit better
in the open bug that this one was dup'ed against -- why comment on a resolved as
duplicate bug?  I'm doing the same, once, to urge you to move to the open bug,
and to cite/file other bugs.

/be
You need to log in before you can comment on or make changes to this bug.