Removed all uses of the 'weave/mounted-shares-id' annotation, since it's been made obsolete by INCOMING_SHARED_ANNO.
authorjonathandicarlo@jonathan-dicarlos-macbook-pro.local
Tue, 24 Jun 2008 18:23:43 -0700
changeset 44724 6a6ce9093209f461d8b66c13269ef4317731c756
parent 44723 87708b960efd99d72a4f2808e5dd17b5e420a402
child 44725 9afb528fd0db908f06b6741e44baf34ce513c032
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Removed all uses of the 'weave/mounted-shares-id' annotation, since it's been made obsolete by INCOMING_SHARED_ANNO.
services/sync/modules/engines/bookmarks.js
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -526,38 +526,30 @@ BookmarksEngine.prototype = {
                                       0,
                                       this._annoSvc.EXPIRE_NEVER);
     }
     /* Inside "Shared Folders", create a new folder annotated with
        the originating user and the directory path specified by the incoming
        share offer.  Unless a folder with these exact annotations already
        exists, in which case do nothing. */
     let itemExists = false;
-    a = this._annoSvc.getItemsWithAnnotation("weave/mounted-share-id", {});
+    a = this._annoSvc.getItemsWithAnnotation(INCOMING_SHARED_ANNO, {});
     for (let i = 0; i < a.length; i++) {
-      let creator = this._annoSvc.getItemAnnotation(a[i], OUTGOING_SHARED_ANNO);
+      let creator = this._annoSvc.getItemAnnotation(a[i], INCOMING_SHARED_ANNO);
       let path = this._annoSvc.getItemAnnotation(a[i], SERVER_PATH_ANNO);
       if ( creator == user && path == serverPath ) {
         itemExists = true;
         break;
       }
     }
     if (!itemExists) {
       let newId = bms.createFolder(root, title, bms.DEFAULT_INDEX);
-      /* TODO: weave/mounted-share-id is kind of redundant now, but it's
-	 treated specially by the sync code.
-	 If i change it here, i have to change it there as well. */
-      this._annoSvc.setItemAnnotation(newId,
-                                      "weave/mounted-share-id",
-                                      id,
-                                      0,
-                                      this._annoSvc.EXPIRE_NEVER);
       // Keep track of who shared this folder with us...
       this._annoSvc.setItemAnnotation(newId,
-                                      OUTGOING_SHARED_ANNO,
+                                      INCOMING_SHARED_ANNO,
                                       user,
                                       0,
                                       this._annoSvc.EXPIRE_NEVER);
       // and what the path to the shared data on the server is...
       this._annoSvc.setItemAnnotation(newId,
                                       SERVER_PATH_ANNO,
                                       serverPath,
                                       0,
@@ -876,34 +868,28 @@ BookmarksStore.prototype = {
       this._log.debug(" -> creating livemark \"" + command.data.title + "\"");
       newId = this._ls.createLivemark(parentId,
                                       command.data.title,
                                       Utils.makeURI(command.data.siteURI),
                                       Utils.makeURI(command.data.feedURI),
                                       command.data.index);
       break;
     case "incoming-share":
+      /* even though incoming shares are folders according to the
+       * bookmarkService, _wrap() wraps them as type=incoming-share, so we
+       * handle them separately, like so: */
       this._log.debug(" -> creating incoming-share \"" + command.data.title + "\"");
       newId = this._bms.createFolder(parentId,
                                      command.data.title,
                                      command.data.index);
       this._ans.setItemAnnotation(newId, INCOMING_SHARE_ANNO,
                                   command.data.username, 0, this._ans.EXPIRE_NEVER);
       this._ans.setItemAnnotation(newId, SERVER_PATH_ANNO,
                                   command.data.serverPath, 0, this._ans.EXPIRE_NEVER);
       break;
-    case "mounted-share":
-      this._log.debug(" -> creating share mountpoint \"" + command.data.title + "\"");
-      newId = this._bms.createFolder(parentId,
-                                     command.data.title,
-                                     command.data.index);
-
-      this._ans.setItemAnnotation(newId, "weave/mounted-share-id",
-                                  command.data.mountId, 0, this._ans.EXPIRE_NEVER);
-      break;
     case "separator":
       this._log.debug(" -> creating separator");
       newId = this._bms.insertSeparator(parentId, command.data.index);
       break;
     default:
       this._log.error("_createCommand: Unknown item type: " + command.data.type);
       break;
     }
@@ -939,17 +925,16 @@ BookmarksStore.prototype = {
       break;
     case this._bms.TYPE_SEPARATOR:
       this._log.debug("  -> removing separator " + command.GUID);
       this._bms.removeItem(itemId);
       break;
     default:
       this._log.error("removeCommand: Unknown item type: " + type);
       break;
-      // TODO do we have to sync removal of incomingShares?
     }
   },
 
   _editCommand: function BStore__editCommand(command) {
     if (command.GUID == "menu" ||
         command.GUID == "toolbar" ||
         command.GUID == "unfiled") {
       this._log.warn("Attempted to edit root node (" + command.GUID +
@@ -1064,32 +1049,25 @@ BookmarksStore.prototype = {
     if (node.type == node.RESULT_TYPE_FOLDER) {
       if (this._ls.isLivemark(node.itemId)) {
         item.type = "livemark";
         let siteURI = this._ls.getSiteURI(node.itemId);
         let feedURI = this._ls.getFeedURI(node.itemId);
         item.siteURI = siteURI? siteURI.spec : "";
         item.feedURI = feedURI? feedURI.spec : "";
       } else if (this._ans.itemHasAnnotation(node.itemId, INCOMING_SHARE_ANNO)){
-	// When there's an incoming share, we just sync the folder itself
-	// and the values of its annotations: NOT any of its contents.
+	/* When there's an incoming share, we just sync the folder itself
+	 and the values of its annotations: NOT any of its contents.  So
+	 we'll wrap it as type=incoming-share, not as a "folder". */
 	item.type = "incoming-share";
 	item.title = node.title;
         item.serverPath = this._ans.getItemAnnotation(node.itemId,
                                                       SERVER_PATH_ANNO);
 	item.username = this._ans.getItemAnnotation(node.itemId,
                                                       INCOMING_SHARE_ANNO);
-      } else if (this._ans.itemHasAnnotation(node.itemId,
-                                             "weave/mounted-share-id")) {
-	/* TODO this is for wrapping the special shared folder created by
-	   the old-style share command. */
-        item.type = "mounted-share";
-        item.title = node.title;
-        item.mountId = this._ans.getItemAnnotation(node.itemId,
-                                                   "weave/mounted-share-id");
       } else {
         item.type = "folder";
         node.QueryInterface(Ci.nsINavHistoryQueryResultNode);
         node.containerOpen = true;
 	// If folder is an outgoing share, wrap its annotations:
 	if (this._ans.itemHasAnnotation(node.itemId, OUTGOING_SHARE_ANNO)) {
 
 	  item.serverPathAnno = this._ans.getItemAnnotation(node.itemId,
@@ -1175,17 +1153,17 @@ BookmarksStore.prototype = {
     node.containerOpen = true;
     for (var i = 0; i < node.childCount; i++) {
       this.__wrap(node.getChild(i), ret.snapshot, GUID, i);
     }
 
     // remove any share mountpoints
     for (let guid in ret.snapshot) {
       // TODO decide what to do with this...
-      if (ret.snapshot[guid].type == "mounted-share")
+      if (ret.snapshot[guid].type == "incoming-share")
         delete ret.snapshot[guid];
     }
 
     return ret;
   },
 
   _resetGUIDs: function BSS__resetGUIDs(node) {
     if (this._ans.itemHasAnnotation(node.itemId, "placesInternal/GUID"))