convert Mutation Events to use MutationObserver in mail/

RESOLVED FIXED in Thunderbird 20.0

Status

Thunderbird
Mail Window Front End
RESOLVED FIXED
5 years ago
a month ago

People

(Reporter: Magnus Melin, Assigned: Magnus Melin)

Tracking

Trunk
Thunderbird 20.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

12.99 KB, patch
mconley
: review+
Details | Diff | Splinter Review
(Assignee)

Description

5 years ago
Created attachment 677870 [details] [diff] [review]
proposed fix

Check the error console. You'll see a warning

Warning: Use of Mutation Events is deprecated. Use MutationObserver instead.
Source File: chrome://messenger/content/msgMail3PaneWindow.js
Line: 944

This patch get rid of the mutation events, should be a small perf win. I didn't touch the im/ parts, at least yet.

The _setMenuitemAttributes method is (almost) copy-pasted from firefox.

(Firefox doesn't yes use a mutationobserver in tabbrowser.xml looks like they manually call a method to produce TabAttrModified events which looks tedious.)
Attachment #677870 - Flags: review?(mconley)
Comment on attachment 677870 [details] [diff] [review]
proposed fix

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

Looks good to me - glad to see old cruft getting removed. Just a style nit. r=me with that fixed. Thanks!

::: mail/base/content/msgMail3PaneWindow.js
@@ +931,5 @@
> +  // whenever attributes on the columns change.
> +  let observer = new MutationObserver(function handleMutations(mutations) {
> +    gFolderDisplay.hintColumnsChanged();
> +  });
> +  observer.observe(document.getElementById("threadCols"),

I'd prefer the style I laid out in tabmail.xml.

::: mail/base/content/tabmail.xml
@@ +2526,5 @@
>          var tabcontainer = tabmail.tabContainer;
>          var tabs = tabcontainer.childNodes;
>  
>          // Listen for changes in the tab bar.
> +        this._mutationObserver.observe(tabcontainer,

I think I'd prefer:

this._mutationObserver.observe(tabcontainer, {
  attributes: true,
  subtree: true,
  attributeFilter: ["label", ...];
});
Attachment #677870 - Flags: review?(mconley) → review+
(Assignee)

Comment 2

5 years ago
https://hg.mozilla.org/comm-central/rev/f61698f08e77 -> FIXED
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 19.0
Backed out due to suspected Mozmill perma-orange:

https://hg.mozilla.org/comm-central/rev/ee9a1e889d12

TEST-START | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test_column_defaults_inherit_from_inbox
Test Failure: Found visible column 'dateCol' but was expecting 'tagsCol'!
desired list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,tagsCol
 actual list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,dateCol
TEST-UNEXPECTED-FAIL | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test-columns.js::test_column_defaults_inherit_from_inbox
TEST-START | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test_column_visibility_persists_through_tab_changes
Test Failure: Found visible column 'dateCol' but was expecting 'tagsCol'!
desired list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,tagsCol
 actual list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,dateCol
TEST-UNEXPECTED-FAIL | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test-columns.js::test_column_visibility_persists_through_tab_changes
TEST-START | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test_column_visibility_persists_through_folder_changes
Test Failure: Found visible column 'dateCol' but was expecting 'tagsCol'!
desired list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,tagsCol
 actual list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,dateCol
TEST-UNEXPECTED-FAIL | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test-columns.js::test_column_visibility_persists_through_folder_changes
TEST-START | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test_column_reordering_persists
Test Failure: Found visible column 'dateCol' but was expecting 'tagsCol'!
desired list: threadCol,flaggedCol,attachmentCol,senderCol,subjectCol,unreadButtonColHeader,junkStatusCol,tagsCol
 actual list: threadCol,flaggedCol,attachmentCol,senderCol,subjectCol,unreadButtonColHeader,junkStatusCol,dateCol
TEST-UNEXPECTED-FAIL | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test-columns.js::test_column_reordering_persists
TEST-START | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test_reset_to_inbox
Test Failure: Found visible column 'senderCol' but was expecting 'subjectCol'!
desired list: threadCol,flaggedCol,attachmentCol,subjectCol,unreadButtonColHeader,senderCol,junkStatusCol,dateCol
 actual list: threadCol,flaggedCol,attachmentCol,senderCol,subjectCol,unreadButtonColHeader,junkStatusCol,dateCol
TEST-UNEXPECTED-FAIL | /Users/cltbld/talos-slave/test/build/mozmill/folder-display/test-columns.js | test-columns.js::test_reset_to_inbox
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 4

5 years ago
Created attachment 683226 [details] [diff] [review]
proposed fix, v2

folderDisplay.js was hacking around getting dom modifications as separate events, with mutations you get them all in one call. The other changes are as before.

Try run coming in here: https://tbpl.mozilla.org/?tree=Thunderbird-Try&rev=825399b83f9f
Attachment #677870 - Attachment is obsolete: true
Attachment #683226 - Flags: review?(mconley)
Comment on attachment 683226 [details] [diff] [review]
proposed fix, v2

Good stuff. folder-display tests pass for me locally. Let's try this again.
Attachment #683226 - Flags: review?(mconley) → review+
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/comm-central/rev/a9d426e01d37 -> FIXED
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Target Milestone: Thunderbird 19.0 → Thunderbird 20.0

Comment 7

a month ago
Issue still present into TDB 45.8.0

Horodatage : 23/06/2017 08:09:18
Avertissement : L'utilisation des « Mutation Events » est obsolète. Utiliser « MutationObserver » à la place.
Fichier source : chrome://calendar/content/widgets/calendar-widgets.xml
Ligne : 495
(Assignee)

Comment 8

a month ago
That's in calendar. Filed bug 1376512 about it.
You need to log in before you can comment on or make changes to this bug.