Closed Bug 836215 Opened 12 years ago Closed 12 years ago

[B2G RIL] Validate the numbers that are passed to nsIDOMTelephony.dial()

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22
blocking-b2g tef+
Tracking Status
firefox20 --- wontfix
firefox21 --- wontfix
firefox22 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- fixed

People

(Reporter: ferjm, Assigned: vicamo)

References

Details

Attachments

(2 files, 4 obsolete files)

This is the Gecko counter part of bug 835750
Noming since this is part of bug 835750 which is TEF+ already
blocking-b2g: --- → tef?
Assignee: nobody → vyang
Blocks: 835750
blocking-b2g: tef? → tef+
Marking status-b2g18 and status-b2g18-v1.0.0 as affected, please update the status to fixed once this is verified landed on v1-train/mozilla-b2g18 and v1.0.0/mozilla-b2g18_v_1_0_0
Attachment #709006 - Flags: feedback?(gal)
Part 3 is marionette test cases. Waiting for feedback+.
Comment on attachment 709006 [details] [diff] [review] Part 1/3: add PhoneNumberUtils.isViablePhoneNumber Gregor is probably a better reviewer here.
Attachment #709006 - Flags: feedback?(gal) → feedback?(anygregor)
Comment on attachment 709006 [details] [diff] [review] Part 1/3: add PhoneNumberUtils.isViablePhoneNumber Review of attachment 709006 [details] [diff] [review]: ----------------------------------------------------------------- We usually patch https://github.com/andreasgal/PhoneNumber.js and merge it here. Please also add some plain PhoneNumberJS tests for the final version. We already have an IsViable function with the current country code? Why doesn't this work? ::: dom/phonenumberutils/PhoneNumber.jsm @@ +18,3 @@ > const NON_ALPHA_CHARS = /[^a-zA-Z]/g; > const NON_DIALABLE_CHARS = /[^,#+\*\d]/g; > + const PLUS_CHARS = "+\uFF0B"; You can also use PLUS_CHARS.source if you don't want to change this. Maybe add _SOURCE instead of _PATTERN if you want to define the regular string in the reminder of the patch? @@ +23,5 @@ > > + const VALID_PUNCTUATION = "-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \u00A0" > + + "\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D." > + + "\\[\\]/~\u2053\u223C\uFF5E"; > + const VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; Maybe add UNICODE_DIGITS.source? @@ +29,5 @@ > + const VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]*(?:[" + VALID_PUNCTUATION > + + "]*[" + VALID_DIGITS + "]){3,}[" > + + VALID_PUNCTUATION + VALID_ALPHA + VALID_DIGITS > + + "]*"; > + const RFC3966_EXTN_PREFIX = ";ext="; That's only used once. @@ +37,5 @@ > + + "(?:ext(?:ensi(?:o\u0301?|\u00F3))?n?|\uFF45\uFF58\uFF54\uFF4E?|" > + + "[,x\uFF58#\uFF03~\uFF5E]|int|anexo|\uFF49\uFF4E\uFF54)" > + + "[:\\.\uFF0E]?[ \u00A0\\t,-]*" > + + CAPTURING_EXTN_DIGITS + "#?|[- ]+([" > + + VALID_DIGITS + "]{1,5})#"; Any explanation what's going on here? @@ +385,5 @@ > > + function isViablePhoneNumber(number) { > + if (number == null || number.length < 3) { > + return false; > + } What about 2 digit numbers without punctuation? I think they are also valid.
(In reply to Gregor Wagner [:gwagner] from comment #7) > Please also add some plain PhoneNumberJS tests for the final > version. Sure, if this is a feedback+. > We already have an IsViable function with the current country > code? Why doesn't this work? If you mean |IsValidNumber(number, md)|, then it takes an additional parameter md, and we have to look up meta data array by some country code. Since we only loosely validate the number here, we don't need country code or per country possible patterns. > ::: dom/phonenumberutils/PhoneNumber.jsm > Any explanation what's going on here? I'll add some comments. > What about 2 digit numbers without punctuation? I think they > are also valid. "Most PBXs support variable-length dial plans that use 3 to 11 digits."[1] Do you have any known, working 2 digit numbers? [1]: http://en.wikipedia.org/wiki/Numbering_plan
Vicamo, why have a check in RadioInterfaceLayer.js and not in Gaia?
Comment on attachment 709006 [details] [diff] [review] Part 1/3: add PhoneNumberUtils.isViablePhoneNumber Yeah looks good to me.
Attachment #709006 - Flags: feedback?(anygregor) → feedback+
Can someone move this forward while Taipei is in holiday ?
No longer blocks: 836708
Andrew, please, could you assign someone on this ?
Flags: needinfo?(overholt)
Batch edit: Bugs marked status-b2g18: affected after 2/13 branching of v1.0.1 are now also status-b2g18-v1.0.1: affected
(In reply to Anshul from comment #9) > Vicamo, why have a check in RadioInterfaceLayer.js and not in > Gaia? Isn't this the purpose of this bug?
(In reply to Gregor Wagner [:gwagner] from comment #7) > Comment on attachment 709006 [details] [diff] [review] > ::: dom/phonenumberutils/PhoneNumber.jsm > @@ +18,3 @@ > > const NON_ALPHA_CHARS = /[^a-zA-Z]/g; > > const NON_DIALABLE_CHARS = /[^,#+\*\d]/g; > > + const PLUS_CHARS = "+\uFF0B"; > > You can also use PLUS_CHARS.source if you don't want to change > this. Maybe add _SOURCE instead of _PATTERN if you want to > define the regular string in the reminder of the patch? PLUS_CHARS.source is "^[+\uFF0B]+", but in other places I want only "+\uFF0B" or at most "[+\uFF0B]". VALID_ALPHA and VALID_DIGITS both have the same situation.
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #14) > (In reply to Anshul from comment #9) > > Vicamo, why have a check in RadioInterfaceLayer.js and not in > > Gaia? > > Isn't this the purpose of this bug? Yep, it is. Even if the check is done on Gaia also this is something that belongs to the platform.
Attached patch Part 1/2 (obsolete) — Splinter Review
Attachment #709006 - Attachment is obsolete: true
Attachment #714314 - Flags: review?(anygregor)
Attached patch Part 2/2 (obsolete) — Splinter Review
Attachment #709007 - Attachment is obsolete: true
Attachment #714315 - Flags: review?(anygregor)
Flags: needinfo?(overholt)
Attachment #714314 - Flags: review?(anygregor) → review+
Comment on attachment 714315 [details] [diff] [review] Part 2/2 Review of attachment 714315 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/system/gonk/RadioInterfaceLayer.js @@ +1985,5 @@ > + this.handleCallError({ > + callIndex: -1, > + error: RIL.RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[RIL.CALL_FAIL_UNOBTAINABLE_NUMBER] > + }); > + return; Maybe add a dump here that prints if isViablePhoneNumber returns false? We might event want to see this in a non debug build. Or do we have any gaia feedback here?
Attachment #714315 - Flags: review?(anygregor) → review+
Is this now ready to land?
Attached patch Part 1/2: v2Splinter Review
fix marionette test failures.
Attachment #714314 - Attachment is obsolete: true
Attachment #715905 - Flags: review+
Attached patch Part 2/2: v2Splinter Review
Add debug message for non-viable phone number passed.
Attachment #714315 - Attachment is obsolete: true
Attachment #715906 - Flags: review+
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Blocks: 845539
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: