| Index: Source/WebCore/page/DOMWindow.cpp
|
| diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
|
| index 475dabff48ed734ed75a5bf88e46a1636c9eff61..fc03b38782f178532c21070df6d2ad5b38b6ad61 100644
|
| --- a/Source/WebCore/page/DOMWindow.cpp
|
| +++ b/Source/WebCore/page/DOMWindow.cpp
|
| @@ -1622,7 +1622,8 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
|
| addBeforeUnloadEventListener(this);
|
| #if ENABLE(DEVICE_ORIENTATION)
|
| else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatures::deviceMotionEnabled()) {
|
| - DeviceMotionController::shared().addDeviceEventListener(this);
|
| + if (DeviceMotionController* controller = DeviceMotionController::from(page()))
|
| + controller->addDeviceEventListener(this);
|
| } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
|
| if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
|
| controller->addDeviceEventListener(this);
|
| @@ -1657,7 +1658,8 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
|
| removeBeforeUnloadEventListener(this);
|
| #if ENABLE(DEVICE_ORIENTATION)
|
| else if (eventType == eventNames().devicemotionEvent) {
|
| - DeviceMotionController::shared().removeDeviceEventListener(this);
|
| + if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
|
| + controller->removeDeviceEventListener(this);
|
| } else if (eventType == eventNames().deviceorientationEvent) {
|
| if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
|
| controller->removeDeviceEventListener(this);
|
| @@ -1721,7 +1723,8 @@ void DOMWindow::removeAllEventListeners()
|
| EventTarget::removeAllEventListeners();
|
|
|
| #if ENABLE(DEVICE_ORIENTATION)
|
| - DeviceMotionController::shared().removeAllDeviceEventListeners(this);
|
| + if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
|
| + controller->removeAllDeviceEventListeners(this);
|
| if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
|
| controller->removeAllDeviceEventListeners(this);
|
| #endif
|
|
|