Bug 821417 - PhoneNumberJS: fix startup warnings. r=bent
authorGregor Wagner <anygregor@gmail.com>
Thu, 13 Dec 2012 12:00:22 -0800
changeset 125070 2a929d0c52336c26aea86b5830faaf214076208b
parent 125069 02a0cad51a22927947bd89c35a2adca5b6bf839b
child 125072 4cc6db74ba94ad273bb44ad4488b585a0c69e1d9
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs821417
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 821417 - PhoneNumberJS: fix startup warnings. r=bent
dom/phonenumberutils/PhoneNumber.jsm
--- a/dom/phonenumberutils/PhoneNumber.jsm
+++ b/dom/phonenumberutils/PhoneNumber.jsm
@@ -265,17 +265,18 @@ this.PhoneNumber = (function (dataBase) 
 
     // Lookup the meta data for the region (or regions) and if the rest of
     // the number parses for that region, return the parsed number.
     var entry = dataBase[countryCode];
     if (Array.isArray(entry)) {
       for (var n = 0; n < entry.length; ++n) {
         if (typeof entry[n] == "string")
           entry[n] = ParseMetaData(countryCode, entry[n]);
-        if (ret = ParseNationalNumber(number, entry[n]))
+        ret = ParseNationalNumber(number, entry[n])
+        if (ret)
           return ret;
       }
       return null;
     }
     if (typeof entry == "string")
       entry = dataBase[countryCode] = ParseMetaData(countryCode, entry);
     return ParseNationalNumber(number, entry);
   }
@@ -307,49 +308,53 @@ this.PhoneNumber = (function (dataBase) 
     // Lookup the meta data for the given region.
     var md = FindMetaDataForRegion(defaultRegion.toUpperCase());
 
     // See if the number starts with an international prefix, and if the
     // number resulting from stripping the code is valid, then remove the
     // prefix and flag the number as international.
     if (md.internationalPrefix.test(number)) {
       var possibleNumber = number.replace(md.internationalPrefix, "");
-      if (ret = ParseInternationalNumber(possibleNumber))
+      ret = ParseInternationalNumber(possibleNumber)
+      if (ret)
         return ret;
     }
 
     // This is not an international number. See if its a national one for
     // the current region. National numbers can start with the national
     // prefix, or without.
     if (md.nationalPrefixForParsing) {
       // Some regions have specific national prefix parse rules. Apply those.
       var withoutPrefix = number.replace(md.nationalPrefixForParsing,
                                          md.nationalPrefixTransformRule);
-      if (ret = ParseNationalNumber(withoutPrefix, md))
+      ret = ParseNationalNumber(withoutPrefix, md)
+      if (ret)
         return ret;
     } else {
       // If there is no specific national prefix rule, just strip off the
       // national prefix from the beginning of the number (if there is one).
       var nationalPrefix = md.nationalPrefix;
       if (nationalPrefix && number.indexOf(nationalPrefix) == 0 &&
           (ret = ParseNationalNumber(number.substr(nationalPrefix.length), md))) {
         return ret;
       }
     }
-    if (ret = ParseNationalNumber(number, md))
+    ret = ParseNationalNumber(number, md)
+    if (ret)
       return ret;
 
     // If the number matches the possible numbers of the current region,
     // return it as a possible number.
     if (md.possiblePattern.test(number))
       return new NationalNumber(md, number);
 
     // Now lets see if maybe its an international number after all, but
     // without '+' or the international prefix.
-    if (ret = ParseInternationalNumber(number))
+    ret = ParseInternationalNumber(number)
+    if (ret)
       return ret;
 
     // We couldn't parse the number at all.
     return null;
   }
 
   return {
     Parse: ParseNumber,