Skip to content

Commit f726dcd

Browse files
committed
Merge branch 'master' into develop
2 parents 383ca58 + f95aced commit f726dcd

9 files changed

+31
-12
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ua-parser-js",
3-
"version": "0.7.26",
3+
"version": "0.7.27",
44
"authors": [
55
"Faisal Salman <f@faisalman.com>"
66
],

dist/ua-parser.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ua-parser.pack.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package.describe({
22
name: 'faisalman:ua-parser-js',
3-
version: '0.7.26',
3+
version: '0.7.27',
44
summary: 'Lightweight JavaScript-based user-agent string parser',
55
git: 'https://github.com/faisalman/ua-parser-js.git',
66
documentation: 'readme.md'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "UAParser.js",
33
"name": "ua-parser-js",
4-
"version": "0.7.26",
4+
"version": "0.7.27",
55
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
66
"description": "Lightweight JavaScript-based user-agent string parser",
77
"keywords": [

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ console, mobile, tablet, smarttv, wearable, embedded
6262

6363
# Possible 'device.vendor':
6464
Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
65-
Essential, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu,
66-
Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
65+
Essential, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG,
66+
Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
6767
Palm, Panasonic, Pebble, Polytron, Realme, RIM, Samsung, Sharp, Siemens,
6868
Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
6969

src/ua-parser.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!@license
2-
* UAParser.js v0.7.26
2+
* UAParser.js v0.7.27
33
* Lightweight JavaScript-based User-Agent string parser
44
* https://github.com/faisalman/ua-parser-js
55
*
@@ -16,7 +16,7 @@
1616
/////////////
1717

1818

19-
var LIBVERSION = '0.7.26',
19+
var LIBVERSION = '0.7.27',
2020
EMPTY = '',
2121
UNKNOWN = '?',
2222
FUNC_TYPE = 'function',
@@ -541,6 +541,8 @@
541541

542542
/\s(surface\sduo)\s/i // Surface Duo
543543
], [MODEL, [VENDOR, 'Microsoft'], [TYPE, TABLET]], [
544+
/droid\s[\d\.]+;\s(fp\du?)\sbuild/i
545+
], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
544546
/\s(u304aa)\sbuild/i // AT&T
545547
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
546548
/sie-(\w*)/i // Siemens
@@ -814,7 +816,7 @@
814816
return _ua;
815817
};
816818
this.setUA = function (ua) {
817-
_ua = ua.length > UA_MAX_LENGTH ? util.trim(ua, UA_MAX_LENGTH) : ua;
819+
_ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? util.trim(ua, UA_MAX_LENGTH) : ua;
818820
return this;
819821
};
820822
this.setUA(_ua);

test/device-test.json

+9
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@
196196
"type": "mobile"
197197
}
198198
},
199+
{
200+
"desc": "Fairphone 1U",
201+
"ua": "Mozilla/5.0 (Linux; U; Android 4.2.2; FP1U Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
202+
"expect": {
203+
"vendor": "Fairphone",
204+
"model": "FP1U",
205+
"type": "mobile"
206+
}
207+
},
199208
{
200209
"desc": "HTC Desire 820",
201210
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; HTC Desire 820 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36",

test/test.js

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ describe('UAParser()', function () {
4646
assert.deepStrictEqual(UAParser(ua), new UAParser().setUA(ua).getResult());
4747
});
4848

49+
describe('UAParser() constructor does not throw with undefined ua argument', function () {
50+
assert.doesNotThrow(() => new UAParser(undefined).getResult());
51+
});
52+
53+
describe('UAParser.setUA method does not throw with undefined ua argument', function () {
54+
assert.doesNotThrow(() => new UAParser().setUA(undefined).getResult());
55+
});
56+
4957
for (var i in methods) {
5058
describe(methods[i]['title'], function () {
5159
for (var j in methods[i]['list']) {

0 commit comments

Comments
 (0)