Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp

Issue 2811943003: v8binding: Makes WindowProxy::global_proxy_ a weak reference when detached. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698