diff options
author | Sergey Budkin <sergey@vaadin.com> | 2014-11-07 15:22:24 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-11 08:59:52 +0000 |
commit | 862a2f74d9f137560fe62a33a5b23e4dd31aeeae (patch) | |
tree | 1c686e238362a57919d2aaba302fed373740dc6f | |
parent | 5eaf32a1404399f7b39f3b60060ed3d101ec08f8 (diff) | |
download | vaadin-framework-862a2f74d9f137560fe62a33a5b23e4dd31aeeae.tar.gz vaadin-framework-862a2f74d9f137560fe62a33a5b23e4dd31aeeae.zip |
VBrowserDetails fails to detect Android when using Firefox (#15183)
Changed detection logic.
Change-Id: I9cb8e94fe6bb5be587fa73ed6a71d2c7c1d91733
-rw-r--r-- | client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java | 10 | ||||
-rw-r--r-- | shared/src/com/vaadin/shared/VBrowserDetails.java | 11 |
2 files changed, 14 insertions, 7 deletions
diff --git a/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java b/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java index 6cd0630137..cb70fc7a39 100644 --- a/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java +++ b/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java @@ -10,6 +10,7 @@ public class TestVBrowserDetailsUserAgentParser extends TestCase { private static final String FIREFOX30_WINDOWS = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6"; private static final String FIREFOX30_LINUX = "Mozilla/5.0 (X11; U; Linux x86_64; es-ES; rv:1.9.0.12) Gecko/2009070811 Ubuntu/9.04 (jaunty) Firefox/3.0.12"; + private static final String FIREFOX33_ANDROID = "Mozilla/5.0 (Android; Tablet; rv:33.0) Gecko/33.0 Firefox/33.0"; private static final String FIREFOX35_WINDOWS = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729) FirePHP/0.4"; private static final String FIREFOX36_WINDOWS = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"; private static final String FIREFOX36B_MAC = "UAString mozilla/5.0 (macintosh; u; intel mac os x 10.6; en-us; rv:1.9.2) gecko/20100115 firefox/3.6"; @@ -209,6 +210,15 @@ public class TestVBrowserDetailsUserAgentParser extends TestCase { assertLinux(bd); } + public void testFirefox33Android() { + VBrowserDetails bd = new VBrowserDetails(FIREFOX33_ANDROID); + assertGecko(bd); + assertFirefox(bd); + assertBrowserMajorVersion(bd, 33); + assertBrowserMinorVersion(bd, 0); + assertAndroid(bd, -1, -1); + } + public void testFirefox35() { VBrowserDetails bd = new VBrowserDetails(FIREFOX35_WINDOWS); assertGecko(bd); diff --git a/shared/src/com/vaadin/shared/VBrowserDetails.java b/shared/src/com/vaadin/shared/VBrowserDetails.java index fa21bddc96..6e45d33e16 100644 --- a/shared/src/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/com/vaadin/shared/VBrowserDetails.java @@ -167,14 +167,11 @@ public class VBrowserDetails implements Serializable { if (userAgent.contains("windows ")) { os = OperatingSystem.WINDOWS; isWindowsPhone = userAgent.contains("windows phone"); + } else if (userAgent.contains("android")) { + os = OperatingSystem.ANDROID; + parseAndroidVersion(userAgent); } else if (userAgent.contains("linux")) { - if (userAgent.contains("android")) { - os = OperatingSystem.ANDROID; - parseAndroidVersion(userAgent); - } else { - os = OperatingSystem.LINUX; - - } + os = OperatingSystem.LINUX; } else if (userAgent.contains("macintosh") || userAgent.contains("mac osx") || userAgent.contains("mac os x")) { |