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

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

Issue 2769803003: v8binding: Initializes WindowProxy iff it's uninitialized. (Closed)
Patch Set: Addressed review comments. Created 3 years, 9 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/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..fb61768494628907a9f6b5dff9b07de1e9c2abec 100644
--- a/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp
@@ -50,7 +50,7 @@ RemoteWindowProxy::RemoteWindowProxy(v8::Isolate* isolate,
: WindowProxy(isolate, frame, std::move(world)) {}
void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) {
- if (m_lifecycle != Lifecycle::ContextInitialized)
+ if (m_lifecycle != Lifecycle::ContextIsInitialized)
return;
if (behavior == DetachGlobal && !m_globalProxy.isEmpty()) {
@@ -61,8 +61,9 @@ void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) {
#endif
}
- DCHECK(m_lifecycle == Lifecycle::ContextInitialized);
- m_lifecycle = Lifecycle::ContextDetached;
+ DCHECK_EQ(m_lifecycle, Lifecycle::ContextIsInitialized);
+ m_lifecycle = behavior == DetachGlobal ? Lifecycle::GlobalObjectIsDetached
+ : Lifecycle::FrameIsDetached;
}
void RemoteWindowProxy::initialize() {
@@ -101,10 +102,9 @@ 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);
- m_lifecycle = Lifecycle::ContextInitialized;
+ DCHECK(m_lifecycle == Lifecycle::ContextIsUninitialized ||
+ m_lifecycle == Lifecycle::GlobalObjectIsDetached);
+ m_lifecycle = Lifecycle::ContextIsInitialized;
}
void RemoteWindowProxy::setupWindowPrototypeChain() {

Powered by Google App Engine
This is Rietveld 408576698