diff --git a/platform/mv3/make-rulesets.js b/platform/mv3/make-rulesets.js index 9c62718ee..7fb24351b 100644 --- a/platform/mv3/make-rulesets.js +++ b/platform/mv3/make-rulesets.js @@ -233,7 +233,10 @@ async function fetchList(assetDetails) { continue; } fetchedURLs.add(part.url); - if ( part.url.startsWith('https://ublockorigin.github.io/uAssets/filters/') ) { + if ( + assetDetails.trustedSource || + part.url.startsWith('https://ublockorigin.github.io/uAssets/filters/') + ) { newParts.push(`!#trusted on ${secret}`); } newParts.push( @@ -248,7 +251,7 @@ async function fetchList(assetDetails) { return { url, content }; } } - log(`No valid content for ${details.name}`, false); + log(`No valid content for ${url}`, false); return { url, content: '' }; }) ); @@ -1464,6 +1467,17 @@ async function main() { homeURL: 'https://github.com/StevenBlack/hosts#readme', }); + await rulesetFromURLs({ + id: 'ubol-tests', + name: 'uBO Lite Test Filters', + enabled: false, + trusted: true, + urls: [ 'https://ublockorigin.github.io/uBOL-home/tests/test-filters.txt' ], + homeURL: 'https://ublockorigin.github.io/uBOL-home/tests/test-filters.html', + filters: [ + ], + }); + // Regional rulesets const excludedLists = [ 'ara-0', diff --git a/platform/mv3/scriptlets/scriptlet.template.js b/platform/mv3/scriptlets/scriptlet.template.js index 4cef174f6..f43fb6ad2 100644 --- a/platform/mv3/scriptlets/scriptlet.template.js +++ b/platform/mv3/scriptlets/scriptlet.template.js @@ -55,15 +55,18 @@ const hnParts = []; try { let origin = document.location.origin; if ( origin === 'null' ) { - const origins = document.location.ancestorOrigins; + const origins = document.location.ancestorOrigins || []; for ( let i = 0; i < origins.length; i++ ) { origin = origins[i]; if ( origin !== 'null' ) { break; } } } - const pos = origin.lastIndexOf('://'); - if ( pos === -1 ) { return; } - hnParts.push(...origin.slice(pos+3).split('.')); + const beg = origin.lastIndexOf('://'); + if ( beg === -1 ) { return; } + let hn = origin.slice(beg+3) + const end = hn.indexOf(':'); + if ( end !== -1 ) { hn = hn.slice(0, end); } + hnParts.push(...hn.split('.')); } catch { } const hnpartslen = hnParts.length;