Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2573] HttpClient drops properties while doing a callback

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:29.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.1 M01
ComponentsiOS
Labelsios, regression
ReporterBlain Hamon
AssigneeStephen Tramer
Created2011-04-15T03:23:08.000+0000
Updated2011-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

  1. Ralf Pfeiffer 2011-04-15

    I would like us to also review two related tickets and discuss:
    #519 #1502

    ~ralf

  2. 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();
       
  3. Thomas Huelbert 2011-04-15

    is #2450 related?

  4. Stephen Tramer 2011-04-15

    Has to be part of the XHR refactor. Our canned HTTP client responses do not include location.

  5. Tamas Daniel 2011-04-15

    What do you mean it does not have "location?" Sure it does, I'm using it.

  6. Tamas Daniel 2011-04-15

    Stephen , I can confirm that the build with githash=188468e puts the location in place. Thanks.

  7. 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.

  8. 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

JSON Source