When firing null-events stop DeviceSensorEventController only after the event...

When firing null-events stop DeviceSensorEventController only after the event has propagated to window.

When no sensors are available chrome should fire an all-null event
into blink. However at the time of firing the active DOM objects
can be suspended or stopped, which can prohibit propagation of the
event to window. Currently the controller will be unregistered in
any case because the event is a null-event. This results in the
potential loss of null-events and the javascript callback is never
executed. To avoid this issue the firing of a null-event should
happen until it effectively propagates to window.

BUG=356750
TEST=http://jsbin.com/pivimoga/1/ (manual)
TEST=https://codereview.chromium.org/214763002/ (browsertest)

Review URL: https://codereview.chromium.org/212983007

git-svn-id: svn://svn.chromium.org/blink/trunk@170200 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e0d02532
......@@ -58,11 +58,11 @@ void DeviceSensorEventController::fireDeviceEvent(Timer<DeviceSensorEventControl
void DeviceSensorEventController::dispatchDeviceEvent(PassRefPtr<Event> prpEvent)
{
if (!m_document.domWindow() || m_document.activeDOMObjectsAreSuspended() || m_document.activeDOMObjectsAreStopped())
return;
RefPtr<Event> event = prpEvent;
if (m_document.domWindow()
&& !m_document.activeDOMObjectsAreSuspended()
&& !m_document.activeDOMObjectsAreStopped())
m_document.domWindow()->dispatchEvent(event);
m_document.domWindow()->dispatchEvent(event);
if (m_needsCheckingNullEvents) {
if (isNullEvent(event.get()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment