Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#113 (browser) - Properly detect new Edge Chromium version as Edge instead of Chrome #115

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/browser/DeviceProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ function getBrowserInfo (getModel) {
var returnVal = '';
var offset;

if ((offset = userAgent.indexOf('Edge')) !== -1) {
returnVal = (getModel) ? 'Edge' : userAgent.substring(offset + 5);
if ((offset = userAgent.indexOf('Edg')) !== -1) {
if (getModel) {
returnVal = 'Edge';
} else {
if ((offset = userAgent.indexOf('Edge')) !== -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work, as the offset might be set to -1 again and line 47 would return userAgent.substring(-1 + 4);

returnVal = userAgent.substring(offset + 5);
} else {
returnVal = userAgent.substring(offset + 4);
}
}
} else if ((offset = userAgent.indexOf('Chrome')) !== -1) {
returnVal = (getModel) ? 'Chrome' : userAgent.substring(offset + 7);
} else if ((offset = userAgent.indexOf('Safari')) !== -1) {
Expand Down