Bug 1581498 - Remove obsolete starred and sender function arguments from mail tabs API; r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 22 Oct 2019 12:47:51 +1300
changeset 36461 8b383d1c31cfed3a6b775239c518ae593cd593ad
parent 36460 4982de786c5402c20b95015f73e2a467ed0a108c
child 36462 50552bcfa51fec058603ddbbc78e163fd4743deb
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1581498
Bug 1581498 - Remove obsolete starred and sender function arguments from mail tabs API; r=mkmelin
mail/components/extensions/parent/ext-mailTabs.js
mail/components/extensions/schemas/mailTabs.json
mail/components/extensions/test/browser/browser_ext_quickFilter.js
--- a/mail/components/extensions/parent/ext-mailTabs.js
+++ b/mail/components/extensions/parent/ext-mailTabs.js
@@ -305,31 +305,28 @@ this.mailTabs = class extends ExtensionA
           if (tab.active) {
             filterer = window.QuickFilterBarMuxer.activeFilterer;
           } else {
             filterer = nativeTab._ext.quickFilter;
           }
           filterer.clear();
 
           // Map of QuickFilter state names to possible WebExtensions state names.
-          // WebExtensions names are comma-separated in increasing order of precedence.
           let stateMap = {
             unread: "unread",
-            starred: "starred,flagged",
+            starred: "flagged",
             addrBook: "contact",
             attachment: "attachment",
           };
 
           filterer.visible = state.show !== false;
-          for (let [key, names] of Object.entries(stateMap)) {
+          for (let [key, name] of Object.entries(stateMap)) {
             let value = null;
-            for (let name of names.split(",")) {
-              if (state[name] !== null) {
-                value = state[name];
-              }
+            if (state[name] !== null) {
+              value = state[name];
             }
             if (value === null) {
               delete filterer.filterValues[key];
             } else {
               filterer.filterValues[key] = value;
             }
           }
 
@@ -348,17 +345,17 @@ this.mailTabs = class extends ExtensionA
                 filterer.filterValues.tags.tags[key] = value;
               }
             }
           }
           if (state.text) {
             filterer.filterValues.text = {
               states: {
                 recipients: state.text.recipients || false,
-                sender: state.text.author || state.text.sender || false,
+                sender: state.text.author || false,
                 subject: state.text.subject || false,
                 body: state.text.body || false,
               },
               text: state.text.text,
             };
           }
 
           if (tab.active) {
--- a/mail/components/extensions/schemas/mailTabs.json
+++ b/mail/components/extensions/schemas/mailTabs.json
@@ -33,22 +33,16 @@
             "type": "string",
             "description": "String to match against the <var>recipients</var>, <var>author</var>, <var>subject</var>, or <var>body</var>."
           },
           "recipients": {
             "type": "boolean",
             "description": "Shows messages where <var>text</var> matches the recipients.",
             "optional": true
           },
-          "sender": {
-            "type": "boolean",
-            "description": "Use <var>author</var> instead.",
-            "optional": true,
-            "deprecated": true
-          },
           "author": {
             "type": "boolean",
             "description": "Shows messages where <var>text</var> matches the author.",
             "optional": true
           },
           "subject": {
             "type": "boolean",
             "description": "Shows messages where <var>text</var> matches the subject.",
@@ -218,22 +212,16 @@
                 "description": "Shows or hides the Quick Filter bar.",
                 "optional": true
               },
               "unread": {
                 "type": "boolean",
                 "description": "Shows only unread messages.",
                 "optional": true
               },
-              "starred": {
-                "type": "boolean",
-                "description": "Use <var>flagged</var> instead.",
-                "optional": true,
-                "deprecated": true
-              },
               "flagged": {
                 "type": "boolean",
                 "description": "Shows only flagged messages.",
                 "optional": true
               },
               "contact": {
                 "type": "boolean",
                 "description": "Shows only messages from people in the address book.",
--- a/mail/components/extensions/test/browser/browser_ext_quickFilter.js
+++ b/mail/components/extensions/test/browser/browser_ext_quickFilter.js
@@ -26,26 +26,19 @@ add_task(async () => {
           browser.test.sendMessage(messageToSend, ...sendArgs);
         }
       });
     }
 
     browser.mailTabs.setQuickFilter({ unread: true });
     await awaitMessage("checkVisible", 1, 3, 5, 7, 9);
 
-    browser.mailTabs.setQuickFilter({ starred: true });
-    await awaitMessage("checkVisible", 1, 6);
-
     browser.mailTabs.setQuickFilter({ flagged: true });
     await awaitMessage("checkVisible", 1, 6);
 
-    // The starred property was renamed flagged. Flagged should take precedence.
-    browser.mailTabs.setQuickFilter({ starred: false, flagged: true });
-    await awaitMessage("checkVisible", 1, 6);
-
     browser.mailTabs.setQuickFilter({ flagged: true, unread: true });
     await awaitMessage("checkVisible", 1);
 
     browser.mailTabs.setQuickFilter({ tags: true });
     await awaitMessage("checkVisible", 0, 1, 3, 5, 6, 7, 8, 9);
 
     browser.mailTabs.setQuickFilter({
       tags: { mode: "any", tags: { $label1: true } },
@@ -134,18 +127,14 @@ add_task(async () => {
     Ci.nsIAbCard
   );
   card.setProperty("FirstName", author[0]);
   card.setProperty("LastName", author[1]);
   card.setProperty("DisplayName", `${author[0]} ${author[1]}`);
   card.setProperty("PrimaryEmail", author[2]);
   MailServices.ab.directories.getNext().addCard(card);
 
-  // Deprecated "starred" property. See bug 1581498 for removal.
-  ExtensionTestUtils.failOnSchemaWarnings(false);
-
   await extension.startup();
   await extension.awaitFinish("quickFilter");
   await extension.unload();
 
   window.gFolderTreeView.selectFolder(rootFolder);
-  ExtensionTestUtils.failOnSchemaWarnings(true);
 });