Adding comments to a bug shows [Object object] instead of comment

Bug #541993 reported by Barry Warsaw
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Deryck Hodge

Bug Description

I want to comment on a bug, so I enter some text in the text box and click on Post Comment. I get a little spinner for a while and then my comment disappears, only to be replaced by

[object Object]

instead of my comment. This is repeatable; happens every time. My comment has been posted though, because a page reload shows the comment (and not the garbage).

FF 3.6 on Lucid

Related branches

Revision history for this message
Eleanor Berger (intellectronica) wrote :

I can't reproduce this on staging with FF 3.6 on Lucid.

Barry, which bug are you trying to comment on?

summary: - Adding comments to an issue shows nonsense instead of comment
+ Adding comments to a bug shows nonsense instead of comment
Deryck Hodge (deryck)
Changed in malone:
status: New → Incomplete
Revision history for this message
Barry Warsaw (barry) wrote : Re: Adding comments to a bug shows nonsense instead of comment

Tom, Deryck. It happens to me on *every* bug :(

Could it be some weird interaction with plugins such as NoScript (though I allow everything bug google-analytics)

Changed in malone:
status: Incomplete → New
Revision history for this message
Barry Warsaw (barry) wrote :

Allowing all JS on the page to see if that fixes the problem...

Revision history for this message
Barry Warsaw (barry) wrote :

Nope.

Revision history for this message
Barry Warsaw (barry) wrote :

Restarted FF with all add-ons except Ubuntu Modifications disabled. Let's see what happens now...

Revision history for this message
Barry Warsaw (barry) wrote :

Okay, that worked. I wonder which plugin is causing the problem...

Revision history for this message
Barry Warsaw (barry) wrote :

All enabled except for NoScript and Firebug...

Revision history for this message
Barry Warsaw (barry) wrote :

Happy!

Revision history for this message
Barry Warsaw (barry) wrote :

Firebug re-enabled.

Revision history for this message
Barry Warsaw (barry) wrote :

Not happy! :(

Revision history for this message
Barry Warsaw (barry) wrote :

Firebug disabled but NoScript enabled...

Revision history for this message
Barry Warsaw (barry) wrote :

So the problem definitely seems to be caused by Firebug 1.5.3 which appears to be the latest release. Can you reproduce it with Firebug enabled?

Revision history for this message
Deryck Hodge (deryck) wrote :

I can reproduce this. With Firebug enabled for LP, I get [Object object] comments. Firebug can be enabled for other sites, but not for LP, and I don't have this issue.

Changed in malone:
status: New → Triaged
importance: Undecided → Low
tags: added: javascript
summary: - Adding comments to a bug shows nonsense instead of comment
+ Adding comments to a bug shows [Object object] instead of comment
Revision history for this message
Tim Penhey (thumper) wrote :

I have this too. Commenting on code reviews renders fine, but bugs always give me [object Object]

Revision history for this message
Deryck Hodge (deryck) wrote :

I spent a lot of time this weekend trying to further debug this and a couple hours chatting with people yesterday trying to understand my findings. I'm raising the importance of this because it's not just Firebug related, and I suspect whatever is causing this may be causing other non-obvious issues with posting comments to bugs.

To confirm it's not just firebug:

I can also reproduce this on my mobile phone, a Samsung Vibrant, a Galaxy S phone running Android. The browser is some flavor of Chrome, but the phone only lists it as "Web version 7". When posting comments to staging via that browser, I get [object Object] and sometimes the comment itself is not actually posted. So 3 in 5 tries via the phone will show the comment on reloading the page and 2 tries will show no comment was added.

My suspicions:

The LP.client JavaScript object is firing a success event before the post to Bug.newMessage has finished saving the comment. I do not think this is timeout related because it's 100% reproducible locally with the dev server.

Clearly Firebug plays some part in making this reproducible, but I'm not sure how.

The interactions look like this:

comment_js.post_comment -->
    lp_client.named_post (Bug.newMessage) -->
        on success --> get_comment_html

comment_js.get_comment_html -->
    lp_client.get (BugComment) -->
        on_success --> insert_comment_html

comment_js.insert_comment_html -->
    The first argument to the callback here is
    `message_html` which is sometimes the
    lp_client object rather than the xhtml string,
    which results in the "[object Object]" DOM update

If I put a `debugger;` statement in get_comment_html and wait a beat or two (presumably allowing the first named_post to finish its work), the comment will be returned properly to insert_comment_html and the DOM will be updated correctly.

I've poked at YUI and LP.client, and I cannot work out why success is firing before it should, if indeed that is what's happening. I'm documenting this here and raising the priority, and then I'll cast about for someone to help me debug this further.

Changed in malone:
importance: Low → High
tags: added: comment-handling ui
Revision history for this message
Deryck Hodge (deryck) wrote :

Many thanks to Maris for helping me debug this. Bad caching of XHR is at play, which is why the code version of comment posting doesn't suffer this problem. They construct a new URL by appending +fragment to get the resource fresh. I'm working up a patch now.

Changed in malone:
status: Triaged → In Progress
assignee: nobody → Deryck Hodge (deryck)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in malone:
milestone: none → 10.10
tags: added: qa-needstesting
Changed in malone:
status: In Progress → Fix Committed
Deryck Hodge (deryck)
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui)
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.