Closed Bug 274300 Opened 21 years ago Closed 20 years ago

Hooks should not be able to break event processing

Categories

(Other Applications Graveyard :: ChatZilla, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla-mozilla-20000923, Assigned: bugzilla-mozilla-20000923)

References

()

Details

(Whiteboard: [cz-patch][cz-0.9.68.4])

Attachments

(1 file, 1 obsolete file)

Currently hooks are pretty trusted things - throw a JS exception and the main event loop in ChatZilla stops. V bad. My proposal is to wrap the call to the hook's function in a try/catch, and if an exception occurs use dd() to log the exception to the console, and *continue* processing other hooks (unlike returning false).
I've also noticed the return value of onHook is completely ignored! Perhaps that should be fixed too, so hooks can /actually/ stop events.
Assignee: rginda → silver
Status: NEW → ASSIGNED
Whiteboard: [0.9.68.4]
Blocks: 299458
Attachment #190305 - Flags: review?(rginda)
Comment on attachment 190305 [details] [diff] [review] Catch and handle exceptions in hooks I'd suggest you move the rv test outside of the try/catch block, so that only "rv = hooks[h].f(e);" is left inside. r=rginda with that change.
Attachment #190305 - Flags: review?(rginda)
Attached patch Take twoSplinter Review
Attachment #190305 - Attachment is obsolete: true
Attachment #190340 - Flags: review?(rginda)
Comment on attachment 190340 [details] [diff] [review] Take two r=rginda
Attachment #190340 - Flags: review?(rginda) → review+
Attachment #190340 - Flags: approval1.8b4?
Attachment #190340 - Flags: approval1.8b4? → approval1.8b4+
Checked in --> FIXED.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: [0.9.68.4] → [cz-patch][0.9.68.4]
Whiteboard: [cz-patch][0.9.68.4] → [cz-patch][cz-0.9.68.4]
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: