Skip to content

Commit 35b5304

Browse files
committed
[Try to] Create a place to store applicable rules to this page
1 parent f868838 commit 35b5304

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/chrome/content/code/HTTPSRules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const RuleWriter = {
180180
try {
181181
var xmlrules = XML(data);
182182
} catch(e) { // file has been corrupted; XXX: handle error differently
183-
this.log(WARN,"Error in XML file: " + file + "\n" + e);
183+
this.log(WARN,"Error in XML file: " + file.path + "\n" + e);
184184
return null;
185185
}
186186

src/components/https-everywhere.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ HTTPSEverywhere.prototype = {
210210
}
211211
},
212212

213+
// We use onLocationChange to make a fresh list of rulesets that could have
214+
// applied to the content in the current page. This will be appended to as
215+
// various content is embedded / requested by JavaScript
216+
onLocationChange: function(wp, req, uri) {
217+
this.log(WARN,"onLocationChange");
218+
if (wp instanceof CI.nsIWebProgress) {
219+
var x = wp.DOMWindow;
220+
if (x instanceof CI.nsIDOMWindow) {
221+
var top_window = x.top; // climb out of iframes
222+
top_window.https_everywhere_applicable_rules = {};
223+
} else {
224+
this.log(WARN,"onLocationChange: no nsIDOMWindow");
225+
}
226+
} else {
227+
this.log(WARN,"onLocationChange: no nsIWebProgress");
228+
}
229+
},
230+
213231
observe: function(subject, topic, data) {
214232
// Top level glue for the nsIObserver API
215233
var channel = subject;
@@ -244,7 +262,8 @@ HTTPSEverywhere.prototype = {
244262
OS.addObserver(this, "http-on-examine-response", false);
245263
var dls = CC['@mozilla.org/docloaderservice;1']
246264
.getService(CI.nsIWebProgress);
247-
dls.addProgressListener(this, CI.nsIWebProgress.NOTIFY_STATE_REQUEST);
265+
dls.addProgressListener(this, CI.nsIWebProgress.NOTIFY_STATE_REQUEST |
266+
CI.nsIWebProgress.NOTIFY_LOCATION);
248267
this.log(INFO,"ChannelReplacement.supported = "+ChannelReplacement.supported);
249268
try {
250269
// Firefox >= 4

0 commit comments

Comments
 (0)