code review re last commit b446f9f8bd

This commit is contained in:
Raymond Hill 2017-12-22 11:56:27 -05:00
parent b446f9f8bd
commit 4f5f3652ed
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1260,19 +1260,17 @@ FilterContainer.prototype.compileGenericHideSelector = function(parsed, writer)
/******************************************************************************/ /******************************************************************************/
FilterContainer.prototype.compileGenericUnhideSelector = function(parsed, writer) { FilterContainer.prototype.compileGenericUnhideSelector = function(parsed, writer) {
var selector = parsed.suffix, var selector = parsed.suffix;
compiled;
// script:contains(...) // script:contains(...)
// script:inject(...) // script:inject(...)
if ( this.reScriptSelector.test(selector) ) { if ( this.reScriptSelector.test(selector) ) {
compiled = [ 6 /* js */, '!', '', selector ]; writer.push([ 6 /* js */, '!', '', selector ]);
writer.push(compiled);
return; return;
} }
// Procedural cosmetic filters are acceptable as generic exception filters. // Procedural cosmetic filters are acceptable as generic exception filters.
compiled = this.compileSelector(selector); var compiled = this.compileSelector(selector);
if ( compiled === undefined ) { return; } if ( compiled === undefined ) { return; }
// https://github.com/chrisaljoudi/uBlock/issues/497 // https://github.com/chrisaljoudi/uBlock/issues/497
@ -1298,8 +1296,7 @@ FilterContainer.prototype.compileHostnameSelector = function(hostname, parsed, w
var selector = parsed.suffix, var selector = parsed.suffix,
domain = this.µburi.domainFromHostname(hostname), domain = this.µburi.domainFromHostname(hostname),
hash, hash;
compiled;
// script:contains(...) // script:contains(...)
// script:inject(...) // script:inject(...)
@ -1308,12 +1305,11 @@ FilterContainer.prototype.compileHostnameSelector = function(hostname, parsed, w
if ( unhide ) { if ( unhide ) {
hash = '!' + hash; hash = '!' + hash;
} }
compiled = [ 6 /* js */, hash, hostname, selector ]; writer.push([ 6 /* js */, hash, hostname, selector ]);
writer.push(compiled);
return; return;
} }
compiled = this.compileSelector(selector); var compiled = this.compileSelector(selector);
if ( compiled === undefined ) { return; } if ( compiled === undefined ) { return; }
// https://github.com/chrisaljoudi/uBlock/issues/188 // https://github.com/chrisaljoudi/uBlock/issues/188