Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: third_party/WebKit/Source/modules/webusb/USB.cpp

Issue 2698083008: Make the navigator.usb attribute accessible only in secure contexts. (Closed)
Patch Set: Moved [NoInterfaceObject] change to a separate patch. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webusb/USB.cpp
diff --git a/third_party/WebKit/Source/modules/webusb/USB.cpp b/third_party/WebKit/Source/modules/webusb/USB.cpp
index e497d4b3367a44e26d131ec14ea016b96581eda3..a8a47780b37fcd4ac6a4e3a431fe90dade6d09de 100644
--- a/third_party/WebKit/Source/modules/webusb/USB.cpp
+++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -80,16 +80,11 @@ ScriptPromise USB::getDevices(ScriptState* scriptState) {
if (!m_deviceManager) {
resolver->reject(DOMException::create(NotSupportedError));
} else {
- String errorMessage;
- if (!scriptState->getExecutionContext()->isSecureContext(errorMessage)) {
- resolver->reject(DOMException::create(SecurityError, errorMessage));
- } else {
- m_deviceManagerRequests.insert(resolver);
- m_deviceManager->GetDevices(
- nullptr, convertToBaseCallback(WTF::bind(&USB::onGetDevices,
- wrapPersistent(this),
- wrapPersistent(resolver))));
- }
+ m_deviceManagerRequests.insert(resolver);
+ m_deviceManager->GetDevices(
+ nullptr, convertToBaseCallback(WTF::bind(&USB::onGetDevices,
+ wrapPersistent(this),
+ wrapPersistent(resolver))));
}
return promise;
}
@@ -116,10 +111,7 @@ ScriptPromise USB::requestDevice(ScriptState* scriptState,
wrapWeakPersistent(this))));
}
- String errorMessage;
- if (!executionContext->isSecureContext(errorMessage)) {
- resolver->reject(DOMException::create(SecurityError, errorMessage));
- } else if (!UserGestureIndicator::consumeUserGesture()) {
+ if (!UserGestureIndicator::consumeUserGesture()) {
resolver->reject(DOMException::create(
SecurityError,
"Must be handling a user gesture to show a permission request."));

Powered by Google App Engine
This is Rietveld 408576698