Closed Bug 769880 Opened 13 years ago Closed 13 years ago

Make createIndex throw InvalidAccessError instead of NotSupportedError

Categories

(Core :: Storage: IndexedDB, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: sicking, Unassigned)

Details

Attachments

(1 file)

Attached patch Patch to fixSplinter Review
Based on discussion on mailing list. Though there is some risk that this will be reverted it seems more likely to stick. Patch also includes some additional tests and some test cleanup.
Attachment #638076 - Flags: review?(khuey)
Comment on attachment 638076 [details] [diff] [review] Patch to fix Review of attachment 638076 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/indexedDB/test/unit/test_create_index.js @@ +51,5 @@ > } > + ok(ex, "createIndex with array keyPath and multiEntry should throw"); > + is(ex.name, "InvalidAccessError", "should throw right exception"); > + ok(ex instanceof DOMException, "should throw right exception"); > + is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception"); Put the tests in the catch, and put a ok(false) at the end of the try block. That way if this fails the test won't throw an exception and terminate at ex.name. ::: dom/indexedDB/test/unit/test_create_objectStore.js @@ +109,5 @@ > + } > + ok(ex, "createObjectStore with empty keyPath and autoIncrement should throw"); > + is(ex.name, "InvalidAccessError", "should throw right exception"); > + ok(ex instanceof DOMException, "should throw right exception"); > + is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception"); Here too. @@ +122,5 @@ > + } > + ok(ex, "createObjectStore with array keyPath and autoIncrement should throw"); > + is(ex.name, "InvalidAccessError", "should throw right exception"); > + ok(ex instanceof DOMException, "should throw right exception"); > + is(ex.code, DOMException.INVALID_ACCESS_ERR, "should throw right exception"); Here too.
Attachment #638076 - Flags: review?(khuey) → review+
But it makes the code flow less obvious. And I'd have to insert both ok(true) in the catch branch and ok(false) in the try branch. I'd prefer to keep it as-is.
It would be consistent with the other tests too.
Kyle, does your r+ stand with the patch as-is? I'd rather not change the tests as I prefer the current pattern and would prefer to see more rather than fewer tests written this way.
Comment on attachment 638076 [details] [diff] [review] Patch to fix Resetting review request to get clarification.
Attachment #638076 - Flags: review+ → review?(khuey)
Comment on attachment 638076 [details] [diff] [review] Patch to fix Review of attachment 638076 [details] [diff] [review]: ----------------------------------------------------------------- I told you on IRC that I'd go along with it, despite my distaste for that pattern.
Attachment #638076 - Flags: review?(khuey) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: