[Pkg-mozext-commits] [greasemonkey] 03/07: Handle missing sync service gracefully.

David Prévot taffit at moszumanska.debian.org
Sat Jul 11 22:49:46 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 50e8dd4eb14730a508ec21f743c1a0df6cc4f133
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Fri May 29 11:32:36 2015 -0400

    Handle missing sync service gracefully.
    
    Fixes #2003.
---
 modules/sync.js | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/sync.js b/modules/sync.js
index a39a9ed..108d5f1 100644
--- a/modules/sync.js
+++ b/modules/sync.js
@@ -1,5 +1,6 @@
 var EXPORTED_SYMBOLS = [];
 
+(function initSync() {
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
@@ -16,12 +17,18 @@ Cu.import('chrome://greasemonkey-modules/content/util.js');
 
 var gSyncInitialized = false;
 
-var gWeave = {};
-Cu.import('resource://services-sync/engines.js', gWeave);
-Cu.import('resource://services-sync/record.js', gWeave);
-Cu.import('resource://services-sync/status.js', gWeave);
-Cu.import('resource://services-sync/util.js', gWeave);
-
+try {
+  // The files we're trying to import below don't exist in Firefox builds
+  // without sync service, causing the import to throw.
+  var gWeave = {};
+  Cu.import('resource://services-sync/engines.js', gWeave);
+  Cu.import('resource://services-sync/record.js', gWeave);
+  Cu.import('resource://services-sync/status.js', gWeave);
+  Cu.import('resource://services-sync/util.js', gWeave);
+} catch (e) {
+  // If there's no sync service, it doesn't make sense to continue.
+  return;
+}
 
 var SyncServiceObserver = {
   init: function() {
@@ -284,3 +291,4 @@ function setScriptValuesFromSyncRecord(aScript, aRecord) {
 
 
 SyncServiceObserver.init();
+})();

-- 
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