This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2009-02-11 19:14:32 -08:00
commit 28d7a05a8d
2 changed files with 40 additions and 5 deletions

View File

@ -149,7 +149,8 @@ Resource.prototype = {
getService(Ci.nsIIOService);
this._lastChannel = ios.newChannel(this.spec, null, null).
QueryInterface(Ci.nsIHttpChannel);
this._lastChannel.notificationCallbacks = new badCertListener();
let headers = this.headers; // avoid calling the authorizer more than once
for (let key in headers) {
if (key == 'Authorization')
@ -348,3 +349,30 @@ JsonFilter.prototype = {
self.done(this._json.decode(data));
}
};
function badCertListener() {
}
badCertListener.prototype = {
getInterface: function(aIID) {
return this.QueryInterface(aIID);
},
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsIBadCertListener2) ||
aIID.equals(Components.interfaces.nsIInterfaceRequestor) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
},
notifyCertProblem: function certProblem(socketInfo, sslStatus, targetHost) {
// Silently ignore?
let log = Log4Moz.repository.getLogger("Service.CertListener");
log.level =
Log4Moz.Level[Utils.prefs.getCharPref("log.logger.network.resources")];
log.debug("Invalid HTTPS certificate encountered, ignoring!");
return true;
}
};

View File

@ -223,6 +223,7 @@ WeaveSvc.prototype = {
set keyGenEnabled(value) { this._keyGenEnabled = value; },
get enabled() Svc.Prefs.get("enabled"),
set enabled(value) Svc.Prefs.set("enabled", value),
get schedule() {
if (!this.enabled)
@ -298,13 +299,13 @@ WeaveSvc.prototype = {
let ok = false;
try {
let svc = Cc["@labs.mozilla.com/Weave/Crypto;1"].
createInstance(Ci.IWeaveCrypto);
let iv = svc.generateRandomIV();
let iv = Svc.Crypto.generateRandomIV();
if (iv.length == 24)
ok = true;
} catch (e) {}
} catch (e) {
this._log.debug("Crypto check failed: " + e);
}
return ok;
},
@ -606,6 +607,9 @@ WeaveSvc.prototype = {
_sync: function WeaveSvc__sync() {
let self = yield;
if (!this.enabled)
return;
if (!this._loggedIn) {
this._disableSchedule();
throw "aborting sync, not logged in";
@ -661,6 +665,9 @@ WeaveSvc.prototype = {
_syncAsNeeded: function WeaveSvc__syncAsNeeded() {
let self = yield;
if (!this.enabled)
return;
try {
if (!this._loggedIn) {