If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Bluetooth warning: "NS_ENSURE_TRUE(aTypes.Length()) failed"

RESOLVED FIXED in Firefox 42

Status

Firefox OS
Bluetooth
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: tzimmermann, Assigned: btian)

Tracking

unspecified
FxOS-S4 (07Aug)
All
Gonk (Firefox OS)

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

I frequently see the following warnings on m-c. I think this started when we switched to v2.

> W/bt-btif ( 1496): info:x10
> D/        ( 1496): remote version info [c0:18:85:dc:d9:9f]: 6, f, 220e
> D/btif_config( 1496): btif_get_device_type: Device [c0:18:85:dc:d9:9f] type 1
> I/Gecko   ( 1163): [Child 1163] WARNING: NS_ENSURE_TRUE(aTypes.Length()) failed: file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluetooth2/Bluet
oothDevice.cpp, line 302
> I/Gecko   ( 1163): [Child 1163] WARNING: NS_ENSURE_TRUE(aTypes.Length()) failed: file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluetooth2/Bluet
oothDevice.cpp, line 302
(Assignee)

Comment 1

2 years ago
Created attachment 8640279 [details] [diff] [review]
Patch 1 (v1): Do not call |DispatchAttributeEvent| if no attribute changed

The warning cause is that bluetooth adapter/device calls |DispatchAttributeEvent| without ensuring changed attribute array is non-empty.

The patch skips calling |DispatchAttributeEvent| if the array is empty, and assert the array to dispatch is non-empty in |DispatchAttributeEvent|.
Assignee: nobody → btian
Attachment #8640279 - Flags: review?(joliu)
Comment on attachment 8640279 [details] [diff] [review]
Patch 1 (v1): Do not call |DispatchAttributeEvent| if no attribute changed

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

I'm worried about getting there in the first place. Maybe we should rather sort this out in |BluetoothServiceBluedroid|.
Comment on attachment 8640279 [details] [diff] [review]
Patch 1 (v1): Do not call |DispatchAttributeEvent| if no attribute changed

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

r=me after comments addressed, thanks!

::: dom/bluetooth/bluetooth2/BluetoothAdapter.cpp
@@ +1138,5 @@
>  
>  void
>  BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
>  {
> +  MOZ_ASSERT(!aTypes.IsEmpty());

Please indicate in the header file that we didn't allow passing empty array into this private function, thanks.

::: dom/bluetooth/bluetooth2/BluetoothDevice.cpp
@@ +303,5 @@
>  
>  void
>  BluetoothDevice::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
>  {
> +  MOZ_ASSERT(!aTypes.IsEmpty());

DITTO.
Attachment #8640279 - Flags: review?(joliu) → review+
(Assignee)

Comment 4

2 years ago
Created attachment 8640360 [details] [diff] [review]
[final] Patch 1: Do not call |DispatchAttributeEvent| if no attribute changed, r=joliu

try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1409ca954ad7
Attachment #8640279 - Attachment is obsolete: true

Comment 5

2 years ago
https://hg.mozilla.org/integration/b2g-inbound/rev/ac42019fb613
https://hg.mozilla.org/mozilla-central/rev/ac42019fb613
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox42: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S4 (07Aug)
You need to log in before you can comment on or make changes to this bug.