@@ -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