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

Review Request #1572 — Created May 3, 2010 and submitted

Information

Review Board

Reviewers

The issue was in:

    <script type="text/javascript"> 
        var editor = $("#diff-comment-61").reviewFormCommentEditor(
            new RB.DiffComment(
                {
                    'id': 377,
                    'revision': 2
                },
 
                null,
 
                72, 72,
                "multi\x0Aline\x0Acomment"));
        $("#edit-diff-comment-61").click(function() {
            editor.inlineEditor("startEdit");
        });
 
        queueLoadDiffFragment("review_draft_diff_comments", "61",
 
          "377"
 
        );
    </script> 

The above shows the fixed version, thanks to escapejs.  Before the comment line would show as:
                "multi
line
comment"));

this would cause a javascript error, preventing the diff line(s) to be displayed.
Tested on staging server.
chipx86
  1. Thanks for the fix. Committed to master (046ba74).
    
    Also added a test case for this.
  2.