Closed Bug 459905 Opened 16 years ago Closed 15 years ago

Endless loop of error messages "email is null" in Invite Attendees dialog

Categories

(Calendar :: Sunbird Only, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ssitter, Assigned: Fallen)

Details

(Whiteboard: [not needed beta][no l10n impact])

Attachments

(1 file, 1 obsolete file)

Steps to Reproduce:
===================
1. Start Sunbird with clean profile
2. Create new event and open the invite attendees dialog
3. Enter a simple attendee name like "foo"
4. Select the next attendee line

Actual Results:
===============
The following error is logged to console about one time per second:

Error: email is null
Source File: chrome://calendar/content/sun-calendar-event-dialog-attendees.xml
Line: 598

Expected Results:
=================
No errors

Does not happen when using Lightning 1.0pre (20081014030985) + Thunderbird 3.0b1pre (20081014031016).
Used for testing: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081014 Calendar/1.0pre (BuildID: 20081014045208).
Flags: blocking-calendar1.0+
Summary: Endless loop of error messages "email is null" in sun-calendar-event-dialog-attendees.xml → Endless loop of error messages "email is null" in Invite Attendees dialog
Seems the following happens in onModify():

http://mxr.mozilla.org/comm-central/source/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml#567
>     if (this.mHeaderParser) {
>       this.mHeaderParser.parseHeadersWithArray(
>           fieldValue, emailAddresses, names, fullNames);
>     } else {
>       emailAddresses.value = [ fieldValue ];
>       names.value = [];
>     }
> 
>     if (emailAddresses.value.length > 0) {

The code above is called every second for each attendee row, including the last empty attendee row where fieldValue = "" or null. 

In case of Lightning |this.mHeaderParser| returns true and parseHeadersWithArray() seems to take care of the empty string because |emailAddresses.value.length > 0| is false in that case.

In case of Sunbird |this.mHeaderParser| returns false and the empty string is added in the else branch. |emailAddresses.value.length > 0| is true but breaks with the error from above.

I tried running the code above only |if (fieldValue | is true but that breaks the free/busy for previous entries. Seems that the last empty entry is required somewhere.

Than I tried to use |emailAddresses.value = (fieldValue ? [fieldValue] : []);| in the else branch. This works in the dialog but later the export to ics or copying to clipboard fails.
Note that this breaks the availability lookup for the CalDAV provider and makes the ui quite unresponsive.
Attached patch Fix - v1 (obsolete) — Splinter Review
ssitter, what kind of problems were you experiencing when exporting the event? I had no problems copy/pasting the event to a text editor with this patch applied.
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Attachment #358605 - Flags: review?(ssitter)
Whiteboard: [needs review]
Retested: I had to replace all three occurrences of the line |emailAddresses.value = [ fieldValue ];| otherwise the dialog would not close at all when clicking the OK button. With the change error is gone and the event saves. But export or copying fails. Console showed

[Exception... "'Component not initialized' when calling method: [calIAttendee::icalProperty]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: file:///.../calendar-js/calItemBase.js :: cIB_fillIcalComponentFromBase :: line 881"  data: no]

More test showed that this all seems related to my workflow of using the dialog. I enter the attendee name and press Tab to ensure the name is stored. This creates a second but empty entry. Saving works fine but further operations fail. In addition it is not possible to edit the event and remove the empty entry because this fails with the same error in calIItemBase.
Attached patch Fix - v2Splinter Review
This should do better, please try this patch.
Attachment #358605 - Attachment is obsolete: true
Attachment #359133 - Flags: review?(ssitter)
Attachment #358605 - Flags: review?(ssitter)
Comment on attachment 359133 [details] [diff] [review]
Fix - v2

With this patch the error is gone. But I'm not able to save more than one attendee. They can be entered in the dialog but won't save.
Attachment #359133 - Flags: review?(ssitter) → review-
Whiteboard: [needs review] → [needs updated patch]
Whiteboard: [needs updated patch] → [needs updated patch][not needed beta][no l10n impact]
Whiteboard: [needs updated patch][not needed beta][no l10n impact] → [not needed beta][no l10n impact][needs updated patch]
I tried the following

* Doubleclick on view to open event dialog
* Click on toolbar invite attendees to open attendee dialog
* Add test@example.org as an attendee
* Press tab
* Add test2@example.org as an attendee
* Close attendee dialog
* Save event dialog
* Open event dialog by doubleclick

For me, the two attendees are shown fine. Any extra STR? Maybe a different provider?
I can't reproduce either. It fails in Sunbird 1.0pre (20090220070000) but works in Sunbird 1.0pre (20090222033152). Maybe the issue was fixed by the checkin of attachment 359248 [details] [diff] [review] in Bug 461511.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Whiteboard: [not needed beta][no l10n impact][needs updated patch] → [not needed beta][no l10n impact]
You need to log in before you can comment on or make changes to this bug.