Failures by editing a card with a custom photo

RESOLVED FIXED in Thunderbird 3.0b4

Status

defect
--
major
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Paenglab, Assigned: neil)

Tracking

({fixed-seamonkey2.0, regression})

Bug Flags:
blocking-thunderbird3 +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [no l10n impact])

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE; rv:1.9.3a1pre) Gecko/20090826 Minefield/3.7a1pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a1pre) Gecko/20090829 Lightning/1.0pre Shredder/3.1a1pre

When a custom photo is assigned to a card and I edit some entry and I then want to close this card with OK nothing happens. After close with Cancel and reopen the card no custom image is shown. Now I can select 'Generic Photo' but this will not be saved. Only after reassigning of the photo, I can switch to 'Generic Photo' and save this.

This happens with photos from 'On this Computer' and from 'On the Web'.

I tested it also with 3.0b4pre and had the same behavior.

Reproducible: Always

Steps to Reproduce:
1. Open a card and change to Photo Tab
2. Assign a image with the 'Browse' button 
3. Close the card with the 'OK' button
4. Reopen the card and edit one field on the 'Contact' Tab
5. Close the card with the 'OK' button
Actual Results:  
Card doesn't close. After closing the card through the 'Cancel' button and reopening the card in the error console appears this error: 

Error: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface]
Source file: chrome://messenger/content/addressbook/abCardOverlay.js
Line: 462

The image is no more shown in the 'Photo' Tab, but the changes on the 'Contact' Tab are saved.


Expected Results:  
The card closes and all is correctly saved

By opening of the address book and the card I see also this warnings. Not beautiful but also not evil.

Warning: XUL box for hbox element contained an inline img child, forcing all its children to be wrapped in a block.
Source file: chrome://messenger/content/addressbook/abEditCardDialog.xul
 ----------
Warning: XUL box for hbox element contained an inline img child, forcing all its children to be wrapped in a block.
Source file: chrome://messenger/content/addressbook/addressbook.xul
(Reporter)

Updated

10 years ago
Blocks: 119459
Flags: blocking-thunderbird3?
Keywords: regression
Confirm here on 

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090829 Lightning/1.0pre Shredder/3.0b4pre ID:20090829032304

It happens also if 

4. Reopen the card 
5. Close the card with the 'OK' button
Status: UNCONFIRMED → NEW
Ever confirmed: true
Another information: if I add a new photo with browsing on my computer and click OK the photo is "saved". But when I reopen and I can't click OK but only CANCEL the photo is removed!
Version: unspecified → 3.0

Comment 3

10 years ago
I can reproduce this in the nightlies of latest-comm-trunk and latest-comm-1.9.1 using Windows Vista and will take a look ASAP.  It seemed to work fine in Linux but I'd like to confirm that with my laptop.

If I had to guess I'd say the cause is abCardOverlay.js
http://mxr.mozilla.org/comm-central/source/mail/components/addrbook/content/abCardOverlay.js#578
577   if (type == "file" && document.getElementById("PhotoFile").file)
578     photoURI = "file://" + document.getElementById("PhotoFile").file.path;
That isn't how a file URI should be obtained and would cause the NS_NOINTERFACE error mentioned in post 1.  Windows' slashes are in the opposite direction than URI's...That would explain why it works in Linux (and probably Mac OS).

Steps to Reproduce:
1. In Windows, create a new contact and fill in at least one required field
2. Go to the Photo tab, click Browse, and find and open an image
3. Click OK on the New Contact dialog
4. Edit that new contact
5. Click OK

Expected:
Contact is saved and dialog is closed

Actual:
The dialog stays open
Status: NEW → ASSIGNED

Comment 4

10 years ago
Posted patch Patch (obsolete) — Splinter Review
This patch should fix the problem caused by the code mentioned in my previous comment and replaces that with nsIIOService.

It also doesn't remove the previous photo until the new one is saved in case a problem occurs in savePhoto in the future.
Assignee: nobody → joshgeenen+bugzilla
Attachment #397952 - Flags: review?(neil)
(Assignee)

Comment 5

10 years ago
Posted patch First round of fixes (obsolete) — Splinter Review
This fixes most of my problems from the original patch, although there are still some issues which I will see if I can address in a follow-up patch.
Attachment #398651 - Flags: superreview?(bienvenu)
Attachment #398651 - Flags: review?
(Assignee)

Comment 6

10 years ago
Comment on attachment 398651 [details] [diff] [review]
First round of fixes

Bah, :pi is ambiguous :-(
Attachment #398651 - Flags: review? → review?(joshgeenen+bugzilla)

Comment 7

10 years ago
Comment on attachment 398651 [details] [diff] [review]
First round of fixes

this fixes it for me on Windows w/ TB.
Attachment #398651 - Flags: superreview?(bienvenu) → superreview+

Updated

10 years ago
Attachment #397952 - Flags: review?(neil)

Updated

10 years ago
Assignee: joshgeenen+bugzilla → nobody

Comment 8

10 years ago
Comment on attachment 398651 [details] [diff] [review]
First round of fixes

It fixes the problem (and improves several other things) and works great in Vista and Linux.

>diff -r 85b424089b9f mailnews/addrbook/content/abCardOverlay.xul
>--- a/mailnews/addrbook/content/abCardOverlay.xul	Thu Sep 03 22:35:04 2009 +0100
>+++ b/mailnews/addrbook/content/abCardOverlay.xul	Fri Sep 04 15:01:37 2009 +0100
> <overlay id="editcardOverlay"
>-     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>-     xmlns:html="http://www.w3.org/1999/xhtml">
>+     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
...
>-              <html:img align="center" src="" id="photo"
>-                        style="max-width: 25ch; max-height: 25ch; min-width: 1ch;"/>
...
>+        <vbox align="center" style="min-width: 25ch; max-width: 25ch;">
>+          <image id="photo" style="max-width: 25ch; max-height: 25ch;"/>
>+        </vbox>

The html img tag was there since XUL image elements don't always scale images correct (screenshot coming in a minute).
Attachment #398651 - Flags: review?(joshgeenen+bugzilla) → review+

Comment 9

10 years ago
Shows how the XUL image tag scales a wide image (http://www.mozillamessaging.com/en-US/thunderbird/) vs the HTML img tag in the contact view pane.

Updated

10 years ago
Attachment #397952 - Attachment is obsolete: true
Assignee: nobody → neil
Flags: blocking-thunderbird3? → blocking-thunderbird3+
Target Milestone: --- → Thunderbird 3.0b4
Whiteboard: [no l10n impact]
(Assignee)

Comment 10

10 years ago
Attachment #398952 - Flags: review?(joshgeenen+bugzilla)

Comment 11

10 years ago
Comment on attachment 398952 [details] [diff] [review]
Back to HTML image element

It looks good, thanks for doing this
Attachment #398952 - Flags: review?(joshgeenen+bugzilla) → review+
(Assignee)

Comment 12

10 years ago
Pushed changeset f07bc939cb26 to comm-central.
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Attachment #398651 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.