New issue
Advanced search Search tips

Issue 656967 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocking:
issue 471536



Sign in to add a comment

bluetooth: Set device to null should stop notifications

Project Member Reported by fbeaufort@chromium.org, Oct 18 2016

Issue description

Google Chrome	55.0.2883.7 (Official Build) dev (64-bit)
Platform	8872.6.0 (Official Build) dev-channel link

What steps will reproduce the problem?
(1) Go to https://googlechrome.github.io/samples/web-bluetooth/read-characteristic-value-changed.html
(2) Make sure a nearby Bluetooth device contains Battery Service 
(3) Click [Read Bluetooth Device's Battery Level] button
(4) Pick device, and click on [Start Notifications] button
(5) Notice some BLE notifications if they happen
(6) Click [Reset Bluetooth Device] button which sets to "null" the global "bluetoothDevice" JS object
(7) Trigger a notification from the Bluetoooth Device

What is the expected output?
The notification shouldn't show up in the web page as the Device has been invalidated.

What do you see instead?
A notification shows up.

Please note even it I specifically set to "null" the global "batteryLevelCharacteristic" JS object, I'm still seeing the notification.
 
This doesn't seem like a bug. There's an event listener attached to the characteristic object, and it keeps getting events even if there aren't other references to the characteristic. The same happens for any other EventTarget in the platform.

Comment 2 by ortuno@chromium.org, Oct 18 2016

Status: WontFix (was: Available)
jyasskin is right here. You did set to the device to null but you also attached an event which will keep the object alive.
I've updated our sample at https://github.com/GoogleChrome/samples/pull/433. You can try it at https://googlechrome.github.io/samples/web-bluetooth/read-characteristic-value-changed.html

For info, it used to work but not anymore because now a characteristic holds a reference to its service and the service holds a reference to the device.

Sign in to add a comment