1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

need to access repo metadata through proper entry point

This commit is contained in:
gorhill 2014-08-24 21:37:05 -04:00
parent 9b40ec937f
commit 6e08a3bf18

View File

@ -284,7 +284,7 @@ var getRepoMetadata = function(callback) {
if ( checksumsChanged ) {
updateLocalChecksums();
}
// Fetch and store homeURL associations
// Notify all waiting callers
while ( callback = repoMetadata.waiting.pop() ) {
callback(repoMetadata);
}
@ -342,6 +342,19 @@ var getRepoMetadata = function(callback) {
/******************************************************************************/
exports.setHomeURL = function(path, homeURL) {
var onRepoMetadataReady = function(metadata) {
var entry = metadata.entries[path];
if ( entry === undefined ) {
entry = metadata.entries[path] = new AssetEntry();
}
entry.homeURL = homeURL;
}
getRepoMetadata(onRepoMetadataReady);
};
/******************************************************************************/
// Get a local asset, do not look-up repo or remote location if local asset
// is not found.
@ -905,16 +918,6 @@ exports.metadata = function(callback) {
/******************************************************************************/
exports.setHomeURL = function(path, homeURL) {
var entry = repoMetadata[path];
if ( entry === undefined ) {
entry = repoMetadata[path] = new AssetEntry();
}
entry.homeURL = homeURL;
};
/******************************************************************************/
exports.purge = function(pattern, before) {
cachedAssetsManager.remove(pattern, before);
};