升级cocos creator1.7.2以后如下代码无法运行

升级cocos creator1.7.2以后如下代码无法运行,1.6.1是可以正常运行得到数据的,这里转为Uint8Array后的数据为空.

var saveFile = function (data) {
if (!data || typeof data == ‘undefined’ || data.length == 0) {
callback(mm.data.avatar_default);
return;
}

            if (!jsb.fileUtils.isDirectoryExist(dirpath)) {
                jsb.fileUtils.createDirectory(dirpath);
            }

            var data8 = new Uint8Array(data);
            if(!data8 || data8.length == 0) {
                callback(mm.data.avatar_default);
                return;
            }
            if (jsb.fileUtils.writeDataToFile(data8, filepath)) {
                cc.log('Remote write file succeed.');
                loadEnd();
            }
            else {
                cc.log('Remote write file failed.');
            }

        };

        //var t = url.substr(0, 2);
        var loadpath = avatar_url;
        if (loadpath == null || loadpath.length == 0) {
            loadpath = mm.config.avatarHost + account_id + ".jpg";
        }

        var xhr = cc.loader.getXMLHttpRequest();
        xhr.timeout = 10000; //毫秒单位
        xhr.ontimeout = function () {
            xhr.abort(); //重置 
            //重新请求
            xhr.open("GET", loadpath, true);
            xhr.send();
        }.bind(this);

        xhr.onerror = function (error) {
            callback(mm.data.avatar_default);
            console.log("getXMLHttpRequest,xhr.onerror")
        }.bind(this);

        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4) {
                if (xhr.status === 200 || xhr.status === 304) {
                    xhr.responseType = 'arraybuffer';
                    saveFile(xhr.response);
                } else {
                    saveFile(null);
                }
            }
        }.bind(this);
        xhr.open("GET", loadpath, true);
        xhr.send();

重复问题:

http://forum.cocos.com/t/1-7/53814/16?u=dumganhar

在发送请求前

这个代码之前在论坛copy的,所以一样的问题.:joy:

有三个多月没升级了,这次升级还算顺利,问题不算多,看得出来研发团队的付出,参数效验都加了好多好多,可惜还是出现两次莫名其妙的宕机,因为无心恋战暂时回退到了1.6.1。