Skip to content

Commit

Permalink
Add [SecureContext] to additional WebUSB interfaces
Browse files Browse the repository at this point in the history
This change updates the WebUSB WebIDL files to match the recently merged
spec pull request #142 by hiding interfaces which aren't useful in
insecure contexts.

Change-Id: I98625b2634e452c775601525300672d9440ddbcc
Reviewed-on: https://chromium-review.googlesource.com/1137435
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576316}
  • Loading branch information
reillyeon authored and Chrome-bot committed Jul 19, 2018
1 parent 2b76cf7 commit 042ab47
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions webusb/insecure-context.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// META: global=sharedworker
'use strict';

test(() => {
assert_false(isSecureContext);
assert_false('usb' in navigator);
}, '"usb" should not be present on navigator in an insecure context.');

[
'USB', 'USBAlternateInterface', 'USBConfiguration', 'USBConnectionEvent',
'USBDevice', 'USBEndpoint', 'USBInterface', 'USBInTransferResult',
'USBOutTransferResult', 'USBIsochronousInTransferResult',
'USBIsochronousOutTransferResult', 'USBIsochronousInTransferPacket',
'USBIsochronousOutTransferPacket',
].forEach((symbol) => {
test(() => {
assert_false(isSecureContext);
assert_false(symbol in this)
}, '"' + symbol + '" should not be visible in an insecure context.');
});

done();

0 comments on commit 042ab47

Please sign in to comment.