@@ -159,11 +159,7 @@ function HTTPSEverywhere() {
159159 this . INCLUDE = INCLUDE ;
160160 this . ApplicableList = ApplicableList ;
161161
162- var prefs = CC [ "@mozilla.org/preferences-service;1" ]
163- . getService ( Components . interfaces . nsIPrefService ) ;
164- this . prefs = prefs ;
165- var branch = prefs . getBranch ( "extensions.https_everywhere." ) ;
166-
162+ this . prefs = this . get_prefs ( ) ;
167163
168164 // We need to use observers instead of categories for FF3.0 for these:
169165 // https://developer.mozilla.org/en/Observer_Notifications
@@ -174,10 +170,10 @@ function HTTPSEverywhere() {
174170 this . obsService = CC [ "@mozilla.org/observer-service;1" ]
175171 . getService ( Components . interfaces . nsIObserverService ) ;
176172
177- if ( branch . getBoolPref ( "globalEnabled" ) ) {
178- this . obsService . addObserver ( this , "profile-before-change" , false ) ;
179- this . obsService . addObserver ( this , "profile-after-change" , false ) ;
180- this . obsService . addObserver ( this , "sessionstore-windows-restored" , false ) ;
173+ if ( this . prefs . getBoolPref ( "globalEnabled" ) ) {
174+ this . obsService . addObserver ( this , "profile-before-change" , false ) ;
175+ this . obsService . addObserver ( this , "profile-after-change" , false ) ;
176+ this . obsService . addObserver ( this , "sessionstore-windows-restored" , false ) ;
181177 }
182178 return ;
183179}
@@ -474,7 +470,7 @@ HTTPSEverywhere.prototype = {
474470 } else if ( topic == "profile-after-change" ) {
475471 this . log ( DBUG , "Got profile-after-change" ) ;
476472
477- if ( prefs . getBoolPref ( "globalEnabled" ) ) {
473+ if ( this . prefs . getBoolPref ( "globalEnabled" ) ) {
478474 OS . addObserver ( this , "cookie-changed" , false ) ;
479475 OS . addObserver ( this , "http-on-modify-request" , false ) ;
480476 OS . addObserver ( this , "http-on-examine-merged-response" , false ) ;
@@ -634,7 +630,7 @@ HTTPSEverywhere.prototype = {
634630 } ,
635631
636632 toggleEnabledState : function ( ) {
637- if ( prefs . getBoolPref ( "globalEnabled" ) ) {
633+ if ( this . prefs . getBoolPref ( "globalEnabled" ) ) {
638634 try {
639635 this . obsService . removeObserver ( this , "profile-before-change" ) ;
640636 this . obsService . removeObserver ( this , "profile-after-change" ) ;
@@ -652,7 +648,7 @@ HTTPSEverywhere.prototype = {
652648 . getService ( CI . nsIWebProgress ) ;
653649 dls . removeProgressListener ( this ) ;
654650
655- prefs . setBoolPref ( "globalEnabled" , false ) ;
651+ this . prefs . setBoolPref ( "globalEnabled" , false ) ;
656652 }
657653 catch ( e ) {
658654 this . log ( WARN , "Couldn't remove observers: " + e ) ;
@@ -687,7 +683,7 @@ HTTPSEverywhere.prototype = {
687683 SERVICE_CTRID , false , true ) ;
688684
689685 HTTPSRules . init ( ) ;
690- prefs . setBoolPref ( "globalEnabled" , true ) ;
686+ this . prefs . setBoolPref ( "globalEnabled" , true ) ;
691687 }
692688 catch ( e ) {
693689 this . log ( WARN , "Couldn't add observers: " + e ) ;
0 commit comments