[mv3] Add test suite list to available rulesets

Microsoft Edge for Android requires a "link to the core function
test cases for your Edge Android extension" to verify that the
extension function properly.
This commit is contained in:
Raymond Hill 2025-03-06 17:39:15 -05:00
parent 31d82c494b
commit 536f0fba25
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 23 additions and 6 deletions

View file

@ -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',

View file

@ -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;