This commit is contained in:
gorhill 2016-02-17 09:28:20 -05:00
parent 6e6e9fd10e
commit 0adae9fb65
2 changed files with 11 additions and 7 deletions

View File

@ -1123,7 +1123,7 @@ var backupUserData = function(callback) {
µb.extractSelectedFilterLists(onSelectedListsReady);
};
µb.assets.get('assets/user/filters.txt', onUserFiltersReady);
µb.assets.get(µb.userFiltersPath, onUserFiltersReady);
};
/******************************************************************************/
@ -1153,7 +1153,7 @@ var restoreUserData = function(request) {
µb.keyvalSetOne('urlFilteringString', userData.urlFilteringString || '', onCountdown);
µb.keyvalSetOne('hostnameSwitchesString', userData.hostnameSwitchesString || '', onCountdown);
µb.assets.put('assets/user/filters.txt', userData.userFilters, onCountdown);
µb.assets.put(µb.userFiltersPath, userData.userFilters, onCountdown);
vAPI.storage.set({
lastRestoreFile: request.file || '',
lastRestoreTime: Date.now(),

View File

@ -181,7 +181,7 @@
var cfe = µb.cosmeticFilteringEngine;
var acceptedCount = snfe.acceptedCount + cfe.acceptedCount;
var duplicateCount = snfe.duplicateCount + cfe.duplicateCount;
µb.applyCompiledFilters(compiledFilters);
µb.applyCompiledFilters(compiledFilters, true);
var entry = µb.remoteBlacklists[µb.userFiltersPath];
var deltaEntryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount;
var deltaEntryUsedCount = deltaEntryCount - (snfe.duplicateCount + cfe.duplicateCount - duplicateCount);
@ -418,7 +418,7 @@
var cfe = µb.cosmeticFilteringEngine;
var acceptedCount = snfe.acceptedCount + cfe.acceptedCount;
var duplicateCount = snfe.duplicateCount + cfe.duplicateCount;
µb.applyCompiledFilters(compiled);
µb.applyCompiledFilters(compiled, path === µb.userFiltersPath);
if ( µb.remoteBlacklists.hasOwnProperty(path) ) {
var entry = µb.remoteBlacklists[path];
entry.entryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount;
@ -627,8 +627,12 @@
/******************************************************************************/
µBlock.applyCompiledFilters = function(rawText) {
var skipCosmetic = !this.userSettings.parseAllABPHideFilters;
// https://github.com/gorhill/uBlock/issues/1395
// Added `firstparty` argument: to avoid discarding cosmetic filtering when
// applying 1st-party filters.
µBlock.applyCompiledFilters = function(rawText, firstparty) {
var skipCosmetic = !firstparty && !this.userSettings.parseAllABPHideFilters;
var staticNetFilteringEngine = this.staticNetFilteringEngine;
var cosmeticFilteringEngine = this.cosmeticFilteringEngine;
var lineBeg = 0;
@ -864,7 +868,7 @@
}
if ( typeof data.userFilters === 'string' ) {
µb.assets.put('assets/user/filters.txt', data.userFilters);
µb.assets.put(µb.userFiltersPath, data.userFilters);
}
callback();