nit: As a lazy guy i often do: req.onsuccess = req.onerror = callback; for such case.