amq.js breaks messages longer than 4KB in Firefox
-------------------------------------------------
Key: AMQ-3660
URL: https://issues.apache.org/jira/browse/AMQ-3660
Project: ActiveMQ
Issue Type: Bug
Affects Versions: 5.5.1, 5.6.0
Environment: Standard environment, with running ActiveMQ broker and
e.g. the chat demo
Reporter: Claudio Squarcella
Priority: Minor
Hello,
I report a small glitch that affects the client-side Ajax script {{amq.js}} and
Firefox with big messages. It is very easy to reproduce:
* start the ActiveMQ broker locally
* open Firefox (I am using version 8.0.1) and another browser of your choice,
* point both of them to the chat example and join the chat,
* send a BIG string (more than 4096 chars) from the second browser,
* check the length of the string that appears on Firefox: exactly *4096 chars*.
After a bit of googling I found out that [Firefox limits the size of XML nodes
to 4K|http://www.coderholic.com/firefox-4k-xml-node-limit/], while in
{{amq.js}} every node is handled as a separate message:
{code:javascript}
// Loop thru and handle each <message>
for (var j = 0; j < responseElement.childNodes.length; j++) {
handler(responseElement.childNodes[j]);
}
{code}
I found out about the bug while sending rather large JSON strings, that
obviously could not be parsed. I fixed that in my code with a quite naive patch
for {{amq.js}} that "glues" nodes together in a string and handles them as a
single message, but that is not always enough (e.g. the message handler in
{{chat.js}} does not accept strings).
If you guys have clever hints I will be happy to work on a patch for this.
Ciao,
Claudio
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira