[TIMOB-11758] Android: HTTPClient: the payload for the callbacks ondatastream and onsendstream is incorrectly set on Rhino
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-11-16T11:09:12.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.0.0, Release 3.1.0, 2012 Sprint 23 API, 2012 Sprint 23 |
Components | Android |
Labels | regression |
Reporter | Ping Wang |
Assignee | Ping Wang |
Created | 2012-11-14T00:01:51.000+0000 |
Updated | 2012-12-05T17:52:53.000+0000 |
Description
This is a regression. This does not happen on 2.1.3.GA.
Failed case 1:
var xhr = Titanium.Network.createHTTPClient();
xhr.onreadystatechange = function(e) {
Ti.API.info("************************** xhr.onreadystatechange: this.readyState = " + this.readyState);
}
xhr.ondatastream = function(e) {
Ti.API.info("^^^^^^^^^^^^^^^^^^^^^^^^^^ xhr.ondatastream = " + e.progress);
}
xhr.open('GET','http://www.appcelerator.com/assets/The_iPad_App_Wave.pdf');
xhr.send();
Failed case 2:
var xhr = Titanium.Network.createHTTPClient();
xhr.onreadystatechange = function(e) {
Ti.API.info("************************** xhr.onreadystatechange: this.readyState = " + this.readyState);
}
xhr.onsendstream = function(e) {
Ti.API.info("-------------------------- xhr.onsendstream = " + e.progress);
}
xhr.open('POST', 'https://twitpic.com/api/uploadAndPost');
var buffer = Ti.createBuffer({
length : 1024 * 10
}).toBlob();
xhr.send({
data : buffer,
username : 'fgsandford1000',
password : 'sanford1000',
message : 'check me out'
});
Actual result:
The log shows:
I/TiAPI (11891): ^^^^^^^^^^^^^^^^^^^^^^^^^^ xhr.ondatastream = undefined
or
I/TiAPI (11891): -------------------------- xhr.onsendstream = undefined
Expected result:
The log shows the numerical progress for datastream / sendstream.
This regression is caused by [PR #2687](https://github.com/appcelerator/titanium_mobile/pull/2687) .
PR https://github.com/appcelerator/titanium_mobile/pull/3430 Steps for FR: 1. Run the above two test cases on both rhino and v8. Should see the value of e.progress in the log. 2. Run Anvil -> network_httpclient on both rhino and v8. All the tests (including callbackTestForGETMethod and callbackTestForPOSTMethod) should pass.
3_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/3474
Bill is reviewing the 3_0_X PR.
Tested with 3.0.0.20121204144658 on Droid 1 2.2.3 with Rhino