Bug 453908 - remove some left-over direct RDF uses from JavaScript code. r=aceman
authorBen Campbell <benc@thunderbird.net>
Mon, 21 Jan 2019 17:57:59 +1300
changeset 34279 a770f9f6ca8155aeae822b10f0e21df94910db9e
parent 34278 043b81dfc262b56fdcc330b9a8dbf81ac49071dd
child 34280 c0a224ddbe33d8923318adf159112328e3508754
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersaceman
bugs453908
Bug 453908 - remove some left-over direct RDF uses from JavaScript code. r=aceman
mail/base/content/foldersummary.js
mail/base/content/mailWidgets.xml
--- a/mail/base/content/foldersummary.js
+++ b/mail/base/content/foldersummary.js
@@ -46,19 +46,18 @@ class MozFolderSummary extends MozXULEle
       // The database for this folder may be missing (e.g. outdated/missing .msf),
       // so just skip this folder.
       return false;
     }
 
     if (folder.flags & Ci.nsMsgFolderFlags.Virtual) {
       let srchFolderUri = msgDatabase.dBFolderInfo.getCharProperty("searchFolderUri");
       let folderUris = srchFolderUri.split("|");
-      let RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
       for (let uri of folderUris) {
-        let realFolder = RDF.GetResource(uri).QueryInterface(Ci.nsIMsgFolder);
+        let realFolder = MailUtils.getOrCreateFolder(uri);
         if (!realFolder.isServer) {
           folderArray.push(realFolder);
         }
       }
     } else {
       folderArray.push(folder);
     }
 
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -1942,16 +1942,18 @@
                 this.self.fire();
             },
           })
         ]]>
       </field>
       <method name="setInitialSelection">
         <body>
           <![CDATA[
+            ChromeUtils.import("resource:///modules/MailUtils.jsm", this);
+
             var view = this.tree.view;
 
             if (!view.selection.currentColumn)
               view.selection.currentColumn = this.tree.columns.getFirstColumn();
 
             view.selection.selectEventsSuppressed = true;
             for (var i = 0; i < view.rowCount; i++) {
               if (view.isContainer(i)) {
@@ -1963,18 +1965,17 @@
                     view.toggleOpenState(i);
                   }
                 }
               }
             }
             var index = -1;
             var uri = this.parentNode.getAttribute("uri");
             if (uri) {
-              var RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
-              index = view.getIndexOfResource(RDF.GetResource(uri));
+              index = view.getIndexOfResource(this.MailUtils.getOrCreateFolder(uri));
             }
             view.selection.select(index);
             return index;
           ]]>
         </body>
       </method>
       <constructor>
         <![CDATA[