New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 737321 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

ondisconnect event not always fired for ephemeral USB devices

Project Member Reported by reillyg@chromium.org, Jun 28 2017

Issue description

Chrome 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
 
Description: Show this description
Project Member

Comment 2 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)
Cc: sandeepkumars@chromium.org
 Issue 737194  has been merged into this issue.

Sign in to add a comment