mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 11:22:38 +01:00
code reivew: do not cache assets fetched for viewing purpose
This commit is contained in:
parent
50800427b3
commit
96df129ddb
@ -29,7 +29,8 @@
|
||||
|
||||
var reIsExternalPath = /^(?:[a-z-]+):\/\//,
|
||||
reIsUserAsset = /^user-/,
|
||||
errorCantConnectTo = vAPI.i18n('errorCantConnectTo');
|
||||
errorCantConnectTo = vAPI.i18n('errorCantConnectTo'),
|
||||
noopfunc = function(){};
|
||||
|
||||
var api = {
|
||||
};
|
||||
@ -716,7 +717,14 @@ var saveUserAsset = function(assetKey, content, callback) {
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
api.get = function(assetKey, callback) {
|
||||
api.get = function(assetKey, options, callback) {
|
||||
if ( typeof options === 'function' ) {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else if ( typeof callback !== 'function' ) {
|
||||
callback = noopfunc;
|
||||
}
|
||||
|
||||
if ( assetKey === µBlock.userFiltersPath ) {
|
||||
readUserAsset(assetKey, callback);
|
||||
return;
|
||||
@ -755,7 +763,7 @@ api.get = function(assetKey, callback) {
|
||||
onContentNotLoaded();
|
||||
return;
|
||||
}
|
||||
if ( reIsExternalPath.test(contentURL) ) {
|
||||
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
|
||||
assetCacheWrite(assetKey, {
|
||||
content: this.responseText,
|
||||
url: contentURL
|
||||
|
@ -57,7 +57,7 @@ var onMessage = function(request, sender, callback) {
|
||||
switch ( request.what ) {
|
||||
case 'getAssetContent':
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/417
|
||||
µb.assets.get(request.url, callback);
|
||||
µb.assets.get(request.url, { dontCache: true }, callback);
|
||||
return;
|
||||
|
||||
case 'listsFromNetFilter':
|
||||
|
Loading…
Reference in New Issue
Block a user