Update engine.version to be the same as browser.version for Chromium-based browser when UA-CH is available

This commit is contained in:
Faisal Salman
2024-11-28 12:53:48 +07:00
parent 20e195de8b
commit aa56b2f4f3
2 changed files with 9 additions and 4 deletions

View File

@@ -85,6 +85,7 @@
PREFIX_MOBILE = 'Mobile ',
SUFFIX_BROWSER = ' Browser',
CHROME = 'Chrome',
CHROMIUM = 'Chromium',
CHROMECAST = 'Chromecast',
EDGE = 'Edge',
FIREFOX = 'Firefox',
@@ -1161,17 +1162,21 @@
switch (this.itemType) {
case UA_BROWSER:
case UA_ENGINE:
var brands = uaCH[FULLVERLIST] || uaCH[BRANDS], prevName;
if (brands) {
for (var i in brands) {
var brandName = strip(/(Google|Microsoft) /, brands[i].brand || brands[i]),
brandVersion = brands[i].version;
if (!/not.a.brand/i.test(brandName) && (!prevName || (/chrom/i.test(prevName) && !/chromi/i.test(brandName)))) {
if (this.itemType == UA_BROWSER && !/not.a.brand/i.test(brandName) && (!prevName || (/chrom/i.test(prevName) && brandName != CHROMIUM))) {
this.set(NAME, brandName)
.set(VERSION, brandVersion)
.set(MAJOR, majorize(brandVersion));
prevName = brandName;
}
if (this.itemType == UA_ENGINE && brandName == CHROMIUM) {
this.set(VERSION, brandVersion);
}
}
}
break;