1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-04 08:37:11 +02:00

Various minor code review

This commit is contained in:
Raymond Hill 2023-04-25 21:15:11 -04:00
parent a02c241842
commit 1ffdb7d948
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 7 additions and 8 deletions

View File

@ -143,7 +143,7 @@ vAPI.alarms = {
const delayInMinutes = this.normalizeDelay(delay); const delayInMinutes = this.normalizeDelay(delay);
browser.alarms.get(this.name, alarm => { browser.alarms.get(this.name, alarm => {
if ( alarm ) { return; } if ( alarm ) { return; }
return browser.alarms.create(this.name, { delayInMinutes }); browser.alarms.create(this.name, { delayInMinutes });
}); });
} }
offon(delay) { offon(delay) {

View File

@ -91,7 +91,7 @@ const ttlManage = function(count) {
ttlTimer.off(); ttlTimer.off();
ttlCount += count; ttlCount += count;
if ( ttlCount > 0 ) { return; } if ( ttlCount > 0 ) { return; }
if ( lz4CodecInstance === null ) { return; } if ( lz4CodecInstance === undefined ) { return; }
ttlTimer.on(ttlDelay); ttlTimer.on(ttlDelay);
}; };

View File

@ -1211,6 +1211,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
const create = async function() { const create = async function() {
if ( µb.inMemoryFilters.length !== 0 ) { return; } if ( µb.inMemoryFilters.length !== 0 ) { return; }
if ( Object.keys(µb.availableFilterLists).length === 0 ) { return; }
await Promise.all([ await Promise.all([
io.put( io.put(
'selfie/main', 'selfie/main',
@ -1245,12 +1246,10 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
selfie = JSON.parse(details.content); selfie = JSON.parse(details.content);
} catch(ex) { } catch(ex) {
} }
if ( if ( selfie instanceof Object === false ) { return false; }
selfie instanceof Object === false || if ( selfie.magic !== µb.systemSettings.selfieMagic ) { return false; }
selfie.magic !== µb.systemSettings.selfieMagic if ( selfie.availableFilterLists instanceof Object === false ) { return false; }
) { if ( Object.keys(selfie.availableFilterLists).length === 0 ) { return false; }
return false;
}
µb.availableFilterLists = selfie.availableFilterLists; µb.availableFilterLists = selfie.availableFilterLists;
return true; return true;
}; };