work around bug in Iceweasel 3.0 that causes it to report its platform version as 1.9 instead of 1.9.0.x
authorMyk Melez <myk@mozilla.org>
Thu, 28 May 2009 14:12:33 -0700
changeset 972 05a40fcd85d68bf8eb4ad17a03e28444b86a9385
parent 971 ce6559554cf7ef6bcd01359a8415047905ba6fe9
child 973 ee6e4ab4c730b78729a0fe9b3497de0356891fda
push id607
push usermyk@mozilla.com
push dateThu, 28 May 2009 21:12:36 +0000
work around bug in Iceweasel 3.0 that causes it to report its platform version as 1.9 instead of 1.9.0.x
client/modules/JSON.js
--- a/client/modules/JSON.js
+++ b/client/modules/JSON.js
@@ -62,17 +62,21 @@ let EXPORTED_SYMBOLS = ["JSON"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
 
-if (appInfo.platformVersion.indexOf("1.9.0") == 0) {
+// Iceweasel 3.0 has a bug where it reports its platform version as 1.9 instead
+// of 1.9.0.n; we work around the bug by checking for 1.9 in addition to 1.9.0.n
+// and wrapping the JSON API in both cases.
+if (appInfo.platformVersion.indexOf("1.9.0") == 0 ||
+    appInfo.platformVersion == "1.9") {
   // Declare JSON with |var| so it'll be defined outside the enclosing
   // conditional block.
   var JSON = {
       JSON: null,
       parse: function(jsonString) { return this.JSON.fromString(jsonString) },
       stringify: function(jsObject) { return this.JSON.toString(jsObject) }
   }
   Cu.import("resource://gre/modules/JSON.jsm", JSON);