Was failing on Fennec because private browsing doesn't exist there -- now more gracefully handles missing components.

This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2009-03-10 17:12:59 -07:00
Родитель f9eff8780e
Коммит f014c6bb51
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -650,7 +650,8 @@ WeaveSvc.prototype = {
reason = kSyncNotLoggedIn;
else if (Svc.IO.offline)
reason = kSyncNetworkOffline;
else if (Svc.Private.privateBrowsingEnabled)
else if (Svc.Private && Svc.Private.privateBrowsingEnabled)
// Svc.Private doesn't exist on Fennec -- don't assume it's there.
reason = kSyncInPrivateBrowsing;
else if (Svc.Prefs.get("schedule", 0) != 1)
reason = kSyncNotScheduled;

Просмотреть файл

@ -146,8 +146,15 @@ let Utils = {
lazySvc: function Weave_lazySvc(dest, prop, cid, iface) {
let getter = function() {
delete dest[prop];
dest[prop] = Cc[cid].getService(iface);
return dest[prop];
if (!Cc[cid]) {
let log = Log4Moz.repository.getLogger("Service.Util");
log.warn("Component " + cid + " requested, but doesn't exist on "
+ "this platform.");
return null;
} else{
dest[prop] = Cc[cid].getService(iface);
return dest[prop];
}
};
dest.__defineGetter__(prop, getter);
},