Chrome应用,永久文件系统,Chrome重新启动后丢失的文件 [英] Chrome App, persistent FileSystem, files lost after chrome restarts

查看:149
本文介绍了Chrome应用,永久文件系统,Chrome重新启动后丢失的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用具有持久存储功能的HTML5 FileSystem的Chrome应用,重新启动chrome后我的数据丢失了,我进行了几次测试,重新启动后丢失的数据有10次中有9次,我已经触发了问题知道是否有解决方法或我做错了什么.这是我的代码:

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);

我发现有人问过类似的问题,但是我确定我将配额(120M)设置的足够大. 此问题是针对Chrome应用程序的,对于旧版打包的应用程序来说,没问题.

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.

更新: Chrome小组已确认此问题,该修补程序将在Chrome 37上着陆.

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

推荐答案

回答我自己的问题:) 我认为我发现了问题,它确实是chrome的错误,但是只是在您卸载应用程序然后重新安装同一应用程序而没有重新启动chrome 时发生的,由于某种原因,chrome会记住已卸载的应用程序,它将延迟"以在Chrome下次重新启动时清理文件系统.

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.

此问题可能比您想象的要严重,如果您希望重新安装的应用程序能够正常运行,则必须在一次卸载旧的计算机后重新启动所有使用相同Google帐户的计算机在重新安装之前已从所有设备上卸载,Google会将nyc新应用程序发送给您所有设备.否则,当在一台未重启的计算机上使用该应用程序时,您将遇到问题.

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.

我在发出到Chrome,希望他们会解决.

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

这篇关于Chrome应用,永久文件系统,Chrome重新启动后丢失的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆