Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
changed my mind
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Sep 4, 2014
1 parent 8dc8540 commit e8eb452
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions js/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,17 +382,26 @@ var readLocalFile = function(path, callback) {
reportBack('', 'Error');
};

var onCachedContentReady = function(details) {
//console.log('µBlock> readLocalFile("%s") / onCachedContentReady()', path);
var onCachedContentLoaded = function(details) {
//console.log('µBlock> readLocalFile("%s") / onCachedContentLoaded()', path);
reportBack(details.content);
};

var onCachedContentError = function(details) {
//console.error('µBlock> readLocalFile("%s") / onCachedContentError()', path);
if ( reIsExternalPath.test(path) ) {
reportBack('', 'Error: asset not found');
return;
}
// It's ok for user data to be empty
if ( !details.error && (details.content !== '' || reIsUserPath.test(path)) ) {
reportBack(details.content);
if ( reIsUserPath.test(path) ) {
reportBack('');
return;
}
getTextFileFromURL(chrome.runtime.getURL(details.path), onInstallFileLoaded, onInstallFileError);
};

cachedAssetsManager.load(path, onCachedContentReady);
cachedAssetsManager.load(path, onCachedContentLoaded, onCachedContentError);
};

// https://www.youtube.com/watch?v=r9KVpuFPtHc
Expand Down

0 comments on commit e8eb452

Please sign in to comment.