Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

Chrome App, persistent FileSystem, files lost after chrome restarts

I'm developing a Chrome App which uses HTML5 FileSystem with persistent storage, my data was lost after chrome get restarted, I tested several times, 9 times out of 10 data lost after restart, I have fired an issue on Chromium site, I want to know if there is workaround or something I did mistake. here is my code:

window.webkitRequestFileSystem(window.PERSISTENT, 120*1024*1024, function(fs) {
    function gotFileEntry(fileEntry) {
        fileEntry.createWriter(gotFileWriter, fail);
    }

    function gotFileWriter(writer) {
        writer.onwriteend = function(evt) {
            done && done();
        };      
        writer.write(blob);
    }
    fs.root.getFile(path, {create: true, exclusive: false}, gotFileEntry, fail);
}, fail);

I found a similar question some guy had asked, but I am sure I set quota(120M) big enough. This problem is for Chrome App, for Legacy packaged app, no problem.

UPDATE: Chrome team has confirmed this problem, the patch will land on Chrome 37.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Answer my own question :) I think I found the problem, it does a chrome bug but just happen when you uninstall your app then re-install same app without restart chrome, for somehow reason, chrome remember the uninstalled apps, it will "delay" to clean up filesystem when chrome next time restarts.

This problem may more serious than you think, if you want the re-installed app works correctly, you have to restart ALL of your computers with same Google account after you uninstall old one at same time, you must make sure all copies are uninstalled from all devices before you re-install, Google will snyc new app to you all devices. otherwise you will get problem when you use that app on one of un-restarted computer.

I have added a comment to my issue to Chrome, wish they will fix it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...