After hours I figured out what is the real problem in my issue http://drupal.org/node/55355 and this one http://drupal.org/node/53314.
It causes an upload to hang at least in Firefox 1.0.7 after you press 'attach' in the upload form. It will cause all other things to fail that use the 'redirectFormButton' function in drupal.js.
The problem is with a strange behaviour of eval() in this browser. If the string passed to eval() contains a literal string that in turn contains a newline or a carriage return (a real one, not a quoted one) then eval() gives an 'unlimited string literal' error.
Example (where [newline] is the newline character):
eval('({"status": true, "data": "abcdefg[newline]hijklmn"})');
will give an 'unlimited string literal' error.
So here is my patch (sorry, no patch file but it's only two new lines):
This block starting at 140
// Get response from iframe body
try {
response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
if (window.opera) {
// Opera-hack: it returns innerHTML sanitized.
response = response.replace(/"/g, '"');
}
}
has to be changed to this one
// Get response from iframe body
try {
response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
response = response.replace(/\n/g, "\\n");
response = response.replace(/\r/g, "\\r");
if (window.opera) {
// Opera-hack: it returns innerHTML sanitized.
response = response.replace(/"/g, '"');
}
}
This will replace newlines and carriage returns with quoted ones.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal.js_5.patch | 779 bytes | tenrapid |
Comments
Comment #1
tenrapid commentedadded a patch file
changed priority to critical because the issue breaks essential features for some users.
Comment #2
rkerr commentedI haven't noticed this problem, but can see how it would break things!
Patch applies and everything seems to still work normally with it...
Do we even want to keep \r characters?
Comment #3
Zen commentedDupe: http://drupal.org/node/53314 . Please always try and reuse the earliest existing issue for a bug.
This is not a critical bug as it appears to break only in one version of FF.
-K