Open erik-southmedia opened 10 years ago
Hmm it's unclear from the spec which I should be looking at, currentTarget
or target
, but I think I should actually be looking at something else, the result.request
property, which would require a bit more refactoring.
@erik-southmedia : We have worked around this particular issue, so if you could test, that would be great.
@aaronpowell , FWIW, according to MDN, target
and currentTarget
will differ with bubbling. Since the listener is only on the upgradeneeded
transaction, they should not be different. IndexedDBShim probably should support this to be safe (probably moreso with errors that bubble), but anyways, this has all been worked around in the now merged currentTarget
PR, so this issue could be closed (unless you want to wait for confirmation that the shim does not have another problem).
I'm using db.js with IndexedDBShim for iOS Safari. My HTML5 app opens a database and synchronises data with the server when it starts. However, when db.js gets the "upgrade needed" event and tries to create the schema I get an error in the Safari console about an undefined object for "e.currentTarget.transaction" on line 543 of db.js. This line is:
store = e.currentTarget.transaction.objectStore(tableName);
I don't know if this is correct for IndexedDB but the shim library seems to return events only with "target" defined. So I did a workaround with the following code.
if(e.currentTarget !== undefined) { store = e.currentTarget.transaction.objectStore(tableName); } else store = e.target.transaction.objectStore(tableName);
I hope this helps someone.