ignore all events when tracker.ignoreAll is true; ignore most bookmark annotations (except for the ones we sync)
authorDan Mills <thunder@mozilla.com>
Mon, 02 Feb 2009 11:43:06 -0800
changeset 45216 e4d4608fd6b6ce34a1d83302a48f3e074792c76b
parent 45214 cf877f3118595f42cca599d5cd6c569fb63f0dfd
child 45217 e007a53e57286ec71f9d4a13000b24a5d32d0d16
push idunknown
push userunknown
push dateunknown
ignore all events when tracker.ignoreAll is true; ignore most bookmark annotations (except for the ones we sync)
services/sync/modules/engines/bookmarks.js
services/sync/modules/engines/history.js
--- a/services/sync/modules/engines/bookmarks.js
+++ b/services/sync/modules/engines/bookmarks.js
@@ -678,50 +678,71 @@ BookmarksTracker.prototype = {
   },
 
   /* Every add/remove/change is worth 10 points */
   _upScore: function BMT__upScore() {
     this._score += 10;
   },
 
   onItemAdded: function BMT_onEndUpdateBatch(itemId, folder, index) {
-    if (this._ls.isLivemark(folder))
+    if (this.ignoreAll ||
+	this._ls.isLivemark(folder))
       return;
+
     this._log.trace("onItemAdded: " + itemId);
+
     this._all[itemId] = this._bms.getItemGUID(itemId);
     if (this.addChangedID(this._all[itemId]))
       this._upScore();
   },
 
   onItemRemoved: function BMT_onItemRemoved(itemId, folder, index) {
-    if (this._ls.isLivemark(folder))
+    if (this.ignoreAll ||
+	this._ls.isLivemark(folder))
       return;
+
     this._log.trace("onItemRemoved: " + itemId);
+
     if (this.addChangedID(this._all[itemId]))
       this._upScore();
     delete this._all[itemId];
   },
 
   onItemChanged: function BMT_onItemChanged(itemId, property, isAnno, value) {
+    if (this.ignoreAll)
+      return;
+
+    // ignore annotations except for the ones that we sync
+    if (isAnno && (property != "livemark/feedURI" ||
+		   property != "livemark/siteURI" ||
+		   property != "microsummary/generatorURI"))
+	return;
+
+    // ignore if parent is a livemark
     if (this._ls.isLivemark(this._bms.getFolderIdForItem(itemId)))
       return;
+
     this._log.trace("onItemChanged: " + itemId +
                     (", " + property + (isAnno? " (anno)" : "")) +
                     (value? (" = \"" + value + "\"") : ""));
     // 1) notifications for already-deleted items are ignored
     // 2) note that engine/store are responsible for manually updating the
     //    tracker's placesId->weaveId cache
     if ((itemId in this._all) &&
         (this._bms.getItemGUID(itemId) == this._all[itemId]) &&
         this.addChangedID(this._all[itemId]))
       this._upScore();
   },
 
   onItemMoved: function BMT_onItemMoved(itemId, oldParent, oldIndex, newParent, newIndex) {
+    if (this.ignoreAll)
+      return;
+
     this._log.trace("onItemMoved: " + itemId);
+
     if (!this._all[itemId])
       this._all[itemId] = this._bms.itemGUID(itemId);
     if (this.addChangedID(this._all[itemId]))
       this._upScore();
   },
 
   onBeginUpdateBatch: function BMT_onBeginUpdateBatch() {},
   onEndUpdateBatch: function BMT_onEndUpdateBatch() {},
--- a/services/sync/modules/engines/history.js
+++ b/services/sync/modules/engines/history.js
@@ -482,16 +482,18 @@ HistoryTracker.prototype = {
   /* Every add or remove is worth 1 point.
    * Clearing the whole history is worth 50 points (see below)
    */
   _upScore: function BMT__upScore() {
     this._score += 1;
   },
 
   onVisit: function HT_onVisit(uri, vid, time, session, referrer, trans) {
+    if (this.ignoreAll)
+      return;
     this._log.trace("onVisit: " + uri.spec);
     if (this.addChangedID(this._store._getGUID(uri)))
       this._upScore();
   },
   onPageExpired: function HT_onPageExpired(uri, time, entry) {
     this._log.trace("onPageExpired: " + uri.spec);
     if (this.addChangedID(this._store._getGUID(uri))) // XXX eek ?
       this._upScore();