@@ -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 }
@@ -139,13 +127,10 @@ RuleSet.prototype = {
139127 var urispec = uri . spec ;
140128
141129 this . ensureCompiled ( ) ;
142-
143- if ( this . ruleset_match_c && ! this . ruleset_match_c . test ( urispec ) )
144- return false ;
145-
130+
146131 for ( var i = 0 ; i < this . exclusions . length ; ++ i )
147132 if ( this . exclusions [ i ] . pattern_c . test ( urispec ) ) return false ;
148-
133+
149134 for ( var i = 0 ; i < this . rules . length ; ++ i )
150135 if ( this . rules [ i ] . from_c . test ( urispec ) ) return true ;
151136 return false ;
@@ -309,10 +294,9 @@ const RuleWriter = {
309294
310295 this . log ( DBUG , "Parsing " + xmlruleset . getAttribute ( "name" ) ) ;
311296
312- var match_rl = xmlruleset . getAttribute ( "match_rule" ) ;
313297 var dflt_off = xmlruleset . getAttribute ( "default_off" ) ;
314298 var platform = xmlruleset . getAttribute ( "platform" ) ;
315- var rs = new RuleSet ( ruleset_id , xmlruleset . getAttribute ( "name" ) , xmlruleset . getAttribute ( "f" ) , match_rl , dflt_off , platform ) ;
299+ var rs = new RuleSet ( ruleset_id , xmlruleset . getAttribute ( "name" ) , dflt_off , platform ) ;
316300
317301 // see if this ruleset has the same name as an existing ruleset;
318302 // if so, this ruleset is ignored; DON'T add or return it.
0 commit comments