Bug Tracker

Modify

Ticket #5601 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

1.4a1 causing parserror using form.js

Reported by: charlietfl Owned by:
Priority: major Milestone: 1.4
Component: plugin Version: 1.4a1
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Please reopen with a test case.

comment:2 Changed 4 years ago by alec

  • Status changed from closed to reopened
  • Resolution invalid deleted

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 4 years ago by dmethvin

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/

comment:4 Changed 4 years ago by alec

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 4 years ago by john

  • Status changed from reopened to closed
  • Resolution set to invalid

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