Closed Bug 1152702 Opened 11 years ago Closed 11 years ago

[bluetooth2] Fix upper bound in ContiguousEnumSerializers for BluetoothStatus and BluetoothSspVariant

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox40 fixed)

RESOLVED FIXED
2.2 S10 (17apr)
Tracking Status
firefox40 --- fixed

People

(Reporter: yrliou, Assigned: yrliou)

Details

(Whiteboard: [webbt-api])

Attachments

(1 file, 1 obsolete file)

Currently we pass the last valid value in our enums into ContiguousEnumSerializers as the upper bound, which is incorrect. For example, we will hit |MOZ_ASSERT(EnumValidator::IsLegalValue(aValue))| if we try to send STATUS_RMT_DEV_DOWN through IPC. This bug is to add a NUM_* in these enums as the upper bound.
Whiteboard: [webbt-api]
Hi Thomas, Could you help review my patch? Thanks, Jocelyn
Attachment #8590163 - Flags: review?(tzimmermann)
Comment on attachment 8590163 [details] [diff] [review] Bug 1152702 - Fix upper bounds of ContiguousEnumSerializer for BluetoothStatus and BluetoothSspVariant. Review of attachment 8590163 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth2/BluetoothCommon.h @@ +238,5 @@ > STATUS_PARM_INVALID, > STATUS_UNHANDLED, > STATUS_AUTH_FAILURE, > + STATUS_RMT_DEV_DOWN, > + NUM_STATUS I don't know the plural of 'status'. @@ +281,5 @@ > SSP_VARIANT_PASSKEY_CONFIRMATION, > SSP_VARIANT_PASSKEY_ENTRY, > SSP_VARIANT_CONSENT, > + SSP_VARIANT_PASSKEY_NOTIFICATION, > + NUM_SSP_VARIANT Maybe call it 'NUM_SSP_VARIANTS' @@ +449,5 @@ > enum BluetoothObjectType { > TYPE_MANAGER = 0, > TYPE_ADAPTER = 1, > TYPE_DEVICE = 2, > + NUM_TYPE and 'NUM_TYPES'.
Attachment #8590163 - Flags: review?(tzimmermann) → review+
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #2) > Comment on attachment 8590163 [details] [diff] [review] > Bug 1152702 - Fix upper bounds of ContiguousEnumSerializer for > BluetoothStatus and BluetoothSspVariant. > > Review of attachment 8590163 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/bluetooth2/BluetoothCommon.h > @@ +238,5 @@ > > STATUS_PARM_INVALID, > > STATUS_UNHANDLED, > > STATUS_AUTH_FAILURE, > > + STATUS_RMT_DEV_DOWN, > > + NUM_STATUS > > I don't know the plural of 'status'. > > @@ +281,5 @@ > > SSP_VARIANT_PASSKEY_CONFIRMATION, > > SSP_VARIANT_PASSKEY_ENTRY, > > SSP_VARIANT_CONSENT, > > + SSP_VARIANT_PASSKEY_NOTIFICATION, > > + NUM_SSP_VARIANT > > Maybe call it 'NUM_SSP_VARIANTS' > > @@ +449,5 @@ > > enum BluetoothObjectType { > > TYPE_MANAGER = 0, > > TYPE_ADAPTER = 1, > > TYPE_DEVICE = 2, > > + NUM_TYPE > > and 'NUM_TYPES'. Hi Thomas, I'm not sure that we should use plural nouns here. According to the comment of ContiguousEnumSerializer[1], it looks like we shouldn't use plural nouns? [1] https://dxr.mozilla.org/mozilla-central/source/ipc/glue/IPCMessageUtils.h#164 Thanks, Jocelyn
Flags: needinfo?(tzimmermann)
Oh, OK. No problem.
Flags: needinfo?(tzimmermann)
Keywords: checkin-needed
No try server result since dom/bluetooth/bluetooth2 won't be built.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S10 (17apr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: