Closed Bug 613083 Opened 14 years ago Closed 14 years ago

IndexedDB: Switch serialization format from JSON to structured clone bytestream

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set
normal

Tracking

()

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

People

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

References

Details

Attachments

(1 file)

We don't want to have to support JSON forever, let's just move to the structured clone bytestream format.
Agreed. Let's do this before we ship Firefox 4.
blocking2.0: --- → betaN+
Note that we need to bake in the structured clone version in every object store or db, somehow. That version number needs to be passed to the structured clone read functions.
blocking2.0: betaN+ → ---
(In reply to comment #2)
> Note that we need to bake in the structured clone version in every object store
> or db, somehow. That version number needs to be passed to the structured clone
> read functions.
Ben, did you mean to removing the blocking flag with this comment?
No :(
blocking2.0: --- → ?
Attached patch Patch, v1Splinter Review
Attachment #498180 - Flags: review?(jorendorff)
Attachment #498180 - Flags: review?(jonas)
Comment on attachment 498180 [details] [diff] [review]
Patch, v1

>@@ -408,19 +409,20 @@ IDBCursor::GetValue(JSContext* aCx,
>-    nsCOMPtr<nsIJSON> json(new nsJSON());
>-    rv = json->DecodeToJSVal(mValue, aCx, &mCachedValue);
>-    NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_DATA_CLONE_ERR);
>+    if (!mCloneBuffer.read(&mCachedValue, aCx)) {
>+      mCachedValue = JSVAL_VOID;
>+      return NS_ERROR_DOM_DATA_CLONE_ERR;
>+    }

Should you free the buffer-data after this to free up the memory as soon as possible. The buffer is never used again, right? 

r=me
Attachment #498180 - Flags: review?(jonas) → review+
I'm a fan of fixing this bug -- but I'm on vacation until the new year.
(In reply to comment #7)
> I'm a fan of fixing this bug -- but I'm on vacation until the new year.

Ok, thanks. I think I'll land it now since the changes to indexedDB are huge and the changes to jsapi are small (I only tweaked the JSAutoStructuredCloneBuffer class to accept more than one context). I'd still like your review, and we can file a followup if you want any changes.
http://hg.mozilla.org/mozilla-central/rev/1b1561128c5d
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment on attachment 498180 [details] [diff] [review]
Patch, v1

Mmm. r=me, but this API keeps getting uglier. Something's wrong. It would be nice to try and figure out what that is at some point.
Attachment #498180 - Flags: review?(jorendorff) → review+
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: