Skip to content

Commit b784b7d

Browse files
committed
Support loading of benchmark dataset in published versions
New advanced setting: `benchmarkDatasetURL` Default value: `unset` To specify a URL from where the benchmark dataset will be fetched. This allows to launch benchmark operations from within published versions of uBO, rather than from just a locally built version.
1 parent 4f75a07 commit b784b7d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/js/background.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const µBlock = (( ) => { // jshint ignore:line
4242
autoUpdateAssetFetchPeriod: 120,
4343
autoUpdateDelayAfterLaunch: 180,
4444
autoUpdatePeriod: 7,
45+
benchmarkDatasetURL: 'unset',
4546
blockingProfiles: '11111/#F00 11011/#C0F 11001/#00F 00001',
4647
cacheStorageAPI: 'unset',
4748
cacheStorageCompression: true,

src/js/utils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,15 +684,18 @@
684684
vAPI.setTimeout(( ) => {
685685
ttlTimer = undefined;
686686
datasetPromise = undefined;
687-
}, 60000);
687+
}, 5 * 60 * 1000);
688688

689689
if ( datasetPromise !== undefined ) {
690690
return datasetPromise;
691691
}
692692

693+
const datasetURL = µBlock.hiddenSettings.benchmarkDatasetURL;
694+
if ( datasetURL === 'unset' ) {
695+
return Promise.reject('No dataset');
696+
}
693697
console.info(`Loading benchmark dataset...`);
694-
const url = vAPI.getURL('/assets/requests.json');
695-
datasetPromise = µBlock.assets.fetchText(url).then(details => {
698+
datasetPromise = µBlock.assets.fetchText(datasetURL).then(details => {
696699
console.info(`Parsing benchmark dataset...`);
697700
const requests = [];
698701
const lineIter = new µBlock.LineIterator(details.content);

tools/make-assets.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ fi
1515
rm -rf $DES
1616
cp -R ./assets $DES/
1717

18-
if [ -f ./tmp/requests.json.gz ]; then
19-
gunzip -c ./tmp/requests.json.gz > $DES/requests.json
20-
fi
21-
2218
mkdir $DES/thirdparties
2319
cp -R ../uAssets/thirdparties/easylist-downloads.adblockplus.org $DES/thirdparties/
2420
cp -R ../uAssets/thirdparties/mirror1.malwaredomains.com $DES/thirdparties/

0 commit comments

Comments
 (0)