forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicableList.js
More file actions
68 lines (59 loc) · 2.33 KB
/
ApplicableList.js
File metadata and controls
68 lines (59 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// An ApplicableList is a structure used to keep track of which rulesets
// were applied, and which ones weren't but might have been, to the contents
// of a given page (top level nsIDOMWindow)
var serial_number = 0;
function ApplicableList(logger, doc, domWin) {
this.domWin = domWin;
this.uri = doc.baseURIObject.clone();
if (!this.uri) {
this.log(WARN,"NULL CLONING URI " + doc);
if (doc)
this.log(WARN,"NULL CLONING URI " + doc.baseURIObject);
if (doc.baseURIObject)
this.log(WARN,"NULL CLONING URI " + doc.baseURIObject.spec);
}
this.home = doc.baseURIObject.spec; // what doc we're housekeeping for
this.log = logger;
this.active = {};
this.breaking = {}; // rulesets with redirection loops
this.inactive = {};
this.moot = {}; // rulesets that might be applicable but uris are already https
this.all = {}; // active + breaking + inactive + moot
serial_number += 1;
this.serial = serial_number;
this.log(DBUG,"Alist serial #" + this.serial + " for " + this.home);
};
ApplicableList.prototype = {
empty: function() {
// Empty everything, used when toggles occur in order to ensure that if
// the reload fails, the resulting list is not eroneous
this.active = {};
this.breaking = {};
this.inactive = {};
this.moot = {};
this.all = {};
},
active_rule: function(ruleset) {
this.log(INFO,"active rule " + ruleset.name +" in "+ this.home +" -> " +
this.domWin.document.baseURIObject.spec+ " serial " + this.serial);
this.active[ruleset.name] = ruleset;
this.all[ruleset.name] = ruleset;
},
breaking_rule: function(ruleset) {
this.log(NOTE,"breaking rule " + ruleset.name +" in "+ this.home +" -> " +
this.domWin.document.baseURIObject.spec+ " serial " + this.serial);
this.breaking[ruleset.name] = ruleset;
this.all[ruleset.name] = ruleset;
},
inactive_rule: function(ruleset) {
this.log(INFO,"inactive rule " + ruleset.name +" in "+ this.home +" -> " +
this.domWin.document.baseURIObject.spec+ " serial " + this.serial);
this.inactive[ruleset.name] = ruleset;
this.all[ruleset.name] = ruleset;
},
moot_rule: function(ruleset) {
this.log(INFO,"moot rule " + ruleset.name +" in "+ this.home + " serial " + this.serial);
this.moot[ruleset.name] = ruleset;
this.all[ruleset.name] = ruleset;
},
};