Index: Source/modules/screen_orientation/ScreenOrientationController.cpp |
diff --git a/Source/modules/screen_orientation/ScreenOrientationController.cpp b/Source/modules/screen_orientation/ScreenOrientationController.cpp |
index 1c068bcd647e82b786134668b913f8a4797f99a8..6a354383f22bdb4b1e7969023375e74bb655d124 100644 |
--- a/Source/modules/screen_orientation/ScreenOrientationController.cpp |
+++ b/Source/modules/screen_orientation/ScreenOrientationController.cpp |
@@ -155,13 +155,17 @@ void ScreenOrientationController::setOrientation(ScreenOrientation* orientation) |
void ScreenOrientationController::lock(WebScreenOrientationLockType orientation, WebLockOrientationCallback* callback) |
{ |
- ASSERT(m_client); |
+ // When detached, the client is no longer valid. |
+ if (!m_client) |
+ return; |
m_client->lockOrientation(orientation, callback); |
} |
void ScreenOrientationController::unlock() |
{ |
- ASSERT(m_client); |
+ // When detached, the client is no longer valid. |
+ if (!m_client) |
+ return; |
m_client->unlockOrientation(); |
} |
@@ -192,6 +196,11 @@ bool ScreenOrientationController::hasLastData() |
return true; |
} |
+void ScreenOrientationController::willDetachFrameHost() |
+{ |
+ m_client = nullptr; |
+} |
+ |
void ScreenOrientationController::notifyDispatcher() |
{ |
if (m_orientation && page()->visibilityState() == PageVisibilityStateVisible) |