diff options
author | gorhill <rhill@raymondhill.net> | 2014-09-03 20:55:16 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2014-09-03 20:55:16 -0400 |
commit | e8eb452f735c31e598aae96da963290f8343ac39 (patch) | |
tree | 0f2839994867e753d4b5e343ad5850ac838fd97b | |
parent | 8dc85407e6552f77aa8cc57341482a5772c78660 (diff) | |
download | uBlock-e8eb452f735c31e598aae96da963290f8343ac39.zip uBlock-e8eb452f735c31e598aae96da963290f8343ac39.tar.gz uBlock-e8eb452f735c31e598aae96da963290f8343ac39.tar.bz2 |
changed my mind
-rw-r--r-- | js/assets.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/js/assets.js b/js/assets.js index bd2f86b..8e25d27 100644 --- a/js/assets.js +++ b/js/assets.js @@ -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 |