Closed
Bug 1068933
Opened 10 years ago
Closed 10 years ago
DeviceStorage - since not working properly with enumerate
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
2.1 S7 (24Oct)
People
(Reporter: dhylands, Assigned: dhylands)
Details
Attachments
(1 file, 1 obsolete file)
2.53 KB,
patch
|
janv
:
review+
|
Details | Diff | Splinter Review |
I added the following function to ds-test: > function ds_test_enumerate_since() { > log('ds_test_enumerate_since'); > > var storage = navigator.getDeviceStorage('sdcard'); > var cursor = storage.enumerate(); > var timestamp = null > var do_since = true; > cursor.onsuccess = function enumSuccess(e) { > if (e.target.result == null) { > if (do_since) { > do_since = false; > if (timestamp) { > log('===== since.txt timestamp = ' + timestamp + ' ====='); > var cursor_since = storage.enumerate({'since' : timestamp}); > cursor_since.onsuccess = cursor.onsuccess; > cursor_since.onerror = cursor.onerror; > } else { > log("since.txt file not found"); > } > } else { > log('===== Done ====='); > } > return; > } > log(e.target.result.name + ' - ' + e.target.result.lastModifiedDate); > if (e.target.result.name.slice(-9) == 'since.txt') { > timestamp = e.target.result.lastModifiedDate; > } > e.target.continue(); > }; > cursor.onerror = function enumError(e) { > log('enumError'); > }; > } If I then take a few pictures, and then do: > adb shell touch /storage/sdcard0/DCIM/100MZLLA/since.txt and then take a few more pictures, I get this output: > /sdcard/DCIM/100MZLLA/IMG_0009.jpg - Wed Sep 17 2014 12:42:14 GMT-0700 (UTC) > /sdcard/DCIM/100MZLLA/IMG_0010.jpg - Wed Sep 17 2014 12:42:18 GMT-0700 (UTC) > /sdcard/DCIM/100MZLLA/since.txt - Wed Sep 17 2014 12:43:38 GMT-0700 (UTC) > /sdcard/DCIM/100MZLLA/IMG_0011.jpg - Wed Sep 17 2014 12:44:00 GMT-0700 (UTC) > /sdcard/DCIM/100MZLLA/IMG_0012.jpg - Wed Sep 17 2014 12:44:04 GMT-0700 (UTC) > ===== since.txt timestamp = Wed Sep 17 2014 12:43:38 GMT-0700 (UTC) ===== > ===== Done ===== It should report IMG_0011.jpg and IMG_0012.jpg from the since enumeration and it doesn't. There is a similar test case for this in: http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/test/test_lastModificationFilter.html?from=test_lastModificationFilter.html#1 so I need to figure out why the test is working (or not being run, or whatever) and why the code I posted above isn't working.
Assignee | ||
Updated•10 years ago
|
Target Milestone: --- → 2.1 S5 (26sep)
Assignee | ||
Comment 1•10 years ago
|
||
DeviceStorage only returns files, so it should only be filtering files. The way it was implemented it would discard entire directory trees if the timestamp on the directory was less than the since modifier.
Assignee | ||
Comment 2•10 years ago
|
||
Updated the last filter test. Verified that the test fails without the rest of the patch and pass with the patch.
Attachment #8491182 -
Attachment is obsolete: true
Attachment #8491218 -
Flags: review?(Jan.Varga)
Comment 4•10 years ago
|
||
sorry, I was finishing something else, will do tomorrow
Flags: needinfo?(Jan.Varga)
Comment 5•10 years ago
|
||
Comment on attachment 8491218 [details] [diff] [review] Only look at timestamps of files (not directories) v2 Review of attachment 8491218 [details] [diff] [review]: ----------------------------------------------------------------- sorry for the delay
Attachment #8491218 -
Flags: review?(Jan.Varga) → review+
Assignee | ||
Comment 6•10 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/e5e33d14ee28 Forgot to add r=janv so backed out https://hg.mozilla.org/integration/b2g-inbound/rev/9fa73a2c4c2b and relanded https://hg.mozilla.org/integration/b2g-inbound/rev/12d4584713e5
Assignee | ||
Updated•10 years ago
|
Target Milestone: 2.1 S5 (26sep) → 2.1 S7 (24Oct)
Assignee | ||
Comment 7•10 years ago
|
||
Commited the code from comment 0 to ds-test https://github.com/mozilla-b2g/gaia/commit/31bb61b698775ce88ffe509aa7ae48678aea2174
Assignee | ||
Updated•10 years ago
|
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/12d4584713e5
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•