Open Bug 571174 Opened 16 years ago Updated 3 years ago

syntax error is silently discarded, makes debugging hard

Categories

(Core :: XUL, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: Dolske, Unassigned)

Details

Attachments

(1 file)

See bug 563274, Patch v.3: +function commonDialogOnAccept() { ... +// XXX SOB! leave off a case colon and XUL borks the loading of the whole JS +// file without an error! + // Return textfield values + switch (promptType) { + case "prompt": This script is included via <script src=""> in commonDialog.xul. While writing the patch, I left off the colon in |case "prompt":|, and was frustrated to discover that the script fails to parse but no error was reported. [Of course it took far too much time to figure out what my mistake was.] Not sure if this was the JS engine's fault, or something above it was silently suppressing the error.
When I load this testcase in the browser, my error console shows: Error: missing : after case label Source File: file:///Users/bzbarsky/test.html Line: 5, Column: 8 Source Code: alert("foo passed"); That said, maybe the exact script text of your script is relevant? Can you attach a testcase that uses your exact script text?
Unless I'm missing something, XUL proto globals don't set a JS error reporter. They should do something similar to what XBL does with XBL_ProtoErrorReporter. Compare nsXBLDocGlobalObject::EnsureScriptEnvironment to nsXULPDGlobalObject::EnsureScriptEnvironment So compile-time errors would never be reported for <script> in XUL. I have a hard time believing we don't have bugs on this already, but it should be easy to fix! Justin, do you want to do it?
Assignee: general → nobody
Component: JavaScript Engine → XUL
QA Contact: general → xptoolkit.widgets
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: