Avoid re-assigning asset cache registry at launch

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1365
This commit is contained in:
Raymond Hill 2020-11-28 08:28:20 -05:00
parent c959fd6cd9
commit ab5ab8575c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 15 additions and 1 deletions

View File

@ -477,7 +477,21 @@ const getAssetCacheRegistry = function() {
bin instanceof Object &&
bin.assetCacheRegistry instanceof Object
) {
assetCacheRegistry = bin.assetCacheRegistry;
if ( Object.keys(assetCacheRegistry).length === 0 ) {
assetCacheRegistry = bin.assetCacheRegistry;
} else {
console.error(
'getAssetCacheRegistry(): assetCacheRegistry reassigned!'
);
if (
Object.keys(bin.assetCacheRegistry).sort().join() !==
Object.keys(assetCacheRegistry).sort().join()
) {
console.error(
'getAssetCacheRegistry(): assetCacheRegistry changes overwritten!'
);
}
}
}
return assetCacheRegistry;
});