Index: third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
index c60566d5abe83d86e490e13ef07d00382df0cc0e..dbd60210f791289c1072487ea3600eaded60d7ec 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp |
@@ -61,8 +61,9 @@ void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) { |
#endif |
} |
- DCHECK(m_lifecycle == Lifecycle::ContextInitialized); |
- m_lifecycle = Lifecycle::ContextDetached; |
+ DCHECK_EQ(m_lifecycle, Lifecycle::ContextInitialized); |
+ m_lifecycle = behavior == DetachGlobal ? Lifecycle::GlobalObjectDetached |
+ : Lifecycle::ContextDetachedFromFrame; |
} |
void RemoteWindowProxy::initialize() { |
@@ -101,9 +102,8 @@ void RemoteWindowProxy::createContext() { |
didAttachGlobalObject(); |
#endif |
- // TODO(haraken): Currently we cannot enable the following DCHECK because |
- // an already detached window proxy can be re-initialized. This is wrong. |
- // DCHECK(m_lifecycle == Lifecycle::ContextUninitialized); |
+ DCHECK(m_lifecycle == Lifecycle::ContextUninitialized || |
+ m_lifecycle == Lifecycle::GlobalObjectDetached); |
m_lifecycle = Lifecycle::ContextInitialized; |
} |