[TIMOB-2573] HttpClient drops properties while doing a callback
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:59:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.1 M01 |
Components | iOS |
Labels | ios, regression |
Reporter | Blain Hamon |
Assignee | Stephen Tramer |
Created | 2011-04-15T03:23:08.000+0000 |
Updated | 2011-04-17T01:59:29.000+0000 |
Description
This is actually due to a compromise in order to reduce memory issues due to recursive XHR call chains, as we intentionally jettison the request holding the internal data. This will be fixed in the great XHR refactor.
To recreate:
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function(e){
Ti.API.info('onload');
Ti.API.info(xhr.location);
// Ti.API.info(xhr.responseText);
};
xhr.onerror = function(e){
Ti.API.info('onerror');
// Ti.API.info(xhr.responseText);
};
xhr.open('GET','http://www.motorsport-total.com/f1/live/htdocs/ticker.php');
xhr.send();
Expected result:
[INFO] test/1.0 (1.5.1_9819ce0_13122010.9819ce0)
[INFO] onload
[INFO] http://www.motorsport-total.com/f1/live/htdocs/ticker.php?strecken_id=19&event_id=7&kunde=default
Actual result:
[INFO] test/1.0 (1.5.1_9819ce0_13122010.9819ce0)
[INFO] onload
[INFO] <null>
Workaround:
Use this.location and this.responseText.
Credit to Tamas Daniel for the sample code.
Comments
- Ralf Pfeiffer 2011-04-15
- Tamas Daniel 2011-04-15
Nope, location still gets jettisoned.
this.responseText works.
var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function(e){ Ti.API.info('onload'); Ti.API.info(this.location); // Ti.API.info(this.responseText); }; xhr.onerror = function(e){ Ti.API.info('onerror'); // Ti.API.info(this.responseText); }; xhr.open('GET','http://www.motorsport-total.com/f1/live/htdocs/ticker.php'); xhr.send();
- Thomas Huelbert 2011-04-15
is #2450 related?
- Stephen Tramer 2011-04-15
Has to be part of the XHR refactor. Our canned HTTP client responses do not include location.
- Tamas Daniel 2011-04-15
What do you mean it does not have "location?" Sure it does, I'm using it.
- Tamas Daniel 2011-04-15
Stephen , I can confirm that the build with githash=188468e puts the location in place. Thanks.
- Stephen Tramer 2011-04-15
Thank you for testing this, I had initially misidentified it as a different bug. Tested myself and confirmed the fix.
- Don Thorp 2011-04-15
Made the 1.5.1 release. Moving to the milestone it was fixed in and marking it resolved by #2450