Bug 1313941 - Forward change sources in the livemarks service. r?markh
MozReview-Commit-ID: 3Q6kj7BitrE
--- 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