Stop using and remove nsIAbListener
Categories
(MailNews Core :: Address Book, task)
Tracking
(thunderbird_esr78 unaffected)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
People
(Reporter: darktrojan, Assigned: darktrojan)
References
Details
Attachments
(7 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Bug 1633607 added observer service notifications where nsIAbListener notifications are currently used, but did not stop using nsIAbListener. This is a follow-up bug for the transition.
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
Depends on D87209
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D87210
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D87211
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D87212
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D87213
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D87214
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/aa28f395b8c7
Remove uses of nsIAbListener from WebExtensions code. r=mkmelin
https://hg.mozilla.org/comm-central/rev/5bc2249d2953
Remove uses of nsIAbListener from the message header. r=mkmelin
https://hg.mozilla.org/comm-central/rev/cc4f22c4497a
Remove uses of nsIAbListener from the address book UI. r=mkmelin
https://hg.mozilla.org/comm-central/rev/a0c102d5720b
Remove uses of nsIAbListener from the preferences. r=mkmelin
https://hg.mozilla.org/comm-central/rev/89dc87773321
Remove uses of nsIAbListener from GloDa. r=mkmelin
https://hg.mozilla.org/comm-central/rev/fa5517054a95
Remove uses of nsIAbListener in tests. r=mkmelin
https://hg.mozilla.org/comm-central/rev/6ab4b0003806
Remove nsIAbListener. r=mkmelin DONTBUILD
Assignee | ||
Updated•5 years ago
|
@@ -809,44 +799,21 @@ class AddrBookDirectory {
}
}
return false;
}
addCard(card) {
return this.dropCard(card, false);
}
modifyCard(card) {
- let oldProperties = this._loadCardProperties(card.UID);
let newProperties = new Map();
for (let { name, value } of fixIterator(card.properties, Ci.nsIProperty)) {
newProperties.set(name, value);
}
this._saveCardProperties(card);
- for (let [name, oldValue] of oldProperties.entries()) {
- if (name != "LastModifiedDate" && !newProperties.has(name)) {
- MailServices.ab.notifyItemPropertyChanged(card, name, oldValue, null);
- }
- }
- for (let [name, newValue] of newProperties.entries()) {
- if (name == "LastModifiedDate") {
- continue;
- }
- let oldValue = oldProperties.get(name);
- if (oldValue == null && newValue == "") {
- continue;
- }
- if (oldValue != newValue) {
- MailServices.ab.notifyItemPropertyChanged(
- card,
- name,
- oldValue,
- newValue
- );
- }
- }
Any proper add/change/delete mechanism will, for a change, notify of property being changed, oldvalue, newvalue. Is it now impossible for an observer to determine this?
There seems to be a topic "addrbook-contact-changed" without any notification of that topic name, is that intended?
Assignee | ||
Comment 10•4 years ago
|
||
Is it now impossible for an observer to determine this?
Yes. But we don't have any such observers and if we wanted them we could add something to notify them. Also, the notification I'm removing here has only been functional since I replaced the provider December. Before that, the property name and both values were null, which is equally useless, and we coped like that for decades. So I'm not concerned.
Comment 11•4 years ago
|
||
Even in the abstract, a change notifier should always do the right thing; it means an api is featureful, useful, efficient, smart, forward looking. I know it wasn't used internally, maybe if it were some issues of perf would go away.
But in fact, my extension implements, in 78, the missing functionality as described in Bug 460737. Now, instead of updating a cached entry on DisplayName change only, I have to rebuild the entire cache for any ab field change. So I'm requesting you restore the change fields and use the |data| argument as an object, with uid as a member, and change items as additional members.
Comment 12•4 years ago
|
||
What's worse, is that now that checking for and notifying change deltas has been removed, the change notification is sent even though no changes have occurred. It's sent on clicking Done in the message header Edit Contact popup panel, it's sent on OK in the Edit Details ab dialog. It's even sent when clicking Edit Details in the popup panel.
Assignee | ||
Comment 13•4 years ago
|
||
Fine. File a bug and I'll implement a new notification that will tell you the name of any changed property.
Description
•