Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25783] Windows: HttpClient.clearCookies freezes app

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2018-09-18T09:09:53.000+0000
Affected Version/sRelease 7.0.0
Fix Version/sRelease 7.5.0
ComponentsWindows
Labelsn/a
ReporterKota Iguchi
AssigneeKota Iguchi
Created2018-02-15T06:05:45.000+0000
Updated2018-09-24T10:00:23.000+0000

Description

Ti.Network.HttpClient.clearCookies hangs. It also doesn't clear the cache.
var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});

win.addEventListener('open', function () {
    var xhr = Ti.Network.createHTTPClient(),
        cookie_string;
    function second_cookie_fn() {
        Ti.API.info('Set-Cookie: ' + this.getResponseHeader('Set-Cookie'));
        var second_cookie_string = this.getResponseHeader('Set-Cookie').split(';')[0];
        // New Cookie should be different.
        Ti.API.info('OLD: ' + cookie_string);
        Ti.API.info('NEW: ' + second_cookie_string);
        win.backgroundColor = 'green';
    }
    xhr.setTimeout(3e4);
    xhr.onload = function () {
        Ti.API.info('Set-Cookie: ' + this.getResponseHeader('Set-Cookie'));
        cookie_string = this.getResponseHeader('Set-Cookie').split(';')[0];
        xhr.clearCookies('https://my.appcelerator.com');
        xhr.onload = second_cookie_fn;
        setTimeout(function () {
            xhr.open('GET', 'https://my.appcelerator.com/auth/login');
            xhr.send();
        }, 5000);
    };
    xhr.onerror = function (e) {
        Ti.API.warn(e);
        win.backgroundColor = 'red';
    };
    xhr.open('GET', 'https://my.appcelerator.com/auth/login');
    xhr.send();
});

win.open();
Expected: App should not freeze and New cookie should be different.

Comments

  1. Kota Iguchi 2018-02-15

    https://github.com/appcelerator/titanium_mobile_windows/pull/1186
  2. Josh Longton 2018-09-18

    *FR Passed - Waiting on Jenkins*
  3. Josh Longton 2018-09-24

    *Closing ticket* The fix is present in SDK; {noformat} 7.5.0.v20180922081022 {noformat}

JSON Source