Remove support for implicit scriptlet injection

Related issue:
- https://github.com/gorhill/uBlock/issues/3550
This commit is contained in:
Raymond Hill 2019-02-20 07:18:37 -05:00
parent b585518c00
commit c83b6776da
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -323,22 +323,7 @@
const domain = request.domain; const domain = request.domain;
const entity = request.entity; const entity = request.entity;
// https://github.com/gorhill/uBlock/issues/1954 const entries = [];
// Implicit
let hn = hostname;
for (;;) {
lookupScriptlet(hn + '.js', reng, scriptletsRegister);
if ( hn === domain ) { break; }
const pos = hn.indexOf('.');
if ( pos === -1 ) { break; }
hn = hn.slice(pos + 1);
}
if ( entity !== '' ) {
lookupScriptlet(entity + '.js', reng, scriptletsRegister);
}
// Explicit
let entries = [];
const domainHash = µb.staticExtFilteringEngine.makeHash(domain); const domainHash = µb.staticExtFilteringEngine.makeHash(domain);
if ( domainHash !== 0 ) { if ( domainHash !== 0 ) {
scriptletDB.retrieve(domainHash, hostname, entries); scriptletDB.retrieve(domainHash, hostname, entries);
@ -355,7 +340,7 @@
if ( scriptletsRegister.size === 0 ) { return; } if ( scriptletsRegister.size === 0 ) { return; }
// Collect exception filters. // Collect exception filters.
entries = []; entries.length = 0;
if ( domainHash !== 0 ) { if ( domainHash !== 0 ) {
scriptletDB.retrieve(domainHash | 0b0001, hostname, entries); scriptletDB.retrieve(domainHash | 0b0001, hostname, entries);
} }