[Pkg-mozext-commits] [greasemonkey] 48/62: Sync: always populate record's sync ID, observe uninstall event.

David Prévot taffit at moszumanska.debian.org
Sun Sep 13 22:10:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit ca56af906403fa764f34f1039611fd1b0ba26697
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Fri Aug 28 17:55:44 2015 -0400

    Sync: always populate record's sync ID, observe uninstall event.
    
    Refs #2186
---
 modules/sync.js | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/modules/sync.js b/modules/sync.js
index e6d5973..f424995 100644
--- a/modules/sync.js
+++ b/modules/sync.js
@@ -75,7 +75,7 @@ ScriptRecord.prototype = {
 };
 gWeave.Utils.deferGetSet(
     ScriptRecord, 'cleartext',
-    ['downloadURL', 'enabled', 'installed',
+    ['id', 'downloadURL', 'enabled', 'installed',
      'userExcludes', 'userMatches', 'userIncludes',
      'values', 'valuesTooBig',
     ]);
@@ -127,9 +127,13 @@ ScriptStore.prototype = {
   /// New local item, create sync record.
   createRecord: function(aId, aCollection) {
     var script = scriptForSyncId(aId);
-    if (script) {
-      var record = new ScriptRecord();
-      record.cleartext.id = aId;
+    var record = new ScriptRecord();
+    record.cleartext.id = aId;
+    if (!script) {
+      // Assume this script was not found because it was uninstalled.
+      record.cleartext.enabled = false;
+      record.cleartext.installed = false;
+    } else {
       record.cleartext.downloadURL = script.downloadURL;
       record.cleartext.enabled = script.enabled;
       record.cleartext.installed = !script.needsUninstall;
@@ -163,15 +167,8 @@ ScriptStore.prototype = {
           }
         }
       }
-
-      return record;
-    } else {
-      // Assume this is an uninstalled script.
-      var record = new ScriptRecord();
-      record.cleartext.enabled = false;
-      record.cleartext.installed = false;
-      return record;
     }
+    return record;
   },
 
   getAllIDs: function() {
@@ -231,7 +228,8 @@ ScriptTracker.prototype = {
   __proto__: gWeave.Tracker.prototype,
 
   notifyEvent: function(aScript, aEvent, aData) {
-    if (aEvent in {'install': 1, 'modified': 1, 'edit-enabled': 1}) {
+    if (aEvent in {
+        'install': 1, 'uninstall': 1, 'modified': 1, 'edit-enabled': 1}) {
       if (this.addChangedID(syncId(aScript))) {
         this.score = Math.min(100, this.score + 5);
       }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list