Opened 6 years ago

Last modified 2 years ago

#16191 assigned defect

Calls to dojo.io.script.get with resulting data of null or 0 do not trigger jsonp callback.

Reported by: damianm Owned by: dylan
Priority: undecided Milestone: 1.15
Component: IO Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

I'm using the dojo.io.script.get to retrieve some data from a web service, I include the jsonp parameter to have a callback called with the results. The resulting data is always stored in ioArgs.json, but the callback is never triggered if the results are null or 0. The problem is the _ioCheck never returns true for this data as null/0 will return false in a conditional. Comparing with undefined instead seems to fix the issue. The fix I implemented to the _ioCheck function is below:

	dojo.io.script._ioCheck = function(/*Deferred*/dfd){
		//summary: inflight check function to see if IO finished.
		var ioArgs = dfd.ioArgs;
		//Check for finished jsonp

		//if( ioArgs.json || (ioArgs.scriptLoaded && !ioArgs.args.checkString)){
		if( (ioArgs.json !== undefined) || (ioArgs.scriptLoaded && !ioArgs.args.checkString)){
			return true;
		}

		//Check for finished "checkString" case.
		var checkString = ioArgs.args.checkString;
		return checkString && eval("typeof(" + checkString + ") != 'undefined'");	
	};

Change History (2)

comment:1 Changed 3 years ago by dylan

Milestone: tbd1.12
Owner: changed from Bryan Forbes to dylan
Status: newassigned

I'll look into this after 1.11 and see if it's an issue with dojo/request.

comment:2 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.