Closed Bug 342763 Opened 18 years ago Closed 18 years ago

JavaScript errors in scripts in prefpanes not displayed in console

Categories

(Toolkit :: Preferences, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 309814
mozilla1.9alpha1

People

(Reporter: Waldo, Assigned: asaf)

Details

Attachments

(1 file)

This makes fixing bug 340677 a bit more annoying, although so far I've been lucky and mostly just had misplaced or missing commas in object literals which I can find without seeing a useful JS error for them
Attached patch patchSplinter Review
Assignee: nobody → mano
Status: NEW → ASSIGNED
Attachment #241883 - Flags: first-review?(gavin.sharp)
Priority: -- → P3
Target Milestone: --- → mozilla1.9alpha1
Comment on attachment 241883 [details] [diff] [review]
patch

>Index: toolkit/content/widgets/preferences.xml

>+          var event = document.createEvent("Events");
>+          event.initEvent(aEventName, true, true);
>+
>+          // handle dom event handlers
>+          var noCancel = aTarget.dispatchEvent(event);
>+
>+          // handle any xml attribute event handlers
>+          var handler = aTarget.getAttribute("on" + aEventName))

extra ")", no ";"

>+          if (handler != "") {

Why not just if (handler)?

>+            var fn = new Function ("event", handler);
>+            var rv = fn.call(aTarget, event);
>+            if (rv == false)

Get rid of rv and just use |if (fn.call(aTarget, event) == false)| ?

>+              noCancel = false;
>           }
>-          return false;
>+          return noCancel;

Have you tested that any exceptions thrown by the handlers are properly reported? Maybe it's worth catching the exception here and using Component.utils.reportError with a more descriptive message?
Attachment #241883 - Flags: first-review?(gavin.sharp) → first-review-

*** This bug has been marked as a duplicate of 309814 ***
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: