@@ -206,7 +206,8 @@ function RuleSets() {
206206
207207RuleSets . prototype = {
208208
209- initialize : async function ( ) {
209+ initialize : async function ( store ) {
210+ this . store = store ;
210211 this . ruleActiveStates = store . localStorage ;
211212 this . addFromJson ( util . loadExtensionFile ( 'rules/default.rulesets' , 'json' ) ) ;
212213 this . loadStoredUserRules ( ) ;
@@ -356,7 +357,7 @@ RuleSets.prototype = {
356357 * Retrieve stored user rules from localStorage
357358 **/
358359 getStoredUserRules : function ( ) {
359- const oldUserRuleString = store . localStorage . getItem ( this . USER_RULE_KEY ) ;
360+ const oldUserRuleString = this . store . localStorage . getItem ( this . USER_RULE_KEY ) ;
360361 let oldUserRules = [ ] ;
361362 if ( oldUserRuleString ) {
362363 oldUserRules = JSON . parse ( oldUserRuleString ) ;
@@ -390,7 +391,7 @@ RuleSets.prototype = {
390391 // client windows in different event loops.
391392 oldUserRules . push ( params ) ;
392393 // TODO: can we exceed the max size for storage?
393- store . localStorage . setItem ( this . USER_RULE_KEY , JSON . stringify ( oldUserRules ) ) ;
394+ this . store . localStorage . setItem ( this . USER_RULE_KEY , JSON . stringify ( oldUserRules ) ) ;
394395 }
395396 } ,
396397
@@ -406,13 +407,13 @@ RuleSets.prototype = {
406407 ! ( r . host == ruleset . name &&
407408 r . redirectTo == ruleset . rules [ 0 ] . to )
408409 ) ;
409- store . localStorage . setItem ( this . USER_RULE_KEY , JSON . stringify ( userRules ) ) ;
410+ this . store . localStorage . setItem ( this . USER_RULE_KEY , JSON . stringify ( userRules ) ) ;
410411 }
411412 } ,
412413
413414 addStoredCustomRulesets : function ( ) {
414415 return new Promise ( resolve => {
415- store . get ( {
416+ this . store . get ( {
416417 legacy_custom_rulesets : [ ] ,
417418 debugging_rulesets : ""
418419 } , item => {
0 commit comments