1636: unterminated string literal JS error prevents loading diff lines corresponding to comments containing newlines

lon***@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
May 6, 2010
What version are you running?
1.5 beta 1 (but also observed on the demo site, 1.5 beta 2)

What's the URL of the page containing the problem?
http://demo.reviewboard.org/r/50/diff/#index_header

What steps will reproduce the problem?
1.in the diff view, add comment that contains newline characters
(multi<enter>line<enter>comment for instance)
2.save the comment, click on "Edit Review"
3.the comment is correctly displayed, but not the context diffs.  It's
spinning forever.

Firefox reports: GET
http://demo.reviewboard.org/r/50/reviews/draft/inline-form/
GET http://demo.reviewboard.org/r/50/reviews/draft/inline-form/
	
200 OK
		231ms	
jquery....min.js (line 19)
unterminated string literal
[Break on this error] "multi\n

Google Chrome reports some ILLEGAL error

What is the expected output? What do you see instead?

Inline diffs are not shown.  The spinner spins forever.


What operating system are you using? What browser?

Windows.  Firefox, Google Chrome

Please provide any additional information below.

I'll submit a review, but the diffs are simple, thanks to Django:

diff --git a/reviewboard/templates/reviews/review_draft_inline_form.html
b/reviewboard/templates/reviews/review_draft_inline_form.h
index 06f9259..5452d80 100644
--- a/reviewboard/templates/reviews/review_draft_inline_form.html
+++ b/reviewboard/templates/reviews/review_draft_inline_form.html
@@ -98,7 +98,7 @@
                 null,
 {% endif %}
                 {{comment.first_line}}, {{comment.last_line}},
-                "{{comment.text}}"));
+                "{{comment.text|escapejs}}"));
         $("#edit-diff-comment-{{comment.id}}").click(function() {
             editor.inlineEditor("startEdit");
         });
chipx86
#1 chipx86
Committed to master (046ba74)
  • +Fixed
  • -Priority-Medium
    +Priority-Critical
    +Milestone-Release1.5
    +Component-Reviews
  • +chipx86