Skip to content

Commit

Permalink
Fix Edge detection in ua-ch: "Microsoft Edge" -> "Edge"
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Jan 18, 2024
1 parent b5c62b0 commit 9c5d6ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/ua-parser.js
Expand Up @@ -1058,7 +1058,7 @@
var brands = uaCH[FULLVERLIST] || uaCH[BRANDS], prevName;
if (brands) {
for (var i in brands) {
var brandName = strip(GOOGLE+' ', brands[i].brand || brands[i]),
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)))) {
this.set(NAME, brandName)
Expand Down
6 changes: 3 additions & 3 deletions test/mocha-test.js
Expand Up @@ -547,15 +547,15 @@ describe('Map UA-CH headers', function () {
assert.strictEqual(uap.browser.version, "120.0.6099.132");

uap = UAParser(headers3d).withClientHints();
assert.strictEqual(uap.browser.name, "Microsoft Edge");
assert.strictEqual(uap.browser.name, "Edge");
assert.strictEqual(uap.browser.version, "120.0.6099.133");

uap = UAParser(headers3e).withClientHints();
assert.strictEqual(uap.browser.name, "Microsoft Edge");
assert.strictEqual(uap.browser.name, "Edge");
assert.strictEqual(uap.browser.version, "120.0.6099.133");

uap = UAParser(headers3f).withClientHints();
assert.strictEqual(uap.browser.name, "Microsoft Edge");
assert.strictEqual(uap.browser.name, "Edge");
assert.strictEqual(uap.browser.version, "120.0.6099.133");
});
});

0 comments on commit 9c5d6ee

Please sign in to comment.