Skip to main content

Bug Tracker

Side navigation

#5601 closed bug (invalid)

Opened December 05, 2009 03:39AM UTC

Closed December 10, 2009 05:51AM UTC

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

Attachments (0)
Change History (5)

Changed December 05, 2009 11:33PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

Please reopen with a test case.

Changed December 08, 2009 10:47AM UTC by alec comment:2

resolution: invalid
status: closedreopened

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.

Changed December 08, 2009 06:29PM UTC by dmethvin comment:3

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.

http://json.org/

Changed December 09, 2009 08:21AM UTC by alec comment:4

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.

Changed December 10, 2009 05:51AM UTC by john comment:5

resolution: → invalid
status: reopenedclosed

@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.