Closed Bug 906812 Opened 11 years ago Closed 11 years ago

Use real unions in IndexedDB WebIDL

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: khuey, Assigned: khuey)

References

Details

Attachments

(1 file)

Attached patch Patch (deleted) — Splinter Review
Now that we've converted everything we don't need to use nsISupports anymore.
Attachment #792344 - Flags: review?(jonas)
Comment on attachment 792344 [details] [diff] [review]
Patch

Review of attachment 792344 [details] [diff] [review]:
-----------------------------------------------------------------

\o/

::: dom/indexedDB/IDBRequest.cpp
@@ +120,5 @@
> +void
> +IDBRequest::AssertSourceIsCorrect() const
> +{
> +  // At most one of mSourceAs* is allowed to be non-null.  Check that by
> +  // summing the negation of each one and asserting the sum is at least 2.

I'd probably assert !!x + !!y + !!z <= 1

@@ +122,5 @@
> +{
> +  // At most one of mSourceAs* is allowed to be non-null.  Check that by
> +  // summing the negation of each one and asserting the sum is at least 2.
> +
> +  unsigned sources = !mSourceAsObjectStore + !mSourceAsIndex + !mSourceAsCursor;

Unused variable warning in opt builds

@@ +126,5 @@
> +  unsigned sources = !mSourceAsObjectStore + !mSourceAsIndex + !mSourceAsCursor;
> +  MOZ_ASSERT(sources >= 2);
> +}
> +
> +void 

Trailing ws
Comment on attachment 792344 [details] [diff] [review]
Patch

Review of attachment 792344 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/indexedDB/IDBRequest.cpp
@@ +87,5 @@
> +  nsRefPtr<IDBRequest> request = Create(aOwnerCache, aTransaction);
> +
> +  request->mSourceAsObjectStore = aSourceAsObjectStore;
> +
> +  return request.forget();

I'd inline these puppies in the header file

@@ +117,5 @@
> +  return request.forget();
> +}
> +
> +void
> +IDBRequest::AssertSourceIsCorrect() const

Make this whole function #ifdef DEBUG

@@ +123,5 @@
> +  // At most one of mSourceAs* is allowed to be non-null.  Check that by
> +  // summing the negation of each one and asserting the sum is at least 2.
> +
> +  unsigned sources = !mSourceAsObjectStore + !mSourceAsIndex + !mSourceAsCursor;
> +  MOZ_ASSERT(sources >= 2);

And I agree with ms2ger about checking for <= 1 instead.
Attachment #792344 - Flags: review?(jonas) → review+
https://hg.mozilla.org/mozilla-central/rev/d3e6b1baf02e
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: