Bug 1313941 - Forward change sources in the livemarks service. r=markh
authorKit Cambridge <kit@yakshaving.ninja>
Sun, 30 Oct 2016 11:44:11 -0700
changeset 347151 8eb889dd92716e3c75093529731c444b84d2d833
parent 347150 8dffbcbe37c9506b824a5d08a94293313e7c086c
child 347152 3e7430fec98998cdc67637a7e0a2b3d0f598d8bd
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1313941
milestone52.0a1
Bug 1313941 - Forward change sources in the livemarks service. r=markh MozReview-Commit-ID: 3Q6kj7BitrE
toolkit/components/places/nsLivemarkService.js
--- a/toolkit/components/places/nsLivemarkService.js
+++ b/toolkit/components/places/nsLivemarkService.js
@@ -223,24 +223,25 @@ LivemarkService.prototype = {
                                   , index:        folder.index
                                   , feedURI:      aLivemarkInfo.feedURI
                                   , siteURI:      aLivemarkInfo.siteURI
                                   , guid:         folder.guid
                                   , dateAdded:    toPRTime(folder.dateAdded)
                                   , lastModified: toPRTime(folder.lastModified)
                                   });
 
-      livemark.writeFeedURI(aLivemarkInfo.feedURI);
+      livemark.writeFeedURI(aLivemarkInfo.feedURI, aLivemarkInfo.source);
       if (aLivemarkInfo.siteURI) {
-        livemark.writeSiteURI(aLivemarkInfo.siteURI);
+        livemark.writeSiteURI(aLivemarkInfo.siteURI, aLivemarkInfo.source);
       }
 
       if (aLivemarkInfo.lastModified) {
         yield PlacesUtils.bookmarks.update({ guid: folder.guid,
-                                             lastModified: toDate(aLivemarkInfo.lastModified) });
+                                             lastModified: toDate(aLivemarkInfo.lastModified),
+                                             source: aLivemarkInfo.source });
         livemark.lastModified = aLivemarkInfo.lastModified;
       }
 
       livemarksMap.set(folder.guid, livemark);
 
       return livemark;
     }.bind(this));
   },
@@ -261,17 +262,18 @@ LivemarkService.prototype = {
     return Task.spawn(function* () {
       if (!aLivemarkInfo.guid)
         aLivemarkInfo.guid = yield PlacesUtils.promiseItemGuid(aLivemarkInfo.id);
 
       let livemarksMap = yield this._promiseLivemarksMap();
       if (!livemarksMap.has(aLivemarkInfo.guid))
         throw new Components.Exception("Invalid livemark", Cr.NS_ERROR_INVALID_ARG);
 
-      yield PlacesUtils.bookmarks.remove(aLivemarkInfo.guid);
+      yield PlacesUtils.bookmarks.remove(aLivemarkInfo.guid,
+                                         { source: aLivemarkInfo.source });
     }.bind(this));
   },
 
   reloadLivemarks(aForceUpdate) {
     // Check if there's a currently running reload, to save some useless work.
     let notWorthRestarting =
       this._forceUpdate || // We're already forceUpdating.
       !aForceUpdate;       // The caller didn't request a forced update.
@@ -460,28 +462,30 @@ Livemark.prototype = {
   set status(val) {
     if (this._status != val) {
       this._status = val;
       this._invalidateRegisteredContainers();
     }
     return this._status;
   },
 
-  writeFeedURI(aFeedURI) {
+  writeFeedURI(aFeedURI, aSource) {
     PlacesUtils.annotations
                .setItemAnnotation(this.id, PlacesUtils.LMANNO_FEEDURI,
                                   aFeedURI.spec,
-                                  0, PlacesUtils.annotations.EXPIRE_NEVER);
+                                  0, PlacesUtils.annotations.EXPIRE_NEVER,
+                                  aSource);
     this.feedURI = aFeedURI;
   },
 
-  writeSiteURI(aSiteURI) {
+  writeSiteURI(aSiteURI, aSource) {
     if (!aSiteURI) {
       PlacesUtils.annotations.removeItemAnnotation(this.id,
-                                                   PlacesUtils.LMANNO_SITEURI)
+                                                   PlacesUtils.LMANNO_SITEURI,
+                                                   aSource)
       this.siteURI = null;
       return;
     }
 
     // Security check the site URI against the feed URI principal.
     let secMan = Services.scriptSecurityManager;
     let feedPrincipal = secMan.createCodebasePrincipal(this.feedURI, {});
     try {
@@ -490,17 +494,18 @@ Livemark.prototype = {
     }
     catch (ex) {
       return;
     }
 
     PlacesUtils.annotations
                .setItemAnnotation(this.id, PlacesUtils.LMANNO_SITEURI,
                                   aSiteURI.spec,
-                                  0, PlacesUtils.annotations.EXPIRE_NEVER);
+                                  0, PlacesUtils.annotations.EXPIRE_NEVER,
+                                  aSource);
     this.siteURI = aSiteURI;
   },
 
   /**
    * Tries to updates the livemark if needed.
    * The update process is asynchronous.
    *
    * @param [optional] aForceUpdate