Closed Bug 328508 Opened 18 years ago Closed 18 years ago

JavaScript error after dismiss of last remaining alarm

Categories

(Calendar :: Internal Components, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ssitter, Assigned: jminta)

Details

Attachments

(1 file)

Press the 'Dismiss All' button or press 'Dismiss' button for the last remaining event the following error is displayed in JavaScript console:

  Warning: assignment to undeclared variable item
  Source: chrome://calendar/content/calendar-alarm-dialog.js Line: 79

  Warning: reference to undefined property kid.item
  Source: chrome://calendar/content/calendar-alarm-dialog.js Line: 79

  Error: kid.item has no properties
  Source: chrome://calendar/content/calendar-alarm-dialog.js Line: 79


Note:
I added some dumps and pressed 'Dismiss All' with two alarms in the dialog. The following is displayed in console:

    box=[object XULElement]
    kid=[object XULElement]
    kid.item=[xpconnect wrapped (nsISupports, calIItemBase, calIEvent, 
                                 calIInternalShallowCopy, nsIClassInfo)]
    considering alarm for item:test
     offset:-PT42M, which makes alarm time:2006/02/24 20:18:00 UTC
    now is 2006/02/24 20:18:05 UTC
    test - alarm previously ackd

    kid=[object XULElement]
    kid.item=[xpconnect wrapped (nsISupports, calIItemBase, calIEvent, 
                                 calIInternalShallowCopy, nsIClassInfo)]
    considering alarm for item:title
     offset:-PT42M, which makes alarm time:2006/02/24 20:18:00 UTC
    now is 2006/02/24 20:18:05 UTC
    title - alarm previously ackd

    kid=2
    kid.item=undefined

It seems that the for each (kid in box.childNodes) loop hits more than the two alarm widgets objects.

I think that there is no problem except the error message because alarmLastAck is set for all alarms properly before.
Attached patch check for kid.item — — Splinter Review
Checks to make sure that the child item actually corresponds to an alarm-widget, and not something else, by looking for .item.  Also fixes the strict warning about an undeclared variable.
Assignee: base → jminta
Status: NEW → ASSIGNED
Attachment #213356 - Flags: first-review?(mvl)
Comment on attachment 213356 [details] [diff] [review]
check for kid.item

looks good. r=mvl
(Although i really wonder why there can be a childnode '2')
Attachment #213356 - Flags: first-review?(mvl) → first-review+
patch checked in
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
verified with
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060927 Calendar/0.3a2+
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: