Bug Tracker

Modify

Ticket #3048 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

QUnit/testrunner.js fails when error message contains XML-interpreted characters

Reported by: bdumon Owned by: flesler
Priority: minor Milestone:
Component: qunit Version:
Keywords: qunit Cc:
Blocking: Blocked by:

Description

When a test throws an exception and the exception message contains characters with an XML-meaning, the testrunner will fail with a SAXParseException.

For example, I've got a test which throws an exception whose message is like this:

The element type "input" must be terminated by the matching end-tag "</input>"

which will in turn cause an error like:

test_core: Wrapped java.lang.RuntimeException: org.xml.sax.SAXParseException: The element type "wrap" must be terminated by the matching end-tag "</wrap>". (file:/home/bruno/projects/kauri/trunk/modules/kauri-forms/kauri-forms-framework/../kauri-forms-jquery/src/main/kauri/js/testrunner.js#146)

The solution is either to escape any special characters in the message string, or to not interprete it as HTML.

In the attached patch, I take the latter approach.

Attachments

testrunner-innerhtml-patch.txt Download (507 bytes) - added by bdumon 5 years ago.
Patch against svn rev 5726

Change History

Changed 5 years ago by bdumon

Patch against svn rev 5726

comment:1 Changed 5 years ago by flesler

  • need changed from Review to Commit
  • Owner changed from joern to flesler
  • Status changed from new to assigned

comment:2 Changed 5 years ago by flesler

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed at [5730]. I actually added the same modification before checking your patch. I modified the "informal" version of qunit, I'll let Joern know about this change. Thanks for reporting.

comment:3 Changed 5 years ago by joern

Now also part of QUnit itself, see [5812].

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.