Closed Bug 237323 Opened 22 years ago Closed 22 years ago

Venkman debugger: Script error should act the same as a break point.

Categories

(Core :: DOM: Core & HTML, defect)

1.4 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bht237, Unassigned)

Details

Attachments

(1 file)

1) In Netscape 4.7 with its Java applet based debugger jsdebug, it is possible to set up an environment where on a script error, the debugger gets on top and presents a dialog to either pass the error on or to debug it. When debug is slected, then the file is opened and the cursor is located on the offending line of code. This is a very effective way of analysing existing or discovering new bugs. Even if the debugger is not loaded, user_pref("javascript.console.open_on_error", true); alone opens the script console on top so any error can be examined exactly when it happens, not only when the programmer choses to open the console, which might be too late. 2) Furthermore, in an earlier version of Mozilla, it was possible to show script errors in the script console even when an error handler such as onerror=new Function("return true"); was in effect. This allowed to quickly locate errors that must be hidden from users in production sites where it is not possible to alter the code. Please refer to "window.onerror not passing error to JS console" http://bugzilla.mozilla.org/show_bug.cgi?id=197615 The lack of 1) and 2) reduces the potential value of venkman in spite of its powerful features. This is about 1) primarily. Please use the attached testcase to verify and to experiment. prefs.js -------- Mozilla: user_pref("javascript.options.strict", true); user_pref("javascript.options.werror", false); Netscape 4.7: user_pref("javascript.console.open_on_error", true);
This bug is confusingly written (what is a "break point"? what does onerror have to do with Venkman?), and it's not about any JS engine deficiency, as far as I can tell. Please include complete step-by-step instructions to reproduce the symptom you think shows a bug. It's important to note that Netscape 4.x predates ECMA-262 Edition 3, which has errors thrown as exceptions. The never-standardized-by-w3c window.onerror handler used to run in 4.x when the error was reported. In Mozilla, the error is thrown as an exception so it may be caught by script, and reported only if nothing catches it before control unwinds to outermost call into the JS API, from DOM C++ code. So the only chance to intercept control flow at the point where the error as exception is thrown is via venkman. You can't expect window.onerror to be called at that point. /be
Assignee: general → dom_bugs
Assignee: dom_bugs → general
Still, if window.onerror isn't being called at all, when the exception unwinds and is reported, that's a DOM level 0 bug. /be
Component: JavaScript Engine → DOM: Level 0
OS: Windows 98 → All
Hardware: PC → All
My apologies for any confusion caused by the way this testcase is written. It was meant to be used for experimentation. I don't know whether this is a Venkman bug or DOM. I think I have raised it with the JavaScript debugger component because it doesn't behave as expected, but honestly I wouldn't have a clue where the problem is. To reproduce the error, please proceed as follows: - Open Mozilla - Open the venkman debugger - Load the testcase from your local file system Result: Some alerts pop up that demonstrate the general error handling behavior. - Comment out the alerts in the testcase source so that they cannot (potentially) steal the top position of the debugger. - Reload the testcase. Expected behavior The debugger should: - set itself on top and interrupt execution - load the source code into its source code window - highlight the offending line of code - allow the programmer to examine variables etc. Actual behavior: The debugger remains inactive; nothing of the above happens. Important note: Commercial web solutions require that the user is not shown any JavaScript error messages even if they do occur. In IE and Netscape 4, the user can configure the javascript console/error dialog to pop-up on every error. This is usually avoided by a global error handler that returns true. However it is also a commercial requirement that a developer can see and debug the corresponding errors without having to change the source code e.g. the error handler of the site that is being debugged. So to meet these commercial requirements, the debugger must be able to halt execution EVEN if an error handler such as onerror=new Function("return true"); is active. I am sorry that I raise all the issues here at once, and they may in fact seem confusing, but IMHO they are worth considering in order to obtain a robust result that does not break down under these basic conditions.
Summary: Script error should act the same as a break point. → Venkman debugger: Script error should act the same as a break point.
Debug > Error Trigger > Stop for Errors doesn't that menu item do what you want?
Thanks Christopher, it does exactly what I want. And my apologies for the invalid bug. Would it not be useful to have this option swiched on as a default so that new users get it? I say so because the primary purpose of a debugger is to find bugs and not to ignore them.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: