Closed
Bug 1032976
Opened 10 years ago
Closed 10 years ago
Don't try to continue() device storage cursor when its resulting file is null
Categories
(Firefox OS Graveyard :: FindMyDevice, defect)
Firefox OS Graveyard
FindMyDevice
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1032903
People
(Reporter: ggp, Unassigned)
Details
Bug 1028943 introduced a call to |cursor.continue()| when the file is null while enumerating a device storage [1]. At the time, that seemed like anomalous behavior of the device storage API, and we were attempting to recover from the error by skipping to the next file. As it turns out, that behavior is completely normal, and calling |cursor.continue()| is wrong. When the enumeration is over [2], the device storage API will always call the cursor's onsuccess callback one last time passing null as the result (follow the trail starting at [3]). On this last call, the cursor's done attribute will always be true, and calling |cursor.continue()| causes an exception to be thrown [4]. To fix this, I think it should be enough to just remove the call to |cursor.continue()|. We can either do that in this bug, or as part of bug 1032903 to avoid conflicts. 1- https://github.com/mozilla-b2g/gaia/blob/master/apps/findmydevice/js/commands.js#L158 2- http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#1875 3- http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#1914 4- http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#2070
Comment 1•10 years ago
|
||
lol, thanks for filing, ggp ^_^ this does indeed look super simple, I'll fix as part of the fix for 1032903. Marking as a dupe.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Comment 2•10 years ago
|
||
It looks like you can use .done as long as you're targeting FxOS 1.1 or newer See bug 902565 for some discussion on this.
You need to log in
before you can comment on or make changes to this bug.
Description
•