From b938022d0bc27ab8c48b7eecc10cbbfa31f31147 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 27 Mar 2015 09:50:31 -0400 Subject: [PATCH] this fixes #1102 --- src/js/assets.js | 13 +++++++++++++ src/js/messaging.js | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/js/assets.js b/src/js/assets.js index 79a05c380..e368d1f55 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -271,6 +271,10 @@ var cachedAssetsManager = (function() { getEntries(onEntries); }; + exports.rmrf = function() { + exports.remove(/./); + }; + exports.onRemovedListener = null; return exports; @@ -468,6 +472,9 @@ var getRepoMetadata = function(callback) { /******************************************************************************/ exports.setHomeURL = function(path, homeURL) { + if ( typeof homeURL !== 'string' || homeURL === '' ) { + return; + } homeURLs[path] = homeURL; }; @@ -1029,6 +1036,12 @@ exports.put = function(path, content, callback) { /******************************************************************************/ +exports.rmrf = function() { + cachedAssetsManager.rmrf(); +}; + +/******************************************************************************/ + exports.metadata = function(callback) { var out = {}; diff --git a/src/js/messaging.js b/src/js/messaging.js index e2349b749..313ac9a07 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -1058,6 +1058,10 @@ var restoreUserData = function(request) { }, onCountdown); }; + // https://github.com/gorhill/uBlock/issues/1102 + // Ensure all currently cached assets are flushed from storage AND memory. + µb.assets.rmrf(); + // If we are going to restore all, might as well wipe out clean local // storage µb.XAL.keyvalRemoveAll(onAllRemoved);