(#3062) - refactor idb/websql to share more code

This is just some odd refactoring I did while working on #3062. The goal was to increase the code shared between `idb.js` and `websql.js` in the hopes that that can later be extended to `leveldb.js`.

Also notice that `_bulk_seq` is totally useless and we can remove it wherever we see it.