IndexedDB: Attributes for a cursor "run past the end" should be undefined.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 20:01:22 +0000 (20:01 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 20:01:22 +0000 (20:01 +0000)
commitd0cc5f78fb6aa96a695328ef97fef2757001d9d4
tree7de3464b6082a1e35b9871a5ef1b18ea11699f68
parent081193e4dd1d60898bad68578c0c9ffedc4243bc
IndexedDB: Attributes for a cursor "run past the end" should be undefined.
https://bugs.webkit.org/show_bug.cgi?id=83492

Patch by Alec Flett <alecflett@chromium.org> on 2012-04-12
Reviewed by Ojan Vafai.

Source/WebCore:

This brings us up to spec with respect to when it's ok to call
cursor.continue() and the various behaviors around it:

If you call it more than once, continue() throws an exception.

The values of key/primaryKey/value are consistent, whether or not
continue has been called, meaning that if continue() results in
data being loaded from the backing store, that data does not
affect the cursor until the success callback has completed.

Calls to update() and delete() can happen before continue(), but
not afterwards.

Test: storage/indexeddb/cursor-continue-validity.html

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::key):
(WebCore::IDBCursor::primaryKey):
(WebCore::IDBCursor::value):
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::deleteFunction):
(WebCore::IDBCursor::setGotValue):
(WebCore):
* Modules/indexeddb/IDBCursor.h:
(IDBCursor):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::dispatchEvent):

LayoutTests:

* storage/indexeddb/cursor-continue-validity-expected.txt: Added.
* storage/indexeddb/cursor-continue-validity.html: Added.
* storage/indexeddb/resources/cursor-continue-validity.js: Added.
* storage/indexeddb/resources/mozilla/cursors-expected.txt:
* storage/indexeddb/resources/shared.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/cursor-continue-validity-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/cursor-continue-validity.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/mozilla/cursors-expected.txt
LayoutTests/storage/indexeddb/mozilla/resources/cursors.js
LayoutTests/storage/indexeddb/resources/cursor-continue-validity.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/resources/shared.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCursor.cpp
Source/WebCore/Modules/indexeddb/IDBCursor.h
Source/WebCore/Modules/indexeddb/IDBRequest.cpp