mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 873511 - Correctly parse 'tel:' links that contain whitespaces. r=fabrice
This commit is contained in:
parent
d60bbc5058
commit
0f836c538b
@ -12,7 +12,7 @@ this.EXPORTED_SYMBOLS = ["TelURIParser"];
|
||||
this.TelURIParser = {
|
||||
parseURI: function(scheme, uri) {
|
||||
// https://www.ietf.org/rfc/rfc2806.txt
|
||||
let subscriber = uri.slice((scheme + ':').length);
|
||||
let subscriber = decodeURIComponent(uri.slice((scheme + ':').length));
|
||||
|
||||
if (!subscriber.length) {
|
||||
return null;
|
||||
@ -23,7 +23,7 @@ this.TelURIParser = {
|
||||
let len = subscriber.length;
|
||||
|
||||
// visual-separator
|
||||
let visualSeparator = [ '-', '.', '(', ')' ];
|
||||
let visualSeparator = [ ' ', '-', '.', '(', ')' ];
|
||||
let digits = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ];
|
||||
let dtmfDigits = [ '*', '#', 'A', 'B', 'C', 'D' ];
|
||||
let pauseCharacter = [ 'p', 'w' ];
|
||||
|
@ -5,7 +5,10 @@ function run_test() {
|
||||
Components.utils.import("resource:///modules/TelURIParser.jsm")
|
||||
|
||||
// global-phone-number
|
||||
do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234'), '+1234');
|
||||
do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234'), '+1234');
|
||||
|
||||
// global-phone-number => white space separator
|
||||
do_check_eq(TelURIParser.parseURI('tel', 'tel:+123 456 789'), '+123 456 789');
|
||||
|
||||
// global-phone-number => ignored chars
|
||||
do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234_123'), '+1234');
|
||||
|
Loading…
Reference in New Issue
Block a user