@@ -417,6 +417,9 @@ SSLObservatory.prototype = {
417417 if ( ! certchain ) {
418418 return ;
419419 }
420+
421+ this . maybeUpdateCertWhitelist ( ) ;
422+
420423 var host_ip = "-1" ;
421424 var httpchannelinternal = channel . QueryInterface ( Ci . nsIHttpChannelInternal ) ;
422425 try {
@@ -546,9 +549,8 @@ SSLObservatory.prototype = {
546549 CC [ "@mozilla.org/file/local;1" ]
547550 . createInstance ( CI . nsILocalFile ) ;
548551 var path = this . HTTPSEverywhere . rw . chromeToPath ( loc ) ;
549- this . log ( WARN , "SAVING cert whitelist to " + path ) ;
552+ this . log ( NOTE , "SAVING cert whitelist to " + path ) ;
550553 file . initWithPath ( path ) ;
551- this . log ( WARN , "got " + file ) ;
552554 var data = this . HTTPSEverywhere . rw . write ( file , JSON . stringify ( this . whitelist ) ) ;
553555 } ,
554556
@@ -560,14 +562,20 @@ SSLObservatory.prototype = {
560562 // safe with int pref storage on 32 bit
561563 // systems
562564 var next = now + ( 1 + 2 * Math . random ( ) ) * 3600 * 24 ; // 1-3 days from now
563- if ( last_updated == 0 ) {
565+ if ( update_due == 0 ) {
564566 // first run
565567 this . prefs . setIntPref ( due_pref , next ) ;
566568 return null ;
567569 }
568570 if ( now <= update_due ) {
569571 return null ;
570572 }
573+
574+ // Updating the certlist might yet fail. But that's okay, we can
575+ // always live with a slightly older one.
576+ this . prefs . setIntPref ( due_pref , next ) ;
577+ this . log ( INFO , "Next whitelist update due at " + next ) ;
578+
571579 var req = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ]
572580 . createInstance ( Ci . nsIXMLHttpRequest ) ;
573581
@@ -598,7 +606,6 @@ SSLObservatory.prototype = {
598606 that . whitelist = whitelist ;
599607 that . log ( WARN , "Got valid whitelist..." + JSON . stringify ( whitelist ) ) ;
600608 that . saveCertWhitelist ( ) ;
601- that . prefs . setIntPref ( due_pref , next ) ;
602609 } else {
603610 that . log ( NOTE , "Unexpected response status " + req . status + " fetching chain whitelist" ) ;
604611 return false ;
0 commit comments