Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
index a266f43d9b194bc884955d27c1c2187d10041e79..befadaa2f81e49ede2cf0e99227720701fd85fda 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
@@ -23,6 +23,7 @@ |
#include "modules/vr/VRStageParameters.h" |
#include "modules/webgl/WebGLRenderingContextBase.h" |
#include "platform/Histogram.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/UserGestureIndicator.h" |
#include "public/platform/Platform.h" |
#include "wtf/AutoReset.h" |
@@ -274,12 +275,15 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, |
} |
bool firstPresent = !m_isPresenting; |
+ bool gestureRequired = |
+ RuntimeEnabledFeatures::webVrRequiresUserGestureEnabled(); |
// Initiating VR presentation is only allowed in response to a user gesture. |
// If the VRDisplay is already presenting, however, repeated calls are |
// allowed outside a user gesture so that the presented content may be |
// updated. |
- if (firstPresent && !UserGestureIndicator::utilizeUserGesture()) { |
+ if (firstPresent && !UserGestureIndicator::utilizeUserGesture() && |
+ gestureRequired) { |
DOMException* exception = DOMException::create( |
InvalidStateError, "API can only be initiated by a user gesture."); |
resolver->reject(exception); |