[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [https-everywhere/master 2/5] Avoid some confusing variable names.
Author: Peter Eckersley <pde@xxxxxxx>
Date: Thu, 11 Nov 2010 09:49:50 -0800
Subject: Avoid some confusing variable names.
Commit: bc5e0f250452d5f402625e72ec38bc8c5b00b821
---
src/chrome/content/code/HTTPSRules.js | 27 +++++++++++++--------------
src/chrome/content/preferences.js | 12 ++++++------
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/src/chrome/content/code/HTTPSRules.js b/src/chrome/content/code/HTTPSRules.js
index cb0b1fc..0d0818e 100644
--- a/src/chrome/content/code/HTTPSRules.js
+++ b/src/chrome/content/code/HTTPSRules.js
@@ -256,14 +256,13 @@ const RuleWriter = {
const HTTPSRules = {
init: function() {
try {
- this.rules = [];
- this.exclusions = [];
+ this.rulesets = [];
var rulefiles = RuleWriter.enumerate(RuleWriter.getCustomRuleDir());
this.scanRulefiles(rulefiles);
rulefiles = RuleWriter.enumerate(RuleWriter.getRuleDir());
this.scanRulefiles(rulefiles);
- this.rules.sort(
+ this.rulesets.sort(
function(r1,r2) {
if (r1.name.toLowerCase() < r2.name.toLowerCase()) return -1;
else return 1;
@@ -281,20 +280,20 @@ const HTTPSRules = {
var r = null;
for(i = 0; i < rulefiles.length; ++i) {
try {
- this.log(DBUG,"Loading rule file: "+rulefiles[i].path);
+ this.log(DBUG,"Loading ruleset file: "+rulefiles[i].path);
r = RuleWriter.read(rulefiles[i]);
if (r != null)
- this.rules.push(r);
+ this.rulesets.push(r);
} catch(e) {
- this.log(WARN, "Error in rules file: " + e);
+ this.log(WARN, "Error in ruleset file: " + e);
}
}
},
replaceURI: function(uri) {
var i = 0;
- for(i = 0; i < this.rules.length; ++i) {
- if(this.rules[i].replaceURI(uri))
+ for(i = 0; i < this.rulesets.length; ++i) {
+ if(this.rulesets[i].replaceURI(uri))
return true;
}
return false;
@@ -303,8 +302,8 @@ const HTTPSRules = {
rewrittenURI: function(uri) {
var i = 0;
var newuri = null
- for(i = 0; i < this.rules.length; ++i) {
- if ((newuri = this.rules[i].rewrittenURI(uri)))
+ for(i = 0; i < this.rulesets.length; ++i) {
+ if ((newuri = this.rulesets[i].rewrittenURI(uri)))
return newuri;
}
return null;
@@ -320,10 +319,10 @@ const HTTPSRules = {
this.log(DBUG, " rawhost: " + c.rawHost);
var i,j;
// XXX lots of optimisation could happen here
- for (i = 0; i < this.rules.length; ++i)
- if (this.rules[i].active)
- for (j = 0; j < this.rules[i].cookierules.length; j++) {
- var cr = this.rules[i].cookierules[j];
+ for (i = 0; i < this.rulesets.length; ++i)
+ if (this.rulesets[i].active)
+ for (j = 0; j < this.rulesets[i].cookierules.length; j++) {
+ var cr = this.rulesets[i].cookierules[j];
if (cr.host_c.test(c.host) && cr.name_c.test(c.name))
return true;
}
diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 8ace9bd..a790ed2 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -13,7 +13,7 @@ function https_settings_changed(doc)
// This is not efficient but it doesn't matter
{
var rs = doc.getElementById('https_everywhere_RuleSetList');
- var rulesets = https_everywhere.https_rules.rules;
+ var rulesets = https_everywhere.https_rules.rulesets;
for (var i = 0; i < rulesets.length; i++) {
var ruleset = rulesets[i];
var elem = doc.getElementById(id_prefix + ruleset.name);
@@ -26,7 +26,7 @@ function https_prefs_init(doc) {
var o_httpsprefs = https_everywhere.get_prefs();
var rs = doc.getElementById('https_everywhere_RuleSetList');
- var rulesets = https_everywhere.https_rules.rules;
+ var rulesets = https_everywhere.https_rules.rulesets;
var hbox;
for (var i = 0; i < rulesets.length; i++) {
@@ -61,7 +61,7 @@ function https_prefs_init(doc) {
function https_prefs_cancel(doc) {
// the user changed some prefs but then cancelled; undo the consequences
var o_httpsprefs = https_everywhere.get_prefs();
- var rulesets = https_everywhere.https_rules.rules;
+ var rulesets = https_everywhere.https_rules.rulesets;
for (var i = 0; i < rulesets.length; i++) {
var ruleset = rulesets[i];
ruleset.active = o_httpsprefs.getBoolPref(ruleset.name);
@@ -72,7 +72,7 @@ function https_prefs_cancel(doc) {
function https_prefs_save(doc) {
var o_httpsprefs = https_everywhere.get_prefs();
var rs = doc.getElementById('https_everywhere_RuleSetList');
- var rulesets = https_everywhere.https_rules.rules;
+ var rulesets = https_everywhere.https_rules.rulesets;
for (var i = 0; i < rulesets.length; i++) {
var ruleset = rulesets[i];
var elem = doc.getElementById(id_prefix + ruleset.name);
@@ -81,9 +81,9 @@ function https_prefs_save(doc) {
}
function https_set_all(doc,val) {
- // set all rules to val (enable/disable)
+ // set all rulesets to val (enable/disable)
var o_httpsprefs = https_everywhere.get_prefs();
- var rulesets = https_everywhere.https_rules.rules;
+ var rulesets = https_everywhere.https_rules.rulesets;
var rs = doc.getElementById('https_everywhere_RuleSetList');
for (var i = 0; i < rulesets.length; i++) {
var ruleset = rulesets[i];
--
1.7.1