WebKit nightly doesn't allow setting global indexedDB/IDBKeyRange variables, so make them local.
Get rid of unused module-level global "db".
Add deleteDB() method and use it in the demo. Change closeDB() and switchDB() to return promise.
Combine the module connection() and upgradeDatabase() functions into a single connect(name, version, callback) as they will generally always be called in tandem.