See https://github.com/WebBluetoothCG/web-bluetooth/pull/273 and issue 654687 .
After a device has been disconnected, all objects that refer to services, characteristics, descriptors should have methods return an InvalidStateError. Spec describing what to do upon disconnection: https://webbluetoothcg.github.io/web-bluetooth/#disconnection-events Spec describing throwing the error upon navigating objects: https://webbluetoothcg.github.io/web-bluetooth/#navigating-bluetooth-hierarchy Source conversations: See https://github.com/WebBluetoothCG/web-bluetooth/pull/273 and issue 654687 .
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/344468c89036d7eff858c39c7fbb0e360f0ea71e commit 344468c89036d7eff858c39c7fbb0e360f0ea71e Author: ortuno <ortuno@chromium.org> Date: Mon Nov 07 01:17:23 2016 bluetooth: Invalidate services upon disconnection Remove services from attribute instance map when a device disconnects or when disconnect is called. Check that the service is in the attribute instance map and reject if it isn't. Small refactor of disconnect() and dispatchGattServerDisconnected() to more closely match the spec. BUG= 654950 Review-Url: https://codereview.chromium.org/2478013002 Cr-Commit-Position: refs/heads/master@{#430206} [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-device-disconnects-invalidates-objects.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-disconnect-invalidates-objects.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-get-different-service-after-reconnection.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects-with-uuid.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-disconnect-invalidates-objects-with-uuid.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-disconnect-invalidates-objects.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-get-different-service-after-reconnection-with-uuid.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-get-different-service-after-reconnection.html [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-device-disconnects-invalidates-objects.js [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-disconnect-invalidates-objects.js [add] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp [modify] https://crrev.com/344468c89036d7eff858c39c7fbb0e360f0ea71e/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/35b0cbff31387ff3b69607850f5ccfe99e2d4817 commit 35b0cbff31387ff3b69607850f5ccfe99e2d4817 Author: ortuno <ortuno@chromium.org> Date: Wed Nov 09 00:26:53 2016 bluetooth: Invalidate characteristics when disconnecting Remove characteristics from attribute instance map when a device disconnects or when disconnect is called. Check that the characteristic is in the attribute instance map and reject if it isn't. BUG= 654950 Review-Url: https://codereview.chromium.org/2476173002 Cr-Commit-Position: refs/heads/master@{#430788} [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-disconnect-invalidates-objects.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects-with-uuid.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-disconnect-invalidates-objects-with-uuid.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-disconnect-invalidates-objects.html [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic-device-disconnects-invalidates-objects.js [add] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic-disconnect-invalidates-objects.js [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.cpp [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h [modify] https://crrev.com/35b0cbff31387ff3b69607850f5ccfe99e2d4817/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp
Comment 1 by scheib@chromium.org
, Oct 18 2016