Closed
Bug 966794
Opened 11 years ago
Closed 5 months ago
indexed db - object store creation on the transaction do not work
Categories
(Core :: Storage: IndexedDB, defect, P5)
Tracking
()
RESOLVED
INVALID
People
(Reporter: peteris.prieditis, Unassigned)
Details
(Whiteboard: dom-lws-bugdash-triage)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20131205075310
Steps to reproduce:
Adding records to indexed db accordingly to https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction
Actual results:
I the following error "Error: A mutation operation was attempted on a database that did not allow mutations." on line "var objectStore = transaction.objectStore("customers");"
Expected results:
The object store should had been created on the transaction.
create an object store on the transaction. On latest Chrome Version 32.0.1700.102 this works OK.
Updated•11 years ago
|
Attachment #8369236 -
Attachment mime type: application/x-javascript → text/plain
Comment on attachment 8369236 [details]
file contains code which triggers error
Hm, this code can't be what you're actually using; I see multiple bugs but none of them would result in the error message you posted...
I'm new to indexed db and at first I wasn't surprised that this simple example didn't work for me. Initially I thought that the issue should be in code however the code works on Chrome. So I think the issue should be in browser. Am I the only one who have experienced this?
I would recommend reading https://developer.mozilla.org/en/docs/IndexedDB/Using_IndexedDB if you're new to indexedDB.
The most obvious problem with your sample code is that you don't wait for the success event from the open request before continuing your work (i.e., you need to wait for |request.onsuccess| to be called). The next big thing is that there is no |request.onupgradeneeded| handler, so you never have the opportunity to create an objectStore (creating and removing objectStores is only allowed during a upgradeneeded event).
Hope those pointers help!
(In reply to ben turner [:bent] (use the needinfo? flag!) from comment #4)
> I would recommend reading
> https://developer.mozilla.org/en/docs/IndexedDB/Using_IndexedDB if you're
> new to indexedDB.
>
> The most obvious problem with your sample code is that you don't wait for
> the success event from the open request before continuing your work (i.e.,
> you need to wait for |request.onsuccess| to be called). The next big thing
> is that there is no |request.onupgradeneeded| handler, so you never have the
> opportunity to create an objectStore (creating and removing objectStores is
> only allowed during a upgradeneeded event).
>
> Hope those pointers help!
Thanks a lot for help! The error wasn't on fly resolved by this and there started to happen very funny things in code execution. The issue was solved by simple machine reboot. I previously tried several FF reboots however it seems that it wasn't enough.
The info in https://developer.mozilla.org/en/docs/IndexedDB/Using_IndexedDB is great and I haven't found anything even similar to that quality.
Updated•7 years ago
|
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
Comment 6•5 months ago
|
||
(Sounds like the test case here had some bugs that once addressed indicate there's no problem in the IDB impl.)
Status: UNCONFIRMED → RESOLVED
Closed: 5 months ago
Resolution: --- → INVALID
Whiteboard: dom-lws-bugdash-triage
You need to log in
before you can comment on or make changes to this bug.
Description
•