Index: Source/modules/websockets/NewWebSocketChannelImpl.h |
diff --git a/Source/modules/websockets/NewWebSocketChannelImpl.h b/Source/modules/websockets/NewWebSocketChannelImpl.h |
index 7364207bf23566ab37cd2c32ae56ded857561b8d..8a28eff6277e86c3f3093361174eb0c183958c06 100644 |
--- a/Source/modules/websockets/NewWebSocketChannelImpl.h |
+++ b/Source/modules/websockets/NewWebSocketChannelImpl.h |
@@ -149,8 +149,24 @@ private: |
void didFailLoadingBlob(FileError::ErrorCode); |
// LifecycleObserver functions. |
- // This object must be destroyed before the context. |
- virtual void contextDestroyed() OVERRIDE { ASSERT_NOT_REACHED(); } |
+ virtual void contextDestroyed() OVERRIDE |
+ { |
+#if ENABLE(OILPAN) |
+ // In oilpan we cannot assume this channel's finalizer has been called |
+ // before the document it is observing is dead and finalized since there |
+ // is no eager finalization. Instead the finalization happens at the |
+ // next GC which could be long enough after the Peer::destroy call for |
+ // the context (ie. Document) to be dead too. If the context's finalizer |
+ // is run first this method gets called. Instead we assert the channel |
+ // has been disconnected which happens in Peer::destroy. |
+ ASSERT(!m_handle); |
+ ASSERT(!m_client); |
+ ASSERT(!m_identifier); |
+#else |
+ // This object must be destroyed before the context. |
+ ASSERT_NOT_REACHED(); |
+#endif |
+ } |
// m_handle is a handle of the connection. |
// m_handle == 0 means this channel is closed. |