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 18502 - [IndexedDB] Editorial: Wording around IDBFactory.open() with no version misleading
Summary: [IndexedDB] Editorial: Wording around IDBFactory.open() with no version misle...
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-08-08 16:18 UTC by Joshua Bell
Modified: 2013-03-01 19:48 UTC (History)
2 users (show)

See Also:


Attachments

Description Joshua Bell 2012-08-08 16:18:19 UTC
The second paragraph reads:

"If no version is specified and a database exists, use the current database version and follow the steps for opening a database. If no version is specified and no database exists, set database version to 1, follow the steps for opening a database, and return a database without object stores."

The most glaring issue is the final phrase, "return a database without object stores" - the function returns an IDBRequest, not a database.  The intent is also redundant with step 4 of the "Steps for opening a database".

The phrase "set database version to 1" may also be misleading. More correctly it should follow the phrasing used in the first paragraph which define the inputs to the steps, e.g. "If no version is specified and no database exists, let /origin/ be the origin of the IDBEnvironment used to access this IDBFactory, let /name/ be the name parameter passed to this function, and let /version/ be 1."

(There also seems to be some ambiguity about what happens if open() is called without a version but is delayed by a deleteDatabase(); the delete should happen first, but does the open() use the version the database had prior to the delete? If so, that's a little odd. If not, then the version can't logically be determined at this point in the spec, and must be deferred to the "Steps for opening" e.g. by having the /version/ be null with special cases. I may just be missing something in the spec, though.)
Comment 1 Joshua Bell 2013-02-19 23:52:45 UTC
Here's how I think this needs to be fixed:

In both 3.2.3 IDBFactory.open and 3.3.1 IDBFactorySync.open, add this to the end of the first paragraph:

"If no /version/ argument was passed to this function, let /version/ be |undefined|."

And delete the second paragraph, "If no version.... without object stores."

Then in 4.1 Opening a database, insert a new step between steps 4 and 5:

X. If /version/ is |undefined|, then let /version/ be 1 if /db/ was created in the previous step, or the current _version_ of /db/ otherwise.
Comment 2 Joshua Bell 2013-03-01 19:48:04 UTC
Fixed in https://dvcs.w3.org/hg/IndexedDB/rev/3662e5052bc0

Since I filed this, I'd appreciate another set of eyeballs to verify the change.