Index: Source/core/page/DOMWindow.cpp |
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp |
index ff194899cf521d8e9a25f984ee187ac152749ae6..f27269c1eb94d304405dd59f21aeff6a58889273 100644 |
--- a/Source/core/page/DOMWindow.cpp |
+++ b/Source/core/page/DOMWindow.cpp |
@@ -1530,8 +1530,8 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event |
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) |
addBeforeUnloadEventListener(this); |
else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatures::deviceMotionEnabled()) { |
- if (DeviceMotionController* controller = DeviceMotionController::from(page())) |
- controller->addDeviceEventListener(this); |
+ if (DeviceMotionController* controller = DeviceMotionController::from(document())) |
+ controller->startUpdating(); |
} else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) { |
if (DeviceOrientationController* controller = DeviceOrientationController::from(page())) |
controller->addDeviceEventListener(this); |
@@ -1557,8 +1557,8 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener |
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) |
removeBeforeUnloadEventListener(this); |
else if (eventType == eventNames().devicemotionEvent) { |
- if (DeviceMotionController* controller = DeviceMotionController::from(page())) |
- controller->removeDeviceEventListener(this); |
+ if (DeviceMotionController* controller = DeviceMotionController::from(document())) |
+ controller->stopUpdating(); |
} else if (eventType == eventNames().deviceorientationEvent) { |
if (DeviceOrientationController* controller = DeviceOrientationController::from(page())) |
controller->removeDeviceEventListener(this); |
@@ -1613,10 +1613,10 @@ void DOMWindow::removeAllEventListeners() |
{ |
EventTarget::removeAllEventListeners(); |
- if (DeviceMotionController* controller = DeviceMotionController::from(page())) |
- controller->removeAllDeviceEventListeners(this); |
+ if (DeviceMotionController* controller = DeviceMotionController::from(document())) |
+ controller->stopUpdating(); |
if (DeviceOrientationController* controller = DeviceOrientationController::from(page())) |
- controller->removeAllDeviceEventListeners(this); |
+ controller->removeDeviceEventListener(this); |
if (Document* document = this->document()) |
document->didRemoveEventTargetNode(document); |