mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 761069: B2G MMS: support email addressing model, r=philikon
This commit is contained in:
parent
2d4d4c363f
commit
ccc3866d3c
@ -92,8 +92,13 @@ let Address = {
|
||||
type = "num";
|
||||
} else if (str.match(/^\w+$/)) {
|
||||
type = "alphanum";
|
||||
} else if (str.indexOf("@") > 0) {
|
||||
// E-mail should match the definition of `mailbox` as described in section
|
||||
// 3.4 of RFC2822, but excluding the obsolete definitions as indicated by
|
||||
// the "obs-" prefix. Here we match only a `@` character.
|
||||
type = "email";
|
||||
} else {
|
||||
type = "unknown";
|
||||
throw new WSP.CodeError("Address: invalid address");
|
||||
}
|
||||
|
||||
return {address: str, type: type};
|
||||
|
@ -71,9 +71,12 @@ add_test(function test_Address_decode() {
|
||||
// Test for alphanum-shortcode
|
||||
wsp_decode_test(MMS.Address, strToCharCodeArray("H0wD0Y0uTurnTh1s0n"),
|
||||
{address: "H0wD0Y0uTurnTh1s0n", type: "alphanum"});
|
||||
// Test for other unknown typed sequence
|
||||
// Test for email address
|
||||
wsp_decode_test(MMS.Address, strToCharCodeArray("Joe User <joe@user.org>"),
|
||||
{address: "Joe User <joe@user.org>", type: "unknown"});
|
||||
{address: "Joe User <joe@user.org>", type: "email"});
|
||||
// Test for invalid address
|
||||
wsp_decode_test(MMS.Address, strToCharCodeArray("@@@@@"),
|
||||
null, "CodeError");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user