diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js index e63f5fba22b7..583c721b9a7e 100644 --- a/services/sync/modules/engines/bookmarks.js +++ b/services/sync/modules/engines/bookmarks.js @@ -247,18 +247,14 @@ BookmarksSharingManager.prototype = { dump( "Value is " + selectedFolder + "\n"); let folderName = selectedFolder.getAttribute( "label" ); let folderNode = selectedFolder.node; - // This line is getting a NS_ERROR_NOT_AVAILABLE. Is that a problem - // with folderNode.itemId or with annoSvc? - if ( folderNode.itemId == undefined ) { - dump( "FolderNode.itemId is undefined!!\n" ); + + if (this._annoSvc.itemHasAnnotation(folderNode.itemId, SERVER_PATH_ANNO)){ + let serverPath = this._annoSvc.getItemAnnotation(folderNode.itemId, + SERVER_PATH_ANNO); } else { - dump( "folderNode.itemId is " + folderNode.itemId +"\n"); + this._log.warn("The folder you are de-sharing has no path annotation."); + let serverPath = ""; } - if (!this._annoSvc.itemHasAnnotation(folderNode.itemId, SERVER_PATH_ANNO)){ - dump( "Expected annotation not found!!\n" ); - } - let serverPath = this._annoSvc.getItemAnnotation(folderNode.itemId, - SERVER_PATH_ANNO); /* LONGTERM TODO: when we move to being able to share one folder with * multiple people, this needs to be modified so we can stop sharing with @@ -460,22 +456,20 @@ BookmarksSharingManager.prototype = { server, deletes the annotations that mark it as shared, and sends a message to the shar-ee to let them know it's been withdrawn. */ let self = yield; - let serverPath = this._annoSvc.getItemAnnotation( folderNode, + if (this._annoSvc.itemHasAnnotation(folderNode.itemId, SERVER_PATH_ANNO)){ + let serverPath = this._annoSvc.getItemAnnotation( folderNode, SERVER_PATH_ANNO ); - let username = this._annoSvc.getItemAnnotation( folderNode, - OUTGOING_SHARED_ANNO ); - - // Delete the share from the server: - // TODO handle error that can happen if these resources do not exist. - let keyringFile = new Resource(serverPath + "/" + KEYRING_FILE_NAME); - keyringFile.delete(self.cb); - yield; - let bmkFile = new Resource(serverPath + "/" + SHARED_BOOKMARK_FILE_NAME); - keyringFile.delete(self.cb); - yield; - // TODO this leaves the folder itself in place... is there a way to - // get rid of that, say through DAV? - + // Delete the share from the server: + // TODO handle error that can happen if these resources do not exist. + let keyringFile = new Resource(serverPath + "/" + KEYRING_FILE_NAME); + keyringFile.delete(self.cb); + yield; + let bmkFile = new Resource(serverPath + "/" + SHARED_BOOKMARK_FILE_NAME); + keyringFile.delete(self.cb); + yield; + // TODO this leaves the folder itself in place... is there a way to + // get rid of that, say through DAV? + } // Remove the annotations from the local folder: this._annoSvc.setItemAnnotation(folderNode, SERVER_PATH_ANNO, diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 18cf2583987e..c52dc5c7c77a 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -803,15 +803,17 @@ WeaveSvc.prototype = { os.removeObserver(observer, errorMsg); } }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]); + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]) }; if (Weave.DAV.locked) { /* then we have to wait until it's not locked. */ + dump( "DAV is locked, gonna set up observer to do it later.\n"); os.addObserver( observer, successMsg, true ); os.addObserver( observer, errorMsg, true ); } else { // Just do it right now! + dump( "DAV not locked, doing it now.\n"); observer.observe(); } },