diff options
author | Artur Signell <artur@vaadin.com> | 2016-02-03 10:59:46 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-05-22 10:24:02 +0300 |
commit | 25e824aea4c0cf65dbea784446ec2b7a521b7a08 (patch) | |
tree | 3aa8d790498140b7aec70919f7f092a7e2bd75e4 /shared | |
parent | 9b048703e112eb213e4c604428603bde92bd40ae (diff) | |
download | vaadin-framework-25e824aea4c0cf65dbea784446ec2b7a521b7a08.tar.gz vaadin-framework-25e824aea4c0cf65dbea784446ec2b7a521b7a08.zip |
Correctly detect PhantomJS 2.1
Change-Id: I9b1df949b831b84aa05bf611b0128eb2414bbbae
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/VBrowserDetails.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java index a7426d2022..32299a22d1 100644 --- a/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/main/java/com/vaadin/shared/VBrowserDetails.java @@ -86,9 +86,10 @@ public class VBrowserDetails implements Serializable { // IE 11 no longer contains MSIE in the user agent isIE = isIE || isTrident; - isSafari = !isChrome && !isIE && userAgent.indexOf("safari") != -1; - isFirefox = userAgent.indexOf(" firefox/") != -1; isPhantomJS = userAgent.indexOf("phantomjs/") != -1; + isSafari = !isChrome && !isIE && !isPhantomJS + && userAgent.indexOf("safari") != -1; + isFirefox = userAgent.indexOf(" firefox/") != -1; if (userAgent.indexOf(" edge/") != -1) { isEdge = true; isChrome = false; @@ -98,6 +99,7 @@ public class VBrowserDetails implements Serializable { isFirefox = false; isWebKit = false; isGecko = false; + isPhantomJS = false; } // chromeframe @@ -174,6 +176,10 @@ public class VBrowserDetails implements Serializable { } else if (isEdge) { int i = userAgent.indexOf(" edge/") + 6; parseVersionString(safeSubstring(userAgent, i, i + 8)); + } else if (isPhantomJS) { + String prefix = " phantomjs/"; + int i = userAgent.indexOf(prefix) + prefix.length(); + parseVersionString(safeSubstring(userAgent, i, i + 5)); } } catch (Exception e) { // Browser version parsing failed |