this fixes bad sorting of hostnames on Pale Moon

This commit is contained in:
gorhill 2015-10-25 09:38:48 -04:00
parent da6c7b8b5e
commit ba20843e07
1 changed files with 7 additions and 2 deletions

View File

@ -181,11 +181,16 @@ var formatNumber = function(count) {
var rulekeyCompare = function(a, b) {
var ha = a.slice(2, a.indexOf(' ', 2));
if ( !reIP.test(ha) ) {
ha = hostnameToSortableTokenMap[ha] || '';
ha = hostnameToSortableTokenMap[ha] || ' ';
}
var hb = b.slice(2, b.indexOf(' ', 2));
if ( !reIP.test(hb) ) {
hb = hostnameToSortableTokenMap[hb] || '';
hb = hostnameToSortableTokenMap[hb] || ' ';
}
var ca = ha.charCodeAt(0),
cb = hb.charCodeAt(0);
if ( ca !== cb ) {
return ca - cb;
}
return ha.localeCompare(hb);
};