mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Ensure cache storage is selected before access
Possibly related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/2136 Also reported internally, steps to reproduce the issue fixed here: - Open uBO's dashboard through 3-dot > Add-ons > uBO > Settings - Bring forth "Filter lists" pane We want the tab to be already opened at next launch - Quit Firefox for Android - Launch Firefox for Android Result: Very long launch time, lists marked as out of date.
This commit is contained in:
parent
184942503f
commit
bfa28b960e
@ -270,6 +270,10 @@ const µBlock = { // jshint ignore:line
|
|||||||
uiAccentStylesheet: '',
|
uiAccentStylesheet: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
µBlock.isReadyPromise = new Promise(resolve => {
|
||||||
|
µBlock.isReadyResolve = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
µBlock.domainFromHostname = domainFromHostname;
|
µBlock.domainFromHostname = domainFromHostname;
|
||||||
µBlock.hostnameFromURI = hostnameFromURI;
|
µBlock.hostnameFromURI = hostnameFromURI;
|
||||||
|
|
||||||
|
@ -1565,7 +1565,9 @@ const onMessage = function(request, sender, callback) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
case 'getLists':
|
case 'getLists':
|
||||||
return getLists(callback);
|
return µb.isReadyPromise.then(( ) => {
|
||||||
|
getLists(callback);
|
||||||
|
});
|
||||||
|
|
||||||
case 'getLocalData':
|
case 'getLocalData':
|
||||||
return getLocalData().then(localData => {
|
return getLocalData().then(localData => {
|
||||||
|
@ -63,13 +63,6 @@ import {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
// Load all: executed once.
|
|
||||||
|
|
||||||
(async ( ) => {
|
|
||||||
// >>>>> start of private scope
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
vAPI.app.onShutdown = ( ) => {
|
vAPI.app.onShutdown = ( ) => {
|
||||||
staticFilteringReverseLookup.shutdown();
|
staticFilteringReverseLookup.shutdown();
|
||||||
io.updateStop();
|
io.updateStop();
|
||||||
@ -312,10 +305,10 @@ const onHiddenSettingsReady = async ( ) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maybe override default cache storage
|
// Maybe override default cache storage
|
||||||
const cacheBackend = await cacheStorage.select(
|
µb.supportStats.cacheBackend = await cacheStorage.select(
|
||||||
µb.hiddenSettings.cacheStorageAPI
|
µb.hiddenSettings.cacheStorageAPI
|
||||||
);
|
);
|
||||||
ubolog(`Backend storage for cache will be ${cacheBackend}`);
|
ubolog(`Backend storage for cache will be ${µb.supportStats.cacheBackend}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -379,6 +372,9 @@ const createDefaultProps = ( ) => {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
(async ( ) => {
|
||||||
|
// >>>>> start of async/await scope
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ubolog(`Start sequence of loading storage-based data ${Date.now()-vAPI.T0} ms after launch`);
|
ubolog(`Start sequence of loading storage-based data ${Date.now()-vAPI.T0} ms after launch`);
|
||||||
|
|
||||||
@ -506,5 +502,7 @@ if ( selfieIsValid ) {
|
|||||||
}
|
}
|
||||||
ubolog(`All ready ${µb.supportStats.allReadyAfter} after launch`);
|
ubolog(`All ready ${µb.supportStats.allReadyAfter} after launch`);
|
||||||
|
|
||||||
// <<<<< end of private scope
|
µb.isReadyResolve();
|
||||||
|
|
||||||
|
// <<<<< end of async/await scope
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user