Closed Bug 615269 Opened 9 years ago Closed 9 years ago

IndexedDB: Cursors should not copy all results before iterating

Categories

(Core :: DOM: IndexedDB, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: bent.mozilla, Assigned: bent.mozilla)

Details

Attachments

(2 files, 1 obsolete file)

Attached patch Patch, v1 (obsolete) — Splinter Review
Patch attached, also makes |cursor.continue| not return a useless boolean.
Attachment #493723 - Flags: review?(jonas)
blocking2.0: --- → ?
OS: Mac OS X → All
Comment on attachment 493723 [details] [diff] [review]
Patch, v1

Oops, this isn't quite ready yet.
Attachment #493723 - Attachment is obsolete: true
Attachment #493723 - Flags: review?(jonas)
Attached patch Patch, v2Splinter Review
Yay!
Attachment #494808 - Flags: review?(jonas)
blocking2.0: ? → betaN+
Personally I would just do the simple thing though.
(In reply to comment #3)
> Personally I would just do the simple thing though.

I'm hoping there was more to that comment than that ;)
Sorry, comment 3 was meant for a different bug.
Comment on attachment 494808 [details] [diff] [review]
Patch, v2

> IDBCursor::Continue(const jsval &aKey,
>+  if (key.IsUnset()) {
>+    key = mKey;
>+  }

The current key handling is very complicated. Rewrite to either of the solutions we talked about.

>+  else {
>+    switch (mDirection) {
>+      case nsIIDBCursor::NEXT:
>+      case nsIIDBCursor::NEXT_NO_DUPLICATE:
>+        if (key <= mKey) {
>+          return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
>+        }
>+        break;
> 
>+      case nsIIDBCursor::PREV:
>+      case nsIIDBCursor::PREV_NO_DUPLICATE:
>+        if (key >= mKey) {
>+          return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
>+        }
>+        break;
> 
>+      default:
>+        NS_NOTREACHED("Unknown direction type!");
>+    }


Simpler written as an if-statement.


Write tests for mutationgs.
Attachment #494808 - Flags: review?(jonas) → review-
Comment on attachment 496280 [details] [diff] [review]
Review fixes

r=me if you change mKey to only be used as the result of the query, not as the to-serach-for key.
Attachment #496280 - Flags: review?(jonas) → review+
http://hg.mozilla.org/mozilla-central/rev/50d960ec0809
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.