Closed Bug 808172 Opened 12 years ago Closed 12 years ago

convert Mutation Events to use MutationObserver in mail/

Categories

(Thunderbird :: Mail Window Front End, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 20.0

People

(Reporter: mkmelin, Assigned: mkmelin)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch proposed fix (obsolete) — Splinter Review
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+
https://hg.mozilla.org/comm-central/rev/f61698f08e77 -> FIXED
Status: ASSIGNED → RESOLVED
Closed: 12 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 → ---
Attached patch proposed fix, v2Splinter Review
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+
https://hg.mozilla.org/comm-central/rev/a9d426e01d37 -> FIXED
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Target Milestone: Thunderbird 19.0 → Thunderbird 20.0
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
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.

Attachment

General

Created:
Updated:
Size: