Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 4453d52

Browse files
committed
Add detection for Chromium and fix inaccurate Ubuntu detection.
Closes #157.
1 parent c66b547 commit 4453d52

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

platform.js

+5
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@
391391
{ 'label': 'Opera Mini', 'pattern': 'OPiOS' },
392392
'Opera',
393393
{ 'label': 'Opera', 'pattern': 'OPR' },
394+
'Chromium',
394395
'Chrome',
395396
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
396397
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
@@ -972,6 +973,10 @@
972973
ua.indexOf('/' + data + '-') > -1) {
973974
os = trim(os.replace(data, ''));
974975
}
976+
// Ensure OS does not include the browser name.
977+
if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
978+
os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
979+
}
975980
// Add layout engine.
976981
if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
977982
/Browser|Lunascape|Maxthon/.test(name) ||

test/test.js

+8
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@
628628
'os': 'iOS 4.3+'
629629
},
630630

631+
'Chromium 66.0.3359.181 on Ubuntu 64-bit': {
632+
'ua': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36',
633+
'layout': 'Blink',
634+
'name': 'Chromium',
635+
'os': 'Ubuntu 64-bit',
636+
'version': '66.0.3359.181'
637+
},
638+
631639
'Electron 1.4.5 (Chromium 53.0.2785.113; Node 6.5.0) on Windows 10 64-bit': {
632640
'ua': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) electron-app/1.0.0 Chrome/53.0.2785.113 Electron/1.4.5 Safari/537.36',
633641
'global': {},

0 commit comments

Comments
 (0)