Bug 862232 - [OPEN_][SMS]when we send a message to a contact whose number contains 0, the 0 will be deleted. r=gwagner, a=tef+
authorjanjongboom@gmail.com
Thu, 18 Apr 2013 07:42:39 -0400
changeset 119123 7776629797f9433f3dd00747bff7ef65ad93723e
parent 119122 4bc5d0d8ff9ce9672c4b49349ea38450d6b43316
child 119124 cff28c0455ad0420a245aab3643ab4e0fc72dc79
push id685
push userryanvm@gmail.com
push dateThu, 18 Apr 2013 18:40:39 +0000
reviewersgwagner, tef
bugs862232
milestone18.0
Bug 862232 - [OPEN_][SMS]when we send a message to a contact whose number contains 0, the 0 will be deleted. r=gwagner, a=tef+
dom/phonenumberutils/PhoneNumber.jsm
dom/phonenumberutils/tests/test_phonenumber.xul
--- a/dom/phonenumberutils/PhoneNumber.jsm
+++ b/dom/phonenumberutils/PhoneNumber.jsm
@@ -23,19 +23,19 @@ this.PhoneNumber = (function (dataBase) 
   const SPLIT_FIRST_GROUP = /^(\d+)(.*)$/;
   const VALID_ALPHA_PATTERN = /[a-zA-Z]/g;
   const LEADING_PLUS_CHARS_PATTERN = /^[+\uFF0B]+/g;
 
   // Format of the string encoded meta data. If the name contains "^" or "$"
   // we will generate a regular expression from the value, with those special
   // characters as prefix/suffix.
   const META_DATA_ENCODING = ["region",
-                              "^internationalPrefix",
+                              "^(?:internationalPrefix)",
                               "nationalPrefix",
-                              "^nationalPrefixForParsing",
+                              "^(?:nationalPrefixForParsing)",
                               "nationalPrefixTransformRule",
                               "nationalPrefixFormattingRule",
                               "^possiblePattern$",
                               "^nationalPattern$",
                               "formats"];
 
   const FORMAT_ENCODING = ["^pattern$",
                            "nationalFormat",
--- a/dom/phonenumberutils/tests/test_phonenumber.xul
+++ b/dom/phonenumberutils/tests/test_phonenumber.xul
@@ -284,15 +284,18 @@ Format("0997654321", "CL", "997654321", 
 Format("997654321", "CL", "997654321", "CL", "(99) 765 4321", "+56 99 765 4321");
 
 // Colombian international number without the leading "+"
 Format("5712234567", "CO", "12234567", "CO", "(1) 2234567", "+57 1 2234567");
 
 // Dialing 911 in the US. This is not a national number.
 CantParse("911", "US");
 
+// China mobile number with a 0 in it
+Format("15955042864", "CN", "15955042864", "CN", "0159 5504 2864", "+86 159 5504 2864");
+
 // Test normalizing numbers. Only 0-9,#* are valid in a phone number.
 Normalize("+ABC # * , 9 _ 1 _0", "+222#*,910");
 Normalize("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "22233344455566677778889999");
 Normalize("abcdefghijklmnopqrstuvwxyz", "22233344455566677778889999");
 
 </script>
 </window>