This commit is contained in:
gorhill 2016-10-26 08:59:15 -04:00
parent d827accdf0
commit f6c46ab582

View file

@ -232,15 +232,15 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
if ( matches === null || matches.length !== 4 ) { if ( matches === null || matches.length !== 4 ) {
return; return;
} }
var µburi = µBlock.URI,
var des = matches[1] || ''; des = matches[1] || '',
var pattern = (des + matches[2]).replace(/[.+?{}()|[\]\/\\]/g, '\\$&') pattern = (des + matches[2]).replace(/[.+?{}()|[\]\/\\]/g, '\\$&')
.replace(/\^/g, '[^\\w\\d%-]') .replace(/\^/g, '[^\\w\\d%-]')
.replace(/\*/g, '.*?'); .replace(/\*/g, '.*?'),
var type; type,
var redirect = ''; redirect = '',
var srcs = []; srcs = [],
var options = matches[3].split(','), option; options = matches[3].split(','), option;
while ( (option = options.pop()) ) { while ( (option = options.pop()) ) {
if ( option.startsWith('redirect=') ) { if ( option.startsWith('redirect=') ) {
redirect = option.slice(9); redirect = option.slice(9);
@ -251,7 +251,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
continue; continue;
} }
if ( option === 'first-party' ) { if ( option === 'first-party' ) {
srcs.push(des); srcs.push(µburi.domainFromHostname(des) || des);
continue; continue;
} }
// One and only one type must be specified. // One and only one type must be specified.