ondisconnect event not always fired for ephemeral USB devices |
||
Issue descriptionChrome Version: 61.0.3135.4 OS: Linux What steps will reproduce the problem? (1) Open the page info dropdown so that the UsbChooserContext is initialized first. (2) Connect a USB device which will be ephemeral (has no serial number). (3) Grant a site permission to access this device. (4) Disconnect the device. What is the expected result? An 'ondisconnect' event should be fired on the navigator.usb object when the device is disconnected. What happens instead? No event is fired. Original report: https://stackoverflow.com/questions/44766310/webusb-api-addeventlistener-disconnect-not-triggering
,
Jun 28 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4ea659fef8324b9da33daf7895ed8b265618d17e commit 4ea659fef8324b9da33daf7895ed8b265618d17e Author: Reilly Grant <reillyg@chromium.org> Date: Wed Jun 28 20:01:08 2017 Use OnDeviceRemovedCleanup to clear ephemeral WebUSB permissions Since an ephemeral permission is revoked when the device is disconnected we must be careful to generate the device removal events before revoking the permission or else no context will have permission to receive them. The UsbService::Observer::OnDeviceRemovedCleanup function was added to solve this problem for the chrome.usb API and the same issue exists for the WebUSB API. Bug: 737321 Change-Id: I3c38c05115c46e59079fdf1ea1ca3711931ea3ef Reviewed-on: https://chromium-review.googlesource.com/551196 Reviewed-by: Vincent Scheib <scheib@chromium.org> Commit-Queue: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#483107} [modify] https://crrev.com/4ea659fef8324b9da33daf7895ed8b265618d17e/chrome/browser/usb/usb_browsertest.cc [modify] https://crrev.com/4ea659fef8324b9da33daf7895ed8b265618d17e/chrome/browser/usb/usb_chooser_context.cc [modify] https://crrev.com/4ea659fef8324b9da33daf7895ed8b265618d17e/chrome/browser/usb/usb_chooser_context.h
,
Jun 28 2017
,
Jun 29 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by reillyg@chromium.org
, Jun 28 2017