Bug 1068933 - DeviceStorage should only look at files when using since on enumeration.

This commit is contained in:
Dave Hylands 2014-10-24 13:07:06 -07:00
parent 1b917b8364
commit 0842834320
2 changed files with 16 additions and 10 deletions

View File

@ -1465,19 +1465,21 @@ DeviceStorageFile::collectFilesInternal(
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(f))) && f) {
PRTime msecs;
f->GetLastModifiedTime(&msecs);
bool isFile;
f->IsFile(&isFile);
if (msecs < aSince) {
continue;
if (isFile) {
PRTime msecs;
f->GetLastModifiedTime(&msecs);
if (msecs < aSince) {
continue;
}
}
bool isDir;
f->IsDirectory(&isDir);
bool isFile;
f->IsFile(&isFile);
nsString fullpath;
nsresult rv = f->GetPath(fullpath);
if (NS_FAILED(rv)) {

View File

@ -23,10 +23,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717103
<script class="testbody" type="text/javascript">
devicestorage_setup();
var oldFiles = ["a.png", "b.png", "c.png"];
// We put the old files in 2 levels deep. When you add a file to a directory
// it will modify the parents last modification time, but not the parents
// parents. So we want to make sure that even though x's timestamp is earlier
// than the since parameter, we still pick up the later files.
var oldFiles = ["x/y/aa.png", "x/y/ab.png", "x/y/ac.png"];
var timeFile = "t.png";
var newFiles = ["d.png", "e.png", "f.png"];
var newFiles = ["x/y/ad.png", "x/y/ae.png", "x/y/af.png", // new files in old dir
"z/bd.png", "z/be.png", "z/bf.png"]; // new files in new dir
var storage = navigator.getDeviceStorage('pictures');
var prefix = "devicestorage/" + randomFilename(12);