Index: third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp |
index edada54b4d3a554001d01677200f49bb29245970..54f009d4229a6de7acfe2bebeef19ad069e8f05d 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp |
@@ -115,8 +115,14 @@ void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) { |
m_document.clear(); |
- if (behavior == DetachGlobal) |
+ if (behavior == DetachGlobal) { |
+ // Clean up state on the global proxy, which will be reused. |
+ // TODO(dcheng): Check if this is needed. |
+ V8DOMWrapper::clearNativeInfo(m_isolate, context->Global()); |
+ DCHECK(m_globalProxy == m_scriptState->context()->Global()); |
+ m_globalProxy.get().SetWrapperClassId(0); |
m_scriptState->detachGlobalObject(); |
+ } |
m_scriptState->disposePerContextData(); |
@@ -366,6 +372,11 @@ bool WindowProxy::setupWindowPrototypeChain() { |
v8::Local<v8::Context> context = m_scriptState->context(); |
// The global proxy object. Note this is not the global object. |
v8::Local<v8::Object> globalProxy = context->Global(); |
+ V8DOMWrapper::setNativeInfo(m_isolate, globalProxy, wrapperTypeInfo, window); |
+ // Mark the handle to be traced by Oilpan, since the global proxy has a |
+ // reference to the DOMWindow. |
+ DCHECK(m_globalProxy == globalProxy); |
+ m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId); |
// The global object, aka window wrapper object. |
v8::Local<v8::Object> windowWrapper = |
globalProxy->GetPrototype().As<v8::Object>(); |