Reviewers: jlabanca,

Description:
Update getGeckoVersion() to support beta versions of Firefox.

Previously, gecko versions of the form 2.0b10 would cause the regex to
get mad because it is missing a second period. This change updates the
gecko version detector to support gecko versions such as 1.2.3, 1.2, and
2.0b10.


Please review this at http://gwt-code-reviews.appspot.com/1343803/show

Affected files:
  M user/src/com/google/gwt/dom/client/DOMImplMozilla.java


Index: user/src/com/google/gwt/dom/client/DOMImplMozilla.java
===================================================================
--- user/src/com/google/gwt/dom/client/DOMImplMozilla.java      (revision 9677)
+++ user/src/com/google/gwt/dom/client/DOMImplMozilla.java      (working copy)
@@ -19,12 +19,12 @@
  * Mozilla implementation of StandardBrowser.
  */
 class DOMImplMozilla extends DOMImplStandard {
-
+
   private static native int getGeckoVersion() /*-{
- var result = /rv:([0-9]+)\.([0-9]+)\.([0-9]+)?/.exec(navigator.userAgent.toLowerCase()); + var result = /rv:([0-9]+)\.([0-9]+)(\.([0-9]+))?.*?/.exec(navigator.userAgent.toLowerCase());
     if (result && result.length >= 3) {
- var version = (parseInt(result[1]) * 1000000) + (parseInt(result[2]) * 1000) +
-        parseInt(result.length == 4 ? result[3] : 0);
+ var version = (parseInt(result[1]) * 1000000) + (parseInt(result[2]) * 1000) +
+        parseInt(result.length >= 5 && !isNaN(result[4]) ? result[4] : 0);
       return version;
     }
     return -1; // not gecko
@@ -40,7 +40,7 @@
     int geckoVersion = getGeckoVersion();
     return (geckoVersion != -1) && (geckoVersion <= 1009000);
   }
-
+
   /**
    * Return true if using Gecko 1.9.1 (Firefox 3.5) or earlier.
    *


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to