Bug 92562 - IndexedDB: IDBCursor.continue(key) does not throw for key "behind" cursor
Summary: IndexedDB: IDBCursor.continue(key) does not throw for key "behind" cursor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joshua Bell
URL:
Keywords:
Depends on:
Blocks: 85513
  Show dependency treegraph
 
Reported: 2012-07-27 17:02 PDT by Joshua Bell
Modified: 2012-08-01 13:21 PDT (History)
7 users (show)

See Also:


Attachments
Patch (10.43 KB, patch)
2012-07-27 17:08 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (12.27 KB, patch)
2012-07-27 17:16 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (15.91 KB, patch)
2012-08-01 10:26 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bell 2012-07-27 17:02:15 PDT
IndexedDB: IDBCursor.continue(key) does not throw for out of range key
Comment 1 Joshua Bell 2012-07-27 17:08:54 PDT
Created attachment 155090 [details]
Patch
Comment 2 Joshua Bell 2012-07-27 17:11:32 PDT
I found this while looking at our exception coverage for http://webkit.org/b/85513

dgrogan@, alecflett@ - please take a look.
Comment 3 Joshua Bell 2012-07-27 17:12:24 PDT
Comment on attachment 155090 [details]
Patch

Whoops, forgot expectations.
Comment 4 Joshua Bell 2012-07-27 17:16:28 PDT
Created attachment 155092 [details]
Patch
Comment 5 Joshua Bell 2012-07-27 17:16:57 PDT
Updated patch has expectations and removes some LOG_ERROR lines I left in.
Comment 6 Joshua Bell 2012-07-30 16:05:44 PDT
(In reply to comment #2)
> I found this while looking at our exception coverage for http://webkit.org/b/85513
> 
> dgrogan@, alecflett@ - please take a look.

Ping?
Comment 7 David Grogan 2012-07-30 16:16:24 PDT
Comment on attachment 155092 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155092&action=review

LGTM

> Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp:45
> +IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore)

I'm guessing IDBCursor::Direction is still used by IDBCursorBackendProxy?

> LayoutTests/storage/indexeddb/resources/cursor-continue-dir.js:55
> +        request.onsuccess = null;

What's going on with the request.onsuccess = null lines?
Comment 8 Joshua Bell 2012-07-30 16:24:34 PDT
Comment on attachment 155092 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=155092&action=review

>> Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp:45
>> +IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, IDBCursor::Direction, CursorType cursorType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore)
> 
> I'm guessing IDBCursor::Direction is still used by IDBCursorBackendProxy?

No, it could be removed. (I rushed this patch a bit since it was a regression and I was headed out.) The direction is passed through to the IDBBackingStore::Cursor creation during the openCursor call, and the backend cursor is passed in here. Turns out the IDBCursorBackend* no longer needs to know about the direction at all. I can remove it. (I'll post an updated patch on Wednesday.)

>> LayoutTests/storage/indexeddb/resources/cursor-continue-dir.js:55
>> +        request.onsuccess = null;
> 
> What's going on with the request.onsuccess = null lines?

Debugging residue, I'll remove them. (Before fixing the bug the cursor.continue() call was not throwing, so the test would infinite-loop if the success handler was still around.)
Comment 9 Alec Flett 2012-07-31 09:21:43 PDT
in another patch, I'm making progress towards replacing the 'unsigned short' directions with IDBCursor::Direction, so definitely don't remove it! My intention is that for direction, either you're using the string ("next") or the enum, (and the string quickly gets transformed into the enum) but not the unsigned short.

But this LGTM to me as well - makes me wonder what else we can rip out of the cursor backend, since it sounds like the backing store is doing most of the work.
Comment 10 Joshua Bell 2012-08-01 09:32:57 PDT
(In reply to comment #9)
> in another patch, I'm making progress towards replacing the 'unsigned short' directions with IDBCursor::Direction, so definitely don't remove it! 

We're just talking about removing it from the IDBCursorBackendImpl constructor - that's not a problem, is it?

> But this LGTM to me as well - makes me wonder what else we can rip out of the cursor backend, since it sounds like the backing store is doing most of the work.

It's pretty slim at this point. Most of the code is boilerplate or prefetching.

I think some of the deleteFunction() checks can turn into ASSERTs but I'll leave that for later.
Comment 11 Alec Flett 2012-08-01 10:05:57 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > in another patch, I'm making progress towards replacing the 'unsigned short' directions with IDBCursor::Direction, so definitely don't remove it! 
> 
> We're just talking about removing it from the IDBCursorBackendImpl constructor - that's not a problem, is it?

Nope...I just mean don't remove the enum itself in the process of cleaning this up..
Comment 12 Joshua Bell 2012-08-01 10:26:08 PDT
Created attachment 155832 [details]
Patch
Comment 13 Joshua Bell 2012-08-01 10:27:28 PDT
Latest patch addresses dgrogan@'s comments - the unused direction argument to the IDBCursorBackendImpl is removed, and the unnecessary event handler clearing is removed.

tony@ (or others) - r? cq?
Comment 14 Joshua Bell 2012-08-01 11:40:59 PDT
Oops, tony@ is unavailable.

ojan@, abarth@, eric@ - r? cq?
Comment 15 Ojan Vafai 2012-08-01 12:28:08 PDT
Comment on attachment 155832 [details]
Patch

rs=me
Comment 16 WebKit Review Bot 2012-08-01 13:21:09 PDT
Comment on attachment 155832 [details]
Patch

Clearing flags on attachment: 155832

Committed r124361: <http://trac.webkit.org/changeset/124361>
Comment 17 WebKit Review Bot 2012-08-01 13:21:14 PDT
All reviewed patches have been landed.  Closing bug.