Ticket #4829 (closed defect: fixed)

Opened 13 months ago

Last modified 13 months ago

dojo.data tests failing

Reported by: peller Owned by: peller
Priority: normal Milestone: 1.0
Component: General Version: 0.9
Severity: normal Keywords:
Cc: alex

Description

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

Change History

Changed 13 months ago by jaredj

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.

Changed 13 months ago by jaredj

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' }]}*/

Changed 13 months ago by peller

  • cc alex added

Changed 13 months ago by peller

  • owner changed from jaredj to peller

Changed 13 months ago by jaredj

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

Changed 13 months ago by peller

  • status changed from new to closed
  • resolution set to fixed

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

Changed 13 months ago by 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.