Chromium Code Reviews| Index: third_party/WebKit/Source/modules/sensor/Sensor.cpp |
| diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp |
| index 0a0ded64b3d126ed3e66cfde7491dc0d3b350ee7..5b6fe150d49867a0c44f2d40ed80f0fbcac022a2 100644 |
| --- a/third_party/WebKit/Source/modules/sensor/Sensor.cpp |
| +++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp |
| @@ -13,6 +13,7 @@ |
| #include "modules/sensor/SensorPollingStrategy.h" |
| #include "modules/sensor/SensorProviderProxy.h" |
| #include "modules/sensor/SensorReading.h" |
| +#include "platform/UserGestureIndicator.h" |
| using namespace device::mojom::blink; |
| @@ -72,6 +73,14 @@ void Sensor::start(ScriptState* scriptState, ExceptionState& exceptionState) { |
| return; |
| } |
| + // If the algorithm is not allowed to show a popup, throw SecurityError. |
| + if (!UserGestureIndicator::consumeUserGesture()) { |
|
shalamov
2016/11/16 11:10:22
I have two comments for this line:
1. Since it do
riju_
2016/11/16 12:38:25
I am removing it now, as getting "sensor" informat
|
| + exceptionState.throwDOMException( |
| + SecurityError, |
| + "Must be handling a user gesture to show a permission request."); |
| + return; |
| + } |
| + |
| initSensorProxyIfNeeded(); |
| if (!m_sensorProxy) { |
| @@ -167,8 +176,8 @@ void Sensor::initSensorProxyIfNeeded() { |
| m_sensorProxy = provider->getSensor(m_type); |
| if (!m_sensorProxy) { |
| - m_sensorProxy = |
| - provider->createSensor(m_type, createSensorReadingFactory()); |
| + m_sensorProxy = provider->createSensor(m_type, getExecutionContext(), |
| + createSensorReadingFactory()); |
| } |
| } |