@@ -19,20 +19,13 @@ function CookieRule(host, cookiename) {
1919 //this.name_c = new RegExp(cookiename);
2020}
2121
22- function RuleSet ( id , name , xmlName , match_rule , default_off , platform ) {
23- if ( xmlName == "WordPress.xml" || xmlName == "Github.xml" ) {
24- this . log ( NOTE , "RuleSet( name=" + name + ", xmlName=" + xmlName + ", match_rule=" + match_rule + ", default_off=" + default_off + ", platform=" + platform + " )" ) ;
25- }
26-
22+ function RuleSet ( id , name , default_off , platform ) {
2723 this . id = id ;
2824 this . on_by_default = true ;
2925 this . compiled = false ;
3026 this . name = name ;
31- this . xmlName = xmlName ;
3227 this . notes = "" ;
3328
34- if ( match_rule ) this . ruleset_match_c = new RegExp ( match_rule ) ;
35- else this . ruleset_match_c = null ;
3629 if ( default_off ) {
3730 // Perhaps problematically, this currently ignores the actual content of
3831 // the default_off XML attribute. Ideally we'd like this attribute to be
@@ -93,12 +86,7 @@ RuleSet.prototype = {
9386 var i ;
9487 var returl = null ;
9588 this . ensureCompiled ( ) ;
96- // If a rulset has a match_rule and it fails, go no further
97- if ( this . ruleset_match_c && ! this . ruleset_match_c . test ( urispec ) ) {
98- this . log ( VERB , "ruleset_match_c excluded " + urispec ) ;
99- return null ;
100- }
101- // Even so, if we're covered by an exclusion, go home
89+ // If we're covered by an exclusion, go home
10290 for ( i = 0 ; i < this . exclusions . length ; ++ i ) {
10391 if ( this . exclusions [ i ] . pattern_c . test ( urispec ) ) {
10492 this . log ( DBUG , "excluded uri " + urispec ) ;
@@ -111,7 +99,7 @@ RuleSet.prototype = {
11199 returl = urispec . replace ( this . rules [ i ] . from_c , this . rules [ i ] . to ) ;
112100 if ( returl != urispec ) {
113101 // we rewrote the uri
114- this . log ( DBUG , "Rewrote " + urispec + " -> " + returl + " using " + this . xmlName + ": " + this . rules [ i ] . from_c + " -> " + this . rules [ i ] . to ) ;
102+ this . log ( DBUG , "Rewrote " + urispec + " -> " + returl + " using " + this . name + ": " + this . rules [ i ] . from_c + " -> " + this . rules [ i ] . to ) ;
115103 return returl ;
116104 }
117105 }
@@ -121,35 +109,6 @@ RuleSet.prototype = {
121109 log : function ( level , msg ) {
122110 https_everywhereLog ( level , msg ) ;
123111 } ,
124-
125- wouldMatch : function ( hypothetical_uri , alist ) {
126- // return true if this ruleset would match the uri, assuming it were http
127- // used for judging moot / inactive rulesets
128- // alist is optional
129-
130- // if the ruleset is already somewhere in this applicable list, we don't
131- // care about hypothetical wouldMatch questions
132- if ( alist && ( this . name in alist . all ) ) return false ;
133-
134- this . log ( DBUG , "Would " + this . name + " match " + hypothetical_uri . spec +
135- "? serial " + ( alist && alist . serial ) ) ;
136-
137- var uri = hypothetical_uri . clone ( ) ;
138- if ( uri . scheme == "https" ) uri . scheme = "http" ;
139- var urispec = uri . spec ;
140-
141- this . ensureCompiled ( ) ;
142-
143- if ( this . ruleset_match_c && ! this . ruleset_match_c . test ( urispec ) )
144- return false ;
145-
146- for ( var i = 0 ; i < this . exclusions . length ; ++ i )
147- if ( this . exclusions [ i ] . pattern_c . test ( urispec ) ) return false ;
148-
149- for ( var i = 0 ; i < this . rules . length ; ++ i )
150- if ( this . rules [ i ] . from_c . test ( urispec ) ) return true ;
151- return false ;
152- } ,
153112
154113 transformURI : function ( uri ) {
155114 // If no rule applies, return null; if a rule would have applied but was
@@ -309,10 +268,9 @@ const RuleWriter = {
309268
310269 this . log ( DBUG , "Parsing " + xmlruleset . getAttribute ( "name" ) ) ;
311270
312- var match_rl = xmlruleset . getAttribute ( "match_rule" ) ;
313271 var dflt_off = xmlruleset . getAttribute ( "default_off" ) ;
314272 var platform = xmlruleset . getAttribute ( "platform" ) ;
315- var rs = new RuleSet ( ruleset_id , xmlruleset . getAttribute ( "name" ) , xmlruleset . getAttribute ( "f" ) , match_rl , dflt_off , platform ) ;
273+ var rs = new RuleSet ( ruleset_id , xmlruleset . getAttribute ( "name" ) , dflt_off , platform ) ;
316274
317275 // see if this ruleset has the same name as an existing ruleset;
318276 // if so, this ruleset is ignored; DON'T add or return it.
@@ -498,31 +456,26 @@ const HTTPSRules = {
498456 }
499457
500458 // ponder each potentially applicable ruleset, working out if it applies
501- // and recording it as active/inactive/moot/ breaking in the applicable list
459+ // and recording it as active/inactive/breaking in the applicable list
502460 for ( i = 0 ; i < rs . length ; ++ i ) {
503461 if ( ! rs [ i ] . active ) {
504- if ( alist && rs [ i ] . wouldMatch ( uri , alist ) )
505- alist . inactive_rule ( rs [ i ] ) ;
506- continue ;
507- }
462+ alist . inactive_rule ( rs [ i ] ) ;
463+ }
508464 blob . newuri = rs [ i ] . transformURI ( uri ) ;
509465 if ( blob . newuri ) {
510466 if ( alist ) {
511- if ( uri . spec in https_everywhere_blacklist )
467+ if ( uri . spec in https_everywhere_blacklist ) {
512468 alist . breaking_rule ( rs [ i ] ) ;
513- else
469+ } else {
514470 alist . active_rule ( rs [ i ] ) ;
515- }
516- if ( userpass_present ) blob . newuri . userPass = input_uri . userPass ;
471+ }
472+ }
473+ if ( userpass_present ) {
474+ blob . newuri . userPass = input_uri . userPass ;
475+ }
517476 blob . applied_ruleset = rs [ i ] ;
518477 return blob ;
519478 }
520- if ( uri . scheme == "https" && alist ) {
521- // we didn't rewrite but the rule applies to this domain and the
522- // requests are going over https
523- if ( rs [ i ] . wouldMatch ( uri , alist ) ) alist . moot_rule ( rs [ i ] ) ;
524- continue ;
525- }
526479 }
527480 return null ;
528481 } ,
@@ -709,9 +662,6 @@ const HTTPSRules = {
709662 return true ;
710663 }
711664 }
712- if ( ruleset . cookierules . length > 0 && applicable_list ) {
713- applicable_list . moot_rule ( ruleset ) ;
714- }
715665 } else if ( ruleset . cookierules . length > 0 ) {
716666 if ( applicable_list ) {
717667 applicable_list . inactive_rule ( ruleset ) ;
0 commit comments