From 3918b9d59a11dce50127157ab7d0fa6f0e3c8f77 Mon Sep 17 00:00:00 2001 From: Gregor Wagner Date: Thu, 4 Apr 2013 17:40:04 -0700 Subject: [PATCH] Bug 858339 - PhoneNumberJS: Fix colombian phone numbers without the leading +. r=bent --- dom/phonenumberutils/PhoneNumber.jsm | 10 +++++----- dom/phonenumberutils/tests/test_phonenumber.xul | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dom/phonenumberutils/PhoneNumber.jsm b/dom/phonenumberutils/PhoneNumber.jsm index 71d1e8dd36de..f1a574cc6aeb 100644 --- a/dom/phonenumberutils/PhoneNumber.jsm +++ b/dom/phonenumberutils/PhoneNumber.jsm @@ -363,17 +363,17 @@ this.PhoneNumber = (function (dataBase) { 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. ret = ParseInternationalNumber(number) 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); + // We couldn't parse the number at all. return null; } diff --git a/dom/phonenumberutils/tests/test_phonenumber.xul b/dom/phonenumberutils/tests/test_phonenumber.xul index 7cccf50acbce..f089826eb0c0 100644 --- a/dom/phonenumberutils/tests/test_phonenumber.xul +++ b/dom/phonenumberutils/tests/test_phonenumber.xul @@ -283,6 +283,9 @@ Format("0997654321", "CL", "997654321", "CL", "(99) 765 4321", "+56 99 765 4321" // Chile mobile number from another mobile number 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");