mirror of https://github.com/gorhill/uBlock.git
tentatively fix issue reported in #2612 re. FFox 24.8.1
This commit is contained in:
parent
a222e23e49
commit
fcf43d972e
|
@ -1629,19 +1629,13 @@ FilterContainer.prototype._reEscapeScriptArg = /[\\'"]/g;
|
||||||
FilterContainer.prototype.toSelfie = function() {
|
FilterContainer.prototype.toSelfie = function() {
|
||||||
var selfieFromMap = function(map) {
|
var selfieFromMap = function(map) {
|
||||||
var selfie = [],
|
var selfie = [],
|
||||||
entry, bucket, ff, f,
|
bucket, ff, f;
|
||||||
iterator = map.entries();
|
// Note: destructuring assignment not supported before Chromium 49.
|
||||||
for (;;) {
|
for ( var entry of map ) {
|
||||||
entry = iterator.next();
|
selfie.push('k\t' + entry[0]);
|
||||||
if ( entry.done ) {
|
bucket = entry[1];
|
||||||
break;
|
|
||||||
}
|
|
||||||
selfie.push('k\t' + entry.value[0]);
|
|
||||||
bucket = entry.value[1];
|
|
||||||
selfie.push(bucket.fid + '\t' + bucket.toSelfie());
|
selfie.push(bucket.fid + '\t' + bucket.toSelfie());
|
||||||
if ( bucket.fid !== '[]' ) {
|
if ( bucket.fid !== '[]' ) { continue; }
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ff = bucket.filters;
|
ff = bucket.filters;
|
||||||
for ( var j = 0, nj = ff.length; j < nj; j++ ) {
|
for ( var j = 0, nj = ff.length; j < nj; j++ ) {
|
||||||
f = ff[j];
|
f = ff[j];
|
||||||
|
|
|
@ -208,17 +208,11 @@ var getHostnameDict = function(hostnameToCountMap) {
|
||||||
domainEntry,
|
domainEntry,
|
||||||
domainFromHostname = µb.URI.domainFromHostname,
|
domainFromHostname = µb.URI.domainFromHostname,
|
||||||
domain, blockCount, allowCount,
|
domain, blockCount, allowCount,
|
||||||
iter = hostnameToCountMap.entries(),
|
hostname, counts;
|
||||||
entry, hostname, counts;
|
// Note: destructuring assignment not supported before Chromium 49.
|
||||||
for (;;) {
|
for ( var entry of hostnameToCountMap ) {
|
||||||
entry = iter.next();
|
hostname = entry[0];
|
||||||
if ( entry.done ) {
|
if ( r[hostname] !== undefined ) { continue; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
hostname = entry.value[0];
|
|
||||||
if ( r[hostname] !== undefined ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
domain = domainFromHostname(hostname) || hostname;
|
domain = domainFromHostname(hostname) || hostname;
|
||||||
counts = hostnameToCountMap.get(domain) || 0;
|
counts = hostnameToCountMap.get(domain) || 0;
|
||||||
blockCount = counts & 0xFFFF;
|
blockCount = counts & 0xFFFF;
|
||||||
|
@ -234,14 +228,12 @@ var getHostnameDict = function(hostnameToCountMap) {
|
||||||
} else {
|
} else {
|
||||||
domainEntry = r[domain];
|
domainEntry = r[domain];
|
||||||
}
|
}
|
||||||
counts = entry.value[1];
|
counts = entry[1];
|
||||||
blockCount = counts & 0xFFFF;
|
blockCount = counts & 0xFFFF;
|
||||||
allowCount = counts >>> 16 & 0xFFFF;
|
allowCount = counts >>> 16 & 0xFFFF;
|
||||||
domainEntry.totalBlockCount += blockCount;
|
domainEntry.totalBlockCount += blockCount;
|
||||||
domainEntry.totalAllowCount += allowCount;
|
domainEntry.totalAllowCount += allowCount;
|
||||||
if ( hostname === domain ) {
|
if ( hostname === domain ) { continue; }
|
||||||
continue;
|
|
||||||
}
|
|
||||||
r[hostname] = {
|
r[hostname] = {
|
||||||
domain: domain,
|
domain: domain,
|
||||||
blockCount: blockCount,
|
blockCount: blockCount,
|
||||||
|
|
|
@ -322,13 +322,10 @@ RedirectEngine.prototype.toSelfie = function() {
|
||||||
// convert it to a serializable format. The serialized format must be
|
// convert it to a serializable format. The serialized format must be
|
||||||
// suitable to be used as an argument to the Map() constructor.
|
// suitable to be used as an argument to the Map() constructor.
|
||||||
var rules = [],
|
var rules = [],
|
||||||
iter = this.rules.entries(),
|
rule, entries, i, entry;
|
||||||
item, rule, entries, i, entry;
|
for ( var item of this.rules ) {
|
||||||
for (;;) {
|
rule = [ item[0], [] ];
|
||||||
item = iter.next();
|
entries = item[1];
|
||||||
if ( item.done ) { break; }
|
|
||||||
rule = [ item.value[0], [] ];
|
|
||||||
entries = item.value[1];
|
|
||||||
i = entries.length;
|
i = entries.length;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
entry = entries[i];
|
entry = entries[i];
|
||||||
|
|
|
@ -1875,39 +1875,26 @@ FilterContainer.prototype.freeze = function() {
|
||||||
|
|
||||||
FilterContainer.prototype.toSelfie = function() {
|
FilterContainer.prototype.toSelfie = function() {
|
||||||
var categoryToSelfie = function(map) {
|
var categoryToSelfie = function(map) {
|
||||||
var selfie = [],
|
var selfie = [];
|
||||||
iterator = map.entries(),
|
for ( var entry of map ) {
|
||||||
entry;
|
selfie.push('k2\t' + exportInt(entry[0])); // token hash
|
||||||
for (;;) {
|
selfie.push(entry[1].compile());
|
||||||
entry = iterator.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
selfie.push('k2\t' + exportInt(entry.value[0])); // token hash
|
|
||||||
selfie.push(entry.value[1].compile());
|
|
||||||
}
|
}
|
||||||
return selfie.join('\n');
|
return selfie.join('\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
var categoriesToSelfie = function(map) {
|
var categoriesToSelfie = function(map) {
|
||||||
var selfie = [],
|
var selfie = [];
|
||||||
iterator = map.entries(),
|
for ( var entry of map ) {
|
||||||
entry;
|
selfie.push('k1\t' + exportInt(entry[0])); // category bits
|
||||||
for (;;) {
|
selfie.push(categoryToSelfie(entry[1]));
|
||||||
entry = iterator.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
selfie.push('k1\t' + exportInt(entry.value[0])); // category bits
|
|
||||||
selfie.push(categoryToSelfie(entry.value[1]));
|
|
||||||
}
|
}
|
||||||
return selfie.join('\n');
|
return selfie.join('\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
var dataFiltersToSelfie = function(dataFilters) {
|
var dataFiltersToSelfie = function(dataFilters) {
|
||||||
var selfie = [],
|
var selfie = [];
|
||||||
iter = dataFilters.entries(),
|
for ( var entry of dataFilters.values() ) {
|
||||||
entry;
|
|
||||||
for (;;) {
|
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
entry = entry.value[1];
|
|
||||||
do {
|
do {
|
||||||
selfie.push(entry.compile());
|
selfie.push(entry.compile());
|
||||||
entry = entry.next;
|
entry = entry.next;
|
||||||
|
@ -2344,56 +2331,39 @@ FilterContainer.prototype.matchAndFetchData = function(dataType, requestURL, out
|
||||||
if ( toAddImportant.size === 0 && toAdd.size === 0 ) { return; }
|
if ( toAddImportant.size === 0 && toAdd.size === 0 ) { return; }
|
||||||
|
|
||||||
// Remove entries overriden by other filters.
|
// Remove entries overriden by other filters.
|
||||||
var iter = toAddImportant.entries(),
|
var key;
|
||||||
k;
|
for ( key of toAddImportant.keys() ) {
|
||||||
for (;;) {
|
toAdd.delete(key);
|
||||||
entry = iter.next();
|
toRemove.delete(key);
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
k = entry.value[0];
|
|
||||||
toAdd.delete(k);
|
|
||||||
toRemove.delete(k);
|
|
||||||
}
|
}
|
||||||
iter = toRemove.entries();
|
for ( key of toRemove.keys() ) {
|
||||||
for (;;) {
|
if ( key === '' ) {
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
k = entry.value[0];
|
|
||||||
if ( k === '' ) {
|
|
||||||
toAdd.clear();
|
toAdd.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toAdd.delete(k);
|
toAdd.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
var logData;
|
var logData;
|
||||||
iter = toAddImportant.entries();
|
for ( entry of toAddImportant ) {
|
||||||
for (;;) {
|
out.push(entry[0]);
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
out.push(entry.value[0]);
|
|
||||||
if ( outlog === undefined ) { continue; }
|
if ( outlog === undefined ) { continue; }
|
||||||
logData = entry.value[1].logData();
|
logData = entry[1].logData();
|
||||||
logData.source = 'static';
|
logData.source = 'static';
|
||||||
logData.result = 1;
|
logData.result = 1;
|
||||||
outlog.push(logData);
|
outlog.push(logData);
|
||||||
}
|
}
|
||||||
iter = toAdd.entries();
|
for ( entry of toAdd ) {
|
||||||
for (;;) {
|
out.push(entry[0]);
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
out.push(entry.value[0]);
|
|
||||||
if ( outlog === undefined ) { continue; }
|
if ( outlog === undefined ) { continue; }
|
||||||
logData = entry.value[1].logData();
|
logData = entry[1].logData();
|
||||||
logData.source = 'static';
|
logData.source = 'static';
|
||||||
logData.result = 1;
|
logData.result = 1;
|
||||||
outlog.push(logData);
|
outlog.push(logData);
|
||||||
}
|
}
|
||||||
if ( outlog !== undefined ) {
|
if ( outlog !== undefined ) {
|
||||||
iter = toRemove.entries();
|
for ( entry of toRemove.values()) {
|
||||||
for (;;) {
|
logData = entry.logData();
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done === true ) { break; }
|
|
||||||
logData = entry.value[1].logData();
|
|
||||||
logData.source = 'static';
|
logData.source = 'static';
|
||||||
logData.result = 2;
|
logData.result = 2;
|
||||||
outlog.push(logData);
|
outlog.push(logData);
|
||||||
|
|
|
@ -333,15 +333,12 @@
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
var importedSet = new Set(this.listKeysFromCustomFilterLists(externalLists)),
|
var importedSet = new Set(this.listKeysFromCustomFilterLists(externalLists)),
|
||||||
toImportSet = new Set(this.listKeysFromCustomFilterLists(details.toImport)),
|
toImportSet = new Set(this.listKeysFromCustomFilterLists(details.toImport));
|
||||||
iter = toImportSet.values();
|
for ( var urlKey of toImportSet ) {
|
||||||
for (;;) {
|
if ( importedSet.has(urlKey) ) { continue; }
|
||||||
var entry = iter.next();
|
assetKey = assetKeyFromURL(urlKey);
|
||||||
if ( entry.done ) { break; }
|
if ( assetKey === urlKey ) {
|
||||||
if ( importedSet.has(entry.value) ) { continue; }
|
importedSet.add(urlKey);
|
||||||
assetKey = assetKeyFromURL(entry.value);
|
|
||||||
if ( assetKey === entry.value ) {
|
|
||||||
importedSet.add(entry.value);
|
|
||||||
}
|
}
|
||||||
selectedListKeySet.add(assetKey);
|
selectedListKeySet.add(assetKey);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,8 @@ if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
|
||||||
var suspendedTabs = new Set();
|
var suspendedTabs = new Set();
|
||||||
µBlock.onStartCompletedQueue.push(function(callback) {
|
µBlock.onStartCompletedQueue.push(function(callback) {
|
||||||
onBeforeReady = null;
|
onBeforeReady = null;
|
||||||
var iter = suspendedTabs.values(),
|
for ( var tabId of suspendedTabs ) {
|
||||||
entry;
|
vAPI.tabs.reload(tabId);
|
||||||
for (;;) {
|
|
||||||
entry = iter.next();
|
|
||||||
if ( entry.done ) { break; }
|
|
||||||
vAPI.tabs.reload(entry.value);
|
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
|
@ -142,23 +142,16 @@ URLNetFiltering.prototype.reset = function() {
|
||||||
|
|
||||||
URLNetFiltering.prototype.assign = function(other) {
|
URLNetFiltering.prototype.assign = function(other) {
|
||||||
var thisRules = this.rules,
|
var thisRules = this.rules,
|
||||||
otherRules = other.rules,
|
otherRules = other.rules;
|
||||||
iter, item;
|
|
||||||
// Remove rules not in other
|
// Remove rules not in other
|
||||||
iter = thisRules.entries();
|
for ( var key of thisRules.keys() ) {
|
||||||
for (;;) {
|
if ( otherRules.has(key) === false ) {
|
||||||
item = iter.next();
|
thisRules.delete(key);
|
||||||
if ( item.done ) { break; }
|
|
||||||
if ( otherRules.has(item.value) === false ) {
|
|
||||||
thisRules.delete(item.value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add/change rules in other
|
// Add/change rules in other
|
||||||
iter = otherRules.entries();
|
for ( var entry of otherRules ) {
|
||||||
for (;;) {
|
thisRules.set(entry[0], entry[1].slice());
|
||||||
item = iter.next();
|
|
||||||
if ( item.done ) { break; }
|
|
||||||
thisRules.set(item.value[0], item.value[1].slice());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -310,17 +303,14 @@ URLNetFiltering.prototype.copyRules = function(other, context, urls, type) {
|
||||||
|
|
||||||
URLNetFiltering.prototype.toString = function() {
|
URLNetFiltering.prototype.toString = function() {
|
||||||
var out = [],
|
var out = [],
|
||||||
iter = this.rules.entries(),
|
key, pos, hn, type, entries, i, entry;
|
||||||
item, key, pos, hn, type, entries, i, entry;
|
for ( var item of this.rules ) {
|
||||||
for (;;) {
|
key = item[0];
|
||||||
item = iter.next();
|
|
||||||
if ( item.done ) { break; }
|
|
||||||
key = item.value[0];
|
|
||||||
pos = key.indexOf(' ');
|
pos = key.indexOf(' ');
|
||||||
hn = key.slice(0, pos);
|
hn = key.slice(0, pos);
|
||||||
pos = key.lastIndexOf(' ');
|
pos = key.lastIndexOf(' ');
|
||||||
type = key.slice(pos + 1);
|
type = key.slice(pos + 1);
|
||||||
entries = item.value[1];
|
entries = item[1];
|
||||||
for ( i = 0; i < entries.length; i++ ) {
|
for ( i = 0; i < entries.length; i++ ) {
|
||||||
entry = entries[i];
|
entry = entries[i];
|
||||||
out.push(
|
out.push(
|
||||||
|
|
|
@ -276,13 +276,9 @@
|
||||||
µBlock.mapToArray = typeof Array.from === 'function'
|
µBlock.mapToArray = typeof Array.from === 'function'
|
||||||
? Array.from
|
? Array.from
|
||||||
: function(map) {
|
: function(map) {
|
||||||
var out = [],
|
var out = [];
|
||||||
entries = map.entries(),
|
for ( var entry of map ) {
|
||||||
entry;
|
out.push(entry);
|
||||||
for (;;) {
|
|
||||||
entry = entries.next();
|
|
||||||
if ( entry.done ) { break; }
|
|
||||||
out.push([ entry.value[0], entry.value[1] ]);
|
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
@ -294,13 +290,9 @@
|
||||||
µBlock.setToArray = typeof Array.from === 'function'
|
µBlock.setToArray = typeof Array.from === 'function'
|
||||||
? Array.from
|
? Array.from
|
||||||
: function(dict) {
|
: function(dict) {
|
||||||
var out = [],
|
var out = [];
|
||||||
entries = dict.values(),
|
for ( var value of dict ) {
|
||||||
entry;
|
out.push(value);
|
||||||
for (;;) {
|
|
||||||
entry = entries.next();
|
|
||||||
if ( entry.done ) { break; }
|
|
||||||
out.push(entry.value);
|
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue