diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 4facff119..f7fd6fad3 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -1147,7 +1147,9 @@ vAPI.domSurveyor = (function() { pending.nodes = added; } else { nodes = pending.nodes.splice(0, 1000); - pending.nodes = pending.nodes.concat(added); + if ( added.length !== 0 ) { + pending.nodes = pending.nodes.concat(added); + } } return nodes; }; @@ -1212,8 +1214,8 @@ vAPI.domSurveyor = (function() { { what: 'retrieveGenericCosmeticSelectors', hostname: hostname, - ids: ids.join('\n'), - classes: classes.join('\n'), + ids: ids, + classes: classes, exceptions: domFilterer.exceptions, cost: surveyCost }, diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 6d30a36d8..d10eb4100 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -1054,14 +1054,8 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) { for ( let type in this.lowlyGeneric ) { let entry = this.lowlyGeneric[type]; let selectors = request[entry.canonical]; - if ( typeof selectors !== 'string' ) { continue; } - let strEnd = selectors.length; - let sliceBeg = 0; - do { - let sliceEnd = selectors.indexOf('\n', sliceBeg); - if ( sliceEnd === -1 ) { sliceEnd = strEnd; } - let selector = selectors.slice(sliceBeg, sliceEnd); - sliceBeg = sliceEnd + 1; + if ( Array.isArray(selectors) === false ) { continue; } + for ( let selector of selectors ) { if ( entry.simple.has(selector) === false ) { continue; } let bucket = entry.complex.get(selector); if ( bucket !== undefined ) { @@ -1080,7 +1074,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) { simpleSelectors.add(selector); } } - } while ( sliceBeg < strEnd ); + } } // Apply exceptions: it is the responsibility of the caller to provide