Closed Bug 953663 Opened 8 years ago Closed 8 years ago

Javascript error when "typing" notification is sent (but the conversation does not exist anymore)


(Instantbird :: Conversation, defect)

Not set


(Not tracked)



(Reporter: romain, Assigned: romain)



(1 file)

*** Original post on bio 217 at 2009-08-19 14:28:00 UTC ***

JavaScript strict warning: chrome://instantbird/content/conversation.xml, line 274: reference to undefined property conv._conv
JavaScript error: chrome://instantbird/content/conversation.xml, line 274: conv._conv is undefined

This is possible because the line in question is in a setTimeout, the check on _conv is done before the function declaration so that there is a delay in which this reference may be dropped.

Steps to reproduce:
1) Open a conversation
2) type in it, it sends notifications to your contact
3) while typing, press "ctrl + W" to close the tab.
4) See the error.

- a new test has to be done inside the timeout (instead of outside ?)
- give a name to the timeOut and clear it on initializing conversation.
Attached patch proposed patchSplinter Review
*** Original post on bio 217 as attmnt 205 at 2009-08-19 15:06:00 UTC ***

Null checker.

I tried with this._typingTimer = setTimeout(... and clearTimeout(... on destroy(), but it didn't work, I could reproduce the bug.

We could also put a try {...} catch(ex) {}, since the exception causes no harm, but I preferred to even trigger this exception.
Attachment #8351949 - Flags: review?(florian)
Assignee: nobody → romain
*** Original post on bio 217 at 2009-08-21 10:20:10 UTC ***

Comment on attachment 8351949 [details] [diff] [review] (bio-attmnt 205)
proposed patch

I'm ok with the code change here, but you should really add a comment explaining why you added this.
Something like "By the time the timeout is executed, the conversation may have been closed."

Not really related to this bug: one day we will want to move this code into a separate method so that we can call it from several places. Currently when something is pasted into the input box, typing notifications are not sent until we type a character.
Hmm... or maybe we should just use a different event? One that would indicate that the content of the textbox changed, rather than the fact that the user touched the keyboard while the textbox was focused...
Comment on attachment 8351949 [details] [diff] [review]
proposed patch

*** Original change on bio 217 attmnt 205 at 2009-08-21 21:38:06 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8351949 - Flags: review?(florian) → review+
*** Original post on bio 217 at 2009-08-21 21:40:50 UTC ***
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: 0.2 → 0.2b1
You need to log in before you can comment on or make changes to this bug.