Opened 13 years ago
Closed 13 years ago
#5601 closed bug (invalid)
1.4a1 causing parserror using form.js
Reported by: | charlietfl | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | plugin | Version: | 1.4a1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
tried 1.4a1 in an app have been working on for a month with 1.3.2
immediately got an error haven't had coming from malsup form.js
'parserror' on an ajax submit with json. Firebug and json lint both validate the json
revert back and forth between 1.3.2 and 1.4a1 and error is consistent only in 1.4a1
Change History (5)
comment:1 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 13 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
The same regression in Roundcube Webmail. I have no testcase, but I've investigated it more. In httpData() json response is interpreted with:
data = (new Function("return " + data))();
while in 1.3.2 eval was used. Changing this to old:
data = window["eval"]("(" + data + ")");
fixes issue. If I add alert(data) before this line, I got example response wich causes "invalid label" error in Firefox. This is the alert message:
/** ajax response [08/Dec/2009 11:43:31 +0100] **/ {action:'getunread',unlock:0,exec:'this.set_unread_count(\'Spam\',123,0);\nthis.set_unread_count(\'&BCAEMARBBEEESwQ7BDoEOA-\',2,0);\n'}
Again, it works with 1.3.2.
comment:3 Changed 13 years ago by
Actually, alec, that's good info. It looks to me like the json being passed is malformed. The property names aren't quoted and the strings are being quoted with single quotes. Neither is allowed in syntactically proper json.
comment:4 Changed 13 years ago by
In fact, you're right. Roundcube's fixed now. BTW I don't see any speed up in using the new "function" method in parsing JSON data.
comment:5 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
@alec: It wasn't so much a speed-up as just not using eval anymore. Using eval causes problems with code compressors and is generally frowned upon. Glad to see that it's working for you now.
Please reopen with a test case.