Closed Bug 324142 Opened 19 years ago Closed 18 years ago

[FIX]Chrome javascript syntax errors not shown in javascript console

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha3

People

(Reporter: mossop, Assigned: bzbarsky)

References

Details

(Keywords: regression)

Attachments

(3 files)

Certain errors in chrome JavaScript files are no longer shown in the JavaScript console. These errors are the kind that basically makes the whole JavaScript file unusable because of syntax errors. An example of an error that causes this is: function badfunction(var badargument) { } I will attach a testcase that demonstrates the problem.
Web pages work as expected, this error only exists for chrome scripts (making extension development quite a challenge). This extensions simply adds an overlay to the main browser that loads a bad script. Firefox 1.5 shows the following error in the JavaScript console: Error: missing formal parameter Source File: chrome://test/content/browser.js Line: 45, Column: 25 Source Code: function broken_function(var badargument) Current trunk builds show no error in the console. The regression occured between the nightly of 28th Nov and 29th Nov, which is the following checkins: http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2005-11-28+05%3A00&maxdate=2005-11-29+05%3A30&cvsroot=%2Fcvsroot
Blake, bug 317476 and bug 317533 are the only JavaScript checkins I can see in this range, can you shed any light here?
Neither of those should have affected reporting of errors (except those reported through JS_ReportError, and then only for the better). I think I blame another checkin, though I haven't verified this at all.
Maybe this should be in a Core component... This is also happening in other apps (Thunderbird, Sunbird), so it is not specific to Firefox. It's pretty frustrating. The only clue may be an error that just says "xxx is not defined" for some function xxx, such as onLoad --- a syntax error anywhere in a javascript file prevented the whole file from being evaluated. (Has anyone found workarounds for diagnosing the syntax error once you guess that one exists? My current diagnosis technique is to paste the whole file into Javascript Shell, which tells me if there is a syntax error but not where it is, so I have to do binary search pasting parts of the file to localize it.)
My current workaround involves opening the same extension in Firefox 1.5 and looking in the javascript console. Hardly efficient
Assignee: nobody → js-console
Product: Firefox → Core
QA Contact: javascript.console → jrgmorrison
Assignee: js-console → general
Component: JavaScript Console → JavaScript Engine
QA Contact: jrgmorrison → general
I can confirm this bug in the XULRunner nightly of 2006/05/15. Very annoying when trying to develop a XULRunner app as well (especially as it's no extension and the code is less easy to try in Firefox).
Related to bug 344335?
Flags: blocking1.9a1?
This is the probably the same as bug 344335 - the only difference is that this bug says it's being chrome that causes the problem while that one says it's being XUL that causes the problem (and includes a content XUL testcase to prove it).
*** Bug 344335 has been marked as a duplicate of this bug. ***
Is this trunk only, or is the 1.8 branch regressed too? /be
(In reply to comment #10) > Is this trunk only, or is the 1.8 branch regressed too? Appears to be trunk only. The testcase from this and bug 344335 correctly show errors in a current Firefox 2b2 build.
Flags: blocking1.9a1? → blocking1.9-
Whiteboard: [wanted-1.9]
I think the interesting change in this regression range is in nsJSEnvironment.cpp which now tries to use a win, instead of the global object. Is it possible we should fall back on using the global object if no win is available (or fallback on printf or SOMETHING)? Adding jst to cc:
Assignee: general → crowder
Status: NEW → ASSIGNED
OS: Windows XP → All
Hardware: PC → All
FWIW, I don't see them on the (shell) console in opt either, but in debug builds.
And yeah, this is a regression from bug 316794.
Blocks: 316794
Attached patch Same as diff -wSplinter Review
Basically, in this case the global is a XUL proto global. So it's not at all a window, but it's a perfectly fine global object we can use for everything except the onerror event.
Attachment #256959 - Flags: superreview?(jst)
Attachment #256959 - Flags: review?(jst)
Assignee: crowder → bzbarsky
Status: ASSIGNED → NEW
Component: JavaScript Engine → DOM
Priority: -- → P2
Summary: Chrome javascript syntax errors not shown in javascript console → [FIX]Chrome javascript syntax errors not shown in javascript console
Target Milestone: --- → mozilla1.9alpha3
This fixes it for me. Thanks! before patch: debug: shell console: yes JS console: no opt: shell console: no JS console: no (!) after patch: opt: shell console: no JS console: yes (!) debug: shell console: yes JS console: yes Nice would be to also output it on shell console in opt when dump is enabled - I'd assume it would be there: if I get all my own debug crap, I surely want to know about JS syntax errors there, and I don't have the JS console open always. But that may be controversial, I don't know.
Component: DOM → JavaScript Engine
Priority: P2 → --
Summary: [FIX]Chrome javascript syntax errors not shown in javascript console → Chrome javascript syntax errors not shown in javascript console
Target Milestone: mozilla1.9alpha3 → ---
Status: NEW → ASSIGNED
Component: JavaScript Engine → DOM
Priority: -- → P2
Summary: Chrome javascript syntax errors not shown in javascript console → [FIX]Chrome javascript syntax errors not shown in javascript console
Target Milestone: --- → mozilla1.9alpha3
Handing off to bz, since he coded the patch. Feel free to toss it back if you'd like me to land it or handle nits, etc.
Status: ASSIGNED → NEW
Attachment #256959 - Flags: superreview?(jst)
Attachment #256959 - Flags: superreview+
Attachment #256959 - Flags: review?(jst)
Attachment #256959 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: