Use real unions in IndexedDB WebIDL

RESOLVED FIXED in mozilla26

Status

()

Core
DOM: IndexedDB
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: khuey, Assigned: khuey)

Tracking

unspecified
mozilla26
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 792344 [details] [diff] [review]
Patch

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
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.