This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18427 - [IndexedDB] Spec text requires index names be unique within database
Summary: [IndexedDB] Spec text requires index names be unique within database
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-27 21:16 UTC by Joshua Bell
Modified: 2013-01-31 17:47 UTC (History)
3 users (show)

See Also:


Attachments

Description Joshua Bell 2012-07-27 21:16:22 UTC
The spec sayeth:

createIndex: 
"If an index with the same name already exists, the implementation must throw a DOMException of type ConstraintError."
"An index with the same name, compared in a case-sensitive manner, already exists in the connected database."

deleteIndex: 
"This method destroys the index with the given name in the connected database."
"There is no index with the given name, compared in a case-sensitive manner, in the connected database."

This would appear to require that this should throw ConstraintError:

mozIndexedDB.open("my-db", 1).onupgradeneeded = function(e) {
  db = e.target.result;
  s1 = db.createObjectStore('s1');
  s2 = db.createObjectStore('s2');
  s1.createIndex('i', 'keypath');
  s2.createIndex('i', 'keypath');
};

I don't believe this is the intention of the spec, and neither Firefox (14) nor Chrome (20) behave this way. The uniqueness constraint for index names should be just is within an object store, not across the database. It looks like this is just a copy/pasta from the description/exception tables for create/deleteObjectStore.
Comment 1 Eliot Graff 2012-08-02 21:35:50 UTC
I'll make the change like this:

createIndex: 
"If an index with the name already exists, the implementation must throw a
DOMException of type ConstraintError."
"An index with the same name, compared in a case-sensitive manner, already
exists in the connected object store."

deleteIndex: 
"This method destroys the index with the given name in the connected object store."
"There is no index with the given name, compared in a case-sensitive manner, in
the connected object store."

Thanks,

E
Comment 2 Joshua Bell 2012-08-03 00:52:38 UTC
Looks good, although you can probably remove the word "connected". I think that's there from implying the distinction between the IDBDatabase (the "connection") and the database itself.
Comment 3 Eliot Graff 2013-01-31 17:47:26 UTC
Changes incorporated in commit #377.