Index: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp |
index bf10fc7e30a1b85b215487a2c3430d0a0857a05c..8b7079feca3c7c48c87d48fa7e42d0b9bdf4f792 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp |
@@ -106,6 +106,12 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status) { |
V8GCForContextDispose::Instance().NotifyContextDisposed( |
GetFrame()->IsMainFrame()); |
+ if (next_status == Lifecycle::kFrameIsDetached) { |
+ // The context's frame is detached from the DOM, so there shouldn't be a |
+ // strong reference to the context. |
+ global_proxy_.SetPhantom(); |
+ } |
+ |
DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); |
lifecycle_ = next_status; |
} |