bluetooth: Set device to null should stop notifications |
||
Issue descriptionGoogle 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.
,
Oct 18 2016
jyasskin is right here. You did set to the device to null but you also attached an event which will keep the object alive.
,
Oct 19 2016
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 |
||
Comment 1 by jyasskin@chromium.org
, Oct 18 2016