Only allow string for setUA()

This commit is contained in:
Faisal Salman 2023-04-26 13:53:29 +07:00
parent 4c77c5ef21
commit a74ebeb82e

View File

@ -1147,7 +1147,8 @@
['getResult', createItemFunc(UA_RESULT)], ['getResult', createItemFunc(UA_RESULT)],
['getUA', function () { return userAgent; }], ['getUA', function () { return userAgent; }],
['setUA', function (ua) { ['setUA', function (ua) {
userAgent = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua; if (typeof ua === STR_TYPE)
userAgent = ua.length > UA_MAX_LENGTH ? trim(ua, UA_MAX_LENGTH) : ua;
return this; return this;
}] }]
]) ])