Closed Bug 1595059 Opened 4 months ago Closed 3 months ago

drag contact to another address book fails NS_ERROR_STORAGE_CONSTRAINT: Component returned failure code: 0x80630003

Categories

(MailNews Core :: Address Book, defect)

defect
Not set

Tracking

(thunderbird71 fixed, thunderbird72 fixed)

RESOLVED FIXED
Thunderbird 72.0
Tracking Status
thunderbird71 --- fixed
thunderbird72 --- fixed

People

(Reporter: wsmwk, Assigned: darktrojan)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

NS_ERROR_STORAGE_CONSTRAINT: Component returned failure code: 0x80630003 (NS_ERROR_STORAGE_CONSTRAINT) [mozIStorageStatement.execute] AddrBookDirectory.jsm:745
dropCard resource:///modules/AddrBookDirectory.jsm:745
onDrop chrome://messenger/content/addressbook/abDragDrop.js:334
drop chrome://messenger/content/addressbook/abTrees.js:212

Flags: needinfo?(geoff)

This is basically saying that you already have the card you're copying. But it thinks that because it's replaced the card's unique identifier with "1".

Why did it do that? Because I misread a line of code that was unambiguous until Prettier came along and removed the brackets.

Flags: needinfo?(geoff)
Attached patch 1595059-dropcard-newuid-1.diff (obsolete) — Splinter Review

I don't think there's much worth doing about the mangled UID. No data's been lost, except that card now has a UID of 1.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attachment #9107768 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9107768 [details] [diff] [review]
1595059-dropcard-newuid-1.diff

Review of attachment 9107768 [details] [diff] [review]:
-----------------------------------------------------------------

Why doesn't it have a UID in the first place? Seems we should just cancel the drop if that data was somehow lost
Attachment #9107768 - Flags: review?(mkmelin+mozilla)

It should always have a UID, but you never know. It could be from some weird new address book provider that doesn't automatically assign them. If needToCopyCard is true we assign a new UID so that it doesn't have the same one as the original card.

Attachment #9107768 - Flags: approval-comm-beta?

Sure you can get beta approval, but how about getting review first?

Flags: needinfo?(geoff)
Flags: needinfo?(geoff)
Attachment #9107768 - Flags: review?(mkmelin+mozilla)

(In reply to Geoff Lankow (:darktrojan) from comment #4)

It should always have a UID, but you never know. It could be from some weird new address book provider that doesn't automatically assign them.

I think they do need to have an UID. We should require that.

Attachment #9107768 - Flags: review?(mkmelin+mozilla) → review-

So what do you want me to actually do here?

… bearing in mind that the change I'm proposing just puts the code back how it was before the regression I caused.

Flags: needinfo?(mkmelin+mozilla)

Maybe we just don't want to allow dragging if the card doesn't have an id to begin with (because something's wrong)? Bail out at https://searchfox.org/comm-central/rev/496170162015a8c4a4087c18479279b4ce3b2cbf/mailnews/addrbook/content/abDragDrop.js#90 ?

Wayne, how did you end up with the brokenness?

Flags: needinfo?(mkmelin+mozilla) → needinfo?(vseerror)

I don't know precisely. Best recollection - I had updated beta and my ABs were converted, then simply tried to drag a contact from Personal Address Book to another AB.

Flags: needinfo?(vseerror)

The card does have a UID. The code replaced it with "1" because I screwed up. This patch undoes the screw-up.

What card are we talking about that has the UID=1? So just some temporary flux no end user will see?

The card added to the destination database is given the UID 1. This error is caused at the next call to dropCard, which also assigns UID 1 to a card and tries to add it to the database.

Fortunately all this has caused is preventing the user moving cards from one address book to another, and no real damage.

I see.
Can we make it newCard._uid = needToCopyCard ? newUID() : card.UID;

  • don't allow dragging cards withough UIDs?
Attachment #9107768 - Attachment is obsolete: true
Attachment #9107768 - Flags: approval-comm-beta?
Attachment #9110427 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9110427 [details] [diff] [review]
1595059-dropcard-newuid-2.diff

Review of attachment 9110427 [details] [diff] [review]:
-----------------------------------------------------------------

Thx, r=mkmelin
The commit message could need an update
Attachment #9110427 - Flags: review?(mkmelin+mozilla) → review+
Attachment #9110427 - Flags: approval-comm-beta?

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/aec0ee0dc9f8
Prevent copying an address book card without a UID, and fix copying cards from one book to another; r=mkmelin DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 72.0
Attachment #9110427 - Flags: approval-comm-beta? → approval-comm-beta+
Duplicate of this bug: 1598966
You need to log in before you can comment on or make changes to this bug.