Skip to content

Commit 7aefd56

Browse files
author
katmagic
committed
Add a 'Notes' column in the preferences dialog.
1 parent 0955baa commit 7aefd56

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

src/chrome/content/code/HTTPSRules.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function RuleSet(name, match_rule, default_off) {
2020
var on_by_default = true;
2121
this.name = name;
2222
this.ruleset_match = match_rule;
23+
this.notes = "";
2324
if (match_rule) {
2425
this.ruleset_match_c = new RegExp(match_rule);
2526
} else {
@@ -30,6 +31,7 @@ function RuleSet(name, match_rule, default_off) {
3031
// the default_off XML attribute. Ideally we'd like this attribute to be
3132
// "valueless"
3233
on_by_default = false;
34+
this.notes = default_off;
3335
}
3436
this.rules = [];
3537
this.exclusions = [];
@@ -264,8 +266,8 @@ const HTTPSRules = {
264266
}
265267
}
266268

267-
// for any rulesets with <target host="*">
268-
// every URI needs to be checked against these rulesets
269+
// for any rulesets with <target host="*">
270+
// every URI needs to be checked against these rulesets
269271
// (though currently we don't ship any)
270272
this.global_rulesets = this.targets["*"] ? this.targets["*"] : [];
271273

@@ -289,7 +291,7 @@ const HTTPSRules = {
289291
try {
290292
this.log(DBUG,"Loading ruleset file: "+rulefiles[i].path);
291293
r = RuleWriter.read(rulefiles[i], targets, this.rulesets);
292-
if (r != null)
294+
if (r != null)
293295
this.rulesets.push(r);
294296
} catch(e) {
295297
this.log(WARN, "Error in ruleset file: " + e);
@@ -334,13 +336,13 @@ const HTTPSRules = {
334336
results = results.concat(this.targets[t]);
335337
}
336338
this.log(DBUG,"Applicable rules for " + host + ":");
337-
for (i = 0; i < results.length; ++i)
339+
for (i = 0; i < results.length; ++i)
338340
this.log(DBUG, " " + results[i].name);
339341
return results;
340342
},
341-
343+
342344
shouldSecureCookie: function(c) {
343-
// Check to see if the Cookie object c meets any of our cookierule citeria
345+
// Check to see if the Cookie object c meets any of our cookierule citeria
344346
// for being marked as secure
345347
//this.log(DBUG, "Testing cookie:");
346348
//this.log(DBUG, " name: " + c.name);
@@ -351,10 +353,10 @@ const HTTPSRules = {
351353
var rs = this.applicableRulesets(c.host);
352354
for (i = 0; i < rs.length; ++i) {
353355
var ruleset = rs[i];
354-
if (ruleset.active)
356+
if (ruleset.active)
355357
for (j = 0; j < ruleset.cookierules.length; j++) {
356358
var cr = ruleset.cookierules[j];
357-
if (cr.host_c.test(c.host) && cr.name_c.test(c.name))
359+
if (cr.host_c.test(c.host) && cr.name_c.test(c.name))
358360
return true;
359361
}
360362
}

src/chrome/content/preferences.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,23 @@ function https_prefs_init(doc) {
1919
treeView = {
2020
rules: rulesets,
2121
rowCount: rulesets.length,
22-
getCellText: function(row, col) { // site names
22+
getCellValue: function(row, col) { // site names
2323
if (!this.rules[row]) return;
24-
return this.rules[row].name;
24+
25+
switch (col.id) {
26+
case "site_col":
27+
return this.rules[row].name;
28+
case "note_col":
29+
return this.rules[row].notes;
30+
case "enabled_col":
31+
var e = o_httpsprefs.getBoolPref(this.rules[row].name);
32+
return e ? "true" : "false";
33+
default:
34+
return;
35+
}
2536
},
26-
getCellValue: function(row, col) { // activation indicator
27-
if (!this.rules[row]) return;
28-
return o_httpsprefs.getBoolPref(this.rules[row].name) ? "true" : "false";
37+
getCellText: function(row, col) { // activation indicator
38+
return this.getCellValue(row, col);
2939
},
3040
setCellValue: function(row, col, val) { // toggle a rule's activation
3141
var rule = this.rules[row];

src/chrome/content/preferences.xul

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<treecol id="enabled_col" type="checkbox" label="Enabled"
2626
editable="true" />
2727
<treecol id="site_col" label="Site" flex="1" editable="false" />
28+
<treecol id="note_col" label="Notes" flex="1" editable="false" />
2829
</treecols>
2930
<treechildren/>
3031
</tree>

0 commit comments

Comments
 (0)