Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17062] iOS: onload callback is not triggered second time for existing HTTPClient object

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-06-05T20:07:04.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsiOS
Labelsmodule_network, qe-3.3.0, qe-testadded, regression
ReporterKajenthiran Velummaylum
AssigneeVishal Duggal
Created2014-06-03T08:17:06.000+0000
Updated2014-07-03T03:48:05.000+0000

Description

The onload callback is not triggered second time request of existing HTTPClient object. This is *regression* since it does not occur in 3.2.3GA release. The following code demonstrate the behavior more clearly.
var win = Ti.UI.createWindow({backgroundColor:'white'});
var button = Ti.UI.createButton({
	title:'load',
	top:'20%',
	bottom:'20%',
	left:'20%',
	right:'20%'
	});

win.add( button );

var xhr;	
button.addEventListener('click', function () {
	button.title = 'parsing...';
	if(!xhr){
		xhr = Titanium.Network.createHTTPClient({onload: function() {
			Ti.API.info('onload');
			button.title = 'load';	
		}});
	}
	
    //Abort existing call
    xhr.abort();
	
    // open the client
    xhr.open('GET', 'http://www.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml');
    xhr.send();
});

win.open();		
*Expected Result:* Every time you click the "load" button, its text property should change to "parsing..." and restore back to "load" text. *Actual Result:* On the first time you click, it change back to "load". But in the second time it stays on "parsing..." and not coming back to the value "load".

Comments

  1. Vishal Duggal 2014-06-05

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/5775 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5776
  2. Satyam Sekhri 2014-06-09

    The onload callback is triggered each time. Verified on: || Component || Version || | Appcelerator Studio | 3.3.0.201405271647 | | Titanium SDK | 3.3.0.v20140606154912 | | Node | 0.10.28 | | acs | 1.0.14 | | alloy | 1.4.0-beta2 | | npm | 1.4.9 | | CLI | 3.3.0-beta2 | | Titanium-code-processor | 1.1.1 | | OS | OSX 10.9.2 | | Device | iPhone 5S (iOS 7.1) |

JSON Source