Add contact with invalid username silently fails

ASSIGNED
Assigned to

Status

Instantbird
Contacts window
ASSIGNED
3 years ago
3 years ago

People

(Reporter: arlolra, Assigned: arlolra)

Tracking

trunk

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
Created attachment 8624541 [details] [diff] [review]
error.patch

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36

Steps to reproduce:

Tried to add a contact but forgot an @ in xmpp


Actual results:

Nothing


Expected results:

Invalid username warning
(Assignee)

Updated

3 years ago
Attachment #8624541 - Attachment is patch: true
Attachment #8624541 - Attachment mime type: text/x-patch → text/plain
Attachment #8624541 - Flags: review?(clokep)
(In reply to arlolra from comment #0)
> Steps to reproduce:
> 
> Tried to add a contact but forgot an @ in xmpp

Can you please expand these STR to be a list of steps? I'm not really sure what you did and what occurred.
Comment on attachment 8624541 [details] [diff] [review]
error.patch

Review of attachment 8624541 [details] [diff] [review]:
-----------------------------------------------------------------

::: im/content/addbuddy.js
@@ +60,5 @@
> +      account.addBuddy(tag, name);
> +      return true;
> +    } catch(e) {
> +      if (/Invalid username/.test(e.message)) {
> +        error.textContent = "Invalid username";

This would need to be a translated string.

What is the test for "Invalid username" for? I suspect that's a message that only exists in the XMPP code. I.e. that won't pass review.
Attachment #8624541 - Flags: review?(clokep) → review-
(Assignee)

Comment 3

3 years ago
1) connect to an xmpp account
2) File > Add Contact
3) choose the above xmpp account
4) type a username but omit the @ (ie. thisismyfriend)
5) click "Ok"

Observe the silent fail. The Error Console reports the "Invalid username" was thrown.

Comment 4

3 years ago
(In reply to arlolra from comment #3)
> 1) connect to an xmpp account
> 2) File > Add Contact
> 3) choose the above xmpp account
> 4) type a username but omit the @ (ie. thisismyfriend)
> 5) click "Ok"
> 
> Observe the silent fail. The Error Console reports the "Invalid username"
> was thrown.

If you change the throw in XMPP to throw an Error object, you can test for the type of the error more robustly than checking the string.
Duplicate of this bug: 953821
Assignee: nobody → arlolra
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.