1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-06 19:02:30 +01:00

tentatively fix issue reported in #2612 re. FFox 24.8.1

This commit is contained in:
gorhill 2017-05-19 10:12:55 -04:00
parent a222e23e49
commit fcf43d972e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
8 changed files with 66 additions and 138 deletions

View File

@ -1629,19 +1629,13 @@ FilterContainer.prototype._reEscapeScriptArg = /[\\'"]/g;
FilterContainer.prototype.toSelfie = function() {
var selfieFromMap = function(map) {
var selfie = [],
entry, bucket, ff, f,
iterator = map.entries();
for (;;) {
entry = iterator.next();
if ( entry.done ) {
break;
}
selfie.push('k\t' + entry.value[0]);
bucket = entry.value[1];
bucket, ff, f;
// Note: destructuring assignment not supported before Chromium 49.
for ( var entry of map ) {
selfie.push('k\t' + entry[0]);
bucket = entry[1];
selfie.push(bucket.fid + '\t' + bucket.toSelfie());
if ( bucket.fid !== '[]' ) {
continue;
}
if ( bucket.fid !== '[]' ) { continue; }
ff = bucket.filters;
for ( var j = 0, nj = ff.length; j < nj; j++ ) {
f = ff[j];

View File

@ -208,17 +208,11 @@ var getHostnameDict = function(hostnameToCountMap) {
domainEntry,
domainFromHostname = µb.URI.domainFromHostname,
domain, blockCount, allowCount,
iter = hostnameToCountMap.entries(),
entry, hostname, counts;
for (;;) {
entry = iter.next();
if ( entry.done ) {
break;
}
hostname = entry.value[0];
if ( r[hostname] !== undefined ) {
continue;
}
hostname, counts;
// Note: destructuring assignment not supported before Chromium 49.
for ( var entry of hostnameToCountMap ) {
hostname = entry[0];
if ( r[hostname] !== undefined ) { continue; }
domain = domainFromHostname(hostname) || hostname;
counts = hostnameToCountMap.get(domain) || 0;
blockCount = counts & 0xFFFF;
@ -234,14 +228,12 @@ var getHostnameDict = function(hostnameToCountMap) {
} else {
domainEntry = r[domain];
}
counts = entry.value[1];
counts = entry[1];
blockCount = counts & 0xFFFF;
allowCount = counts >>> 16 & 0xFFFF;
domainEntry.totalBlockCount += blockCount;
domainEntry.totalAllowCount += allowCount;
if ( hostname === domain ) {
continue;
}
if ( hostname === domain ) { continue; }
r[hostname] = {
domain: domain,
blockCount: blockCount,

View File

@ -322,13 +322,10 @@ RedirectEngine.prototype.toSelfie = function() {
// convert it to a serializable format. The serialized format must be
// suitable to be used as an argument to the Map() constructor.
var rules = [],
iter = this.rules.entries(),
item, rule, entries, i, entry;
for (;;) {
item = iter.next();
if ( item.done ) { break; }
rule = [ item.value[0], [] ];
entries = item.value[1];
rule, entries, i, entry;
for ( var item of this.rules ) {
rule = [ item[0], [] ];
entries = item[1];
i = entries.length;
while ( i-- ) {
entry = entries[i];

View File

@ -1875,39 +1875,26 @@ FilterContainer.prototype.freeze = function() {
FilterContainer.prototype.toSelfie = function() {
var categoryToSelfie = function(map) {
var selfie = [],
iterator = map.entries(),
entry;
for (;;) {
entry = iterator.next();
if ( entry.done === true ) { break; }
selfie.push('k2\t' + exportInt(entry.value[0])); // token hash
selfie.push(entry.value[1].compile());
var selfie = [];
for ( var entry of map ) {
selfie.push('k2\t' + exportInt(entry[0])); // token hash
selfie.push(entry[1].compile());
}
return selfie.join('\n');
};
var categoriesToSelfie = function(map) {
var selfie = [],
iterator = map.entries(),
entry;
for (;;) {
entry = iterator.next();
if ( entry.done === true ) { break; }
selfie.push('k1\t' + exportInt(entry.value[0])); // category bits
selfie.push(categoryToSelfie(entry.value[1]));
var selfie = [];
for ( var entry of map ) {
selfie.push('k1\t' + exportInt(entry[0])); // category bits
selfie.push(categoryToSelfie(entry[1]));
}
return selfie.join('\n');
};
var dataFiltersToSelfie = function(dataFilters) {
var selfie = [],
iter = dataFilters.entries(),
entry;
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
entry = entry.value[1];
var selfie = [];
for ( var entry of dataFilters.values() ) {
do {
selfie.push(entry.compile());
entry = entry.next;
@ -2344,56 +2331,39 @@ FilterContainer.prototype.matchAndFetchData = function(dataType, requestURL, out
if ( toAddImportant.size === 0 && toAdd.size === 0 ) { return; }
// Remove entries overriden by other filters.
var iter = toAddImportant.entries(),
k;
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
k = entry.value[0];
toAdd.delete(k);
toRemove.delete(k);
var key;
for ( key of toAddImportant.keys() ) {
toAdd.delete(key);
toRemove.delete(key);
}
iter = toRemove.entries();
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
k = entry.value[0];
if ( k === '' ) {
for ( key of toRemove.keys() ) {
if ( key === '' ) {
toAdd.clear();
break;
}
toAdd.delete(k);
toAdd.delete(key);
}
var logData;
iter = toAddImportant.entries();
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
out.push(entry.value[0]);
for ( entry of toAddImportant ) {
out.push(entry[0]);
if ( outlog === undefined ) { continue; }
logData = entry.value[1].logData();
logData = entry[1].logData();
logData.source = 'static';
logData.result = 1;
outlog.push(logData);
}
iter = toAdd.entries();
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
out.push(entry.value[0]);
for ( entry of toAdd ) {
out.push(entry[0]);
if ( outlog === undefined ) { continue; }
logData = entry.value[1].logData();
logData = entry[1].logData();
logData.source = 'static';
logData.result = 1;
outlog.push(logData);
}
if ( outlog !== undefined ) {
iter = toRemove.entries();
for (;;) {
entry = iter.next();
if ( entry.done === true ) { break; }
logData = entry.value[1].logData();
for ( entry of toRemove.values()) {
logData = entry.logData();
logData.source = 'static';
logData.result = 2;
outlog.push(logData);

View File

@ -333,15 +333,12 @@
return url;
};
var importedSet = new Set(this.listKeysFromCustomFilterLists(externalLists)),
toImportSet = new Set(this.listKeysFromCustomFilterLists(details.toImport)),
iter = toImportSet.values();
for (;;) {
var entry = iter.next();
if ( entry.done ) { break; }
if ( importedSet.has(entry.value) ) { continue; }
assetKey = assetKeyFromURL(entry.value);
if ( assetKey === entry.value ) {
importedSet.add(entry.value);
toImportSet = new Set(this.listKeysFromCustomFilterLists(details.toImport));
for ( var urlKey of toImportSet ) {
if ( importedSet.has(urlKey) ) { continue; }
assetKey = assetKeyFromURL(urlKey);
if ( assetKey === urlKey ) {
importedSet.add(urlKey);
}
selectedListKeySet.add(assetKey);
}

View File

@ -48,12 +48,8 @@ if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
var suspendedTabs = new Set();
µBlock.onStartCompletedQueue.push(function(callback) {
onBeforeReady = null;
var iter = suspendedTabs.values(),
entry;
for (;;) {
entry = iter.next();
if ( entry.done ) { break; }
vAPI.tabs.reload(entry.value);
for ( var tabId of suspendedTabs ) {
vAPI.tabs.reload(tabId);
}
callback();
});

View File

@ -142,23 +142,16 @@ URLNetFiltering.prototype.reset = function() {
URLNetFiltering.prototype.assign = function(other) {
var thisRules = this.rules,
otherRules = other.rules,
iter, item;
otherRules = other.rules;
// Remove rules not in other
iter = thisRules.entries();
for (;;) {
item = iter.next();
if ( item.done ) { break; }
if ( otherRules.has(item.value) === false ) {
thisRules.delete(item.value);
for ( var key of thisRules.keys() ) {
if ( otherRules.has(key) === false ) {
thisRules.delete(key);
}
}
// Add/change rules in other
iter = otherRules.entries();
for (;;) {
item = iter.next();
if ( item.done ) { break; }
thisRules.set(item.value[0], item.value[1].slice());
for ( var entry of otherRules ) {
thisRules.set(entry[0], entry[1].slice());
}
};
@ -310,17 +303,14 @@ URLNetFiltering.prototype.copyRules = function(other, context, urls, type) {
URLNetFiltering.prototype.toString = function() {
var out = [],
iter = this.rules.entries(),
item, key, pos, hn, type, entries, i, entry;
for (;;) {
item = iter.next();
if ( item.done ) { break; }
key = item.value[0];
key, pos, hn, type, entries, i, entry;
for ( var item of this.rules ) {
key = item[0];
pos = key.indexOf(' ');
hn = key.slice(0, pos);
pos = key.lastIndexOf(' ');
type = key.slice(pos + 1);
entries = item.value[1];
entries = item[1];
for ( i = 0; i < entries.length; i++ ) {
entry = entries[i];
out.push(

View File

@ -276,13 +276,9 @@
µBlock.mapToArray = typeof Array.from === 'function'
? Array.from
: function(map) {
var out = [],
entries = map.entries(),
entry;
for (;;) {
entry = entries.next();
if ( entry.done ) { break; }
out.push([ entry.value[0], entry.value[1] ]);
var out = [];
for ( var entry of map ) {
out.push(entry);
}
return out;
};
@ -294,13 +290,9 @@
µBlock.setToArray = typeof Array.from === 'function'
? Array.from
: function(dict) {
var out = [],
entries = dict.values(),
entry;
for (;;) {
entry = entries.next();
if ( entry.done ) { break; }
out.push(entry.value);
var out = [];
for ( var value of dict ) {
out.push(value);
}
return out;
};