Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4829 closed defect (fixed)

dojo.data tests failing

Reported by: Adam Peller Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: General Version: 0.9
Keywords: Cc: alex
Blocked By: Blocking:

Description

perhaps something to do with the new throw if something goes wrong in the xhr json code?

Change History (7)

comment:1 Changed 12 years ago by Jared Jurkiewicz

The failure is something in the json-comment-optional code. For values:

/* { identifier: 'abbr',

items: [

{ abbr:'ec', name:'Ecuador', capital:'Quito' }, { abbr:'eg', name:'Egypt', capital:'Cairo' }, { abbr:'sv', name:'El Salvador', capital:'San Salvador' }, { abbr:'gq', name:'Equatorial Guinea', capital:'Malabo' }, { abbr:'er', name:'Eritrea', capital:'Asmara' }, { abbr:'ee', name:'Estonia', capital:'Tallinn' }, { abbr:'et', name:'Ethiopia', capital:'Addis Ababa' }

]} */

It claims this isn't comment filtered (it is), then tries to pass it through the normal 'non-comment filtered' json handler.

See: In the handler for json-comment-optional.bootstrap.js (line 416) /* { identifier: 'abbr', items: [ { abbr:'ec', name:'Ecuador', capital:'Quito' }, { abbr:'eg', name:'Egypt', capital:'Cairo' }, { abbr:'sv', name:'El Salvador', capital:'San Salvador' }, { abbr:'gq', name:'Equatorial Guinea', capital:'Malabo' }, { abbr:'er', name:'Eritrea', capital:'Asmara' }, { abbr:'ee', name:'Estonia', capital:'Tallinn' }, { abbr:'et', name:'Ethiopia', capital:'Addis Ababa' } ]} */ bootstrap.js (line 388) In the handler for json-comment-optional. It failed.bootstrap.js (line 421) Error: your JSON wasn't comment filtered! message=your JSON wasn't comment filtered!bootstrap.js (line 422) consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints (use djConfig.usePlainJson=true to turn off this message)bootstrap.js (line 378) SyntaxError?: syntax error message=syntax error

It's something to do with the regexp/change there. Looking further. Looks to be a bug in base Xhr code.

comment:2 Changed 12 years ago by Jared Jurkiewicz

The problem is the regular expression only works if the JSON is all one line. If the JSON is formatted at all, it fails. For example:

Fails: /* { identifier: 'abbr',

items: [

{ abbr:'ec', name:'Ecuador', capital:'Quito' }, { abbr:'eg', name:'Egypt', capital:'Cairo' }, { abbr:'sv', name:'El Salvador', capital:'San Salvador' }, { abbr:'gq', name:'Equatorial Guinea', capital:'Malabo' }, { abbr:'er', name:'Eritrea', capital:'Asmara' }, { abbr:'ee', name:'Estonia', capital:'Tallinn' }, { abbr:'et', name:'Ethiopia', capital:'Addis Ababa' }

]} */

Works: /* { identifier: 'abbr', items: [{ abbr:'ec', name:'Ecuador', capital:'Quito' },{ abbr:'eg', name:'Egypt', capital:'Cairo' },{ abbr:'sv', name:'El Salvador', capital:'San Salvador' },{ abbr:'gq', name:'Equatorial Guinea', capital:'Malabo' },{ abbr:'er', name:'Eritrea', capital:'Asmara' },{ abbr:'ee', name:'Estonia', capital:'Tallinn' },{ abbr:'et', name:'Ethiopia', capital:'Addis Ababa' }]}*/

comment:3 Changed 12 years ago by Adam Peller

Cc: alex added

comment:4 Changed 12 years ago by Adam Peller

Owner: changed from Jared Jurkiewicz to Adam Peller

comment:5 Changed 12 years ago by Jared Jurkiewicz

Changeset with minor warning fix: http://trac.dojotoolkit.org/changeset/11055 Silences the emit about json-comment-optional in core tests.

comment:6 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [11057]) Fix regexp for json comment filtering to accept multilines. Fixes #4829

comment:7 Changed 12 years ago by Adam Peller

(In [11157]) I give up. Put back the indexOf searches for comments in place of regexp attempt. Refs #3961, #4829, #4888 Reverts part of change in [10834]

Note: See TracTickets for help on using tickets.