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

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

Issue 2617733004: binding: Changes the association among global-proxy/global/window-instance. (Closed)
Patch Set: Fixed Document.defaultView Created 3 years, 11 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/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 b750f2657faee14354032ea38feadde1dac1085d..30be01c92370a74aa2945ff2208baeb12eca5ec4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp
@@ -204,6 +204,18 @@ void WindowProxy::setupWindowPrototypeChain() {
// object is created together with a new v8::Context, but the global proxy
// object doesn't change.
// [3] WindowProperties is a named properties object of Window interface.
+ //
+ // Note that the wrapper object of a DOMWindow is the global proxy object, not
+ // the global object, although both of them have the internal field which
+ // points to the DOMWindow. Since the global proxy object remains the same
+ // while navigations, the management of the wrapper association for DOMWindow
+ // is special compared to other objects. See DOMWindow::~DOMWindow for the
+ // need of dissociation of the wrappers from DOMWindow instance.
+ //
+ // global proxy object <====> DOMWindow instance
+ // ^
+ // |
+ // global object --------+
DOMWindow* window = m_frame->domWindow();
const WrapperTypeInfo* wrapperTypeInfo = window->wrapperTypeInfo();
@@ -212,7 +224,10 @@ void WindowProxy::setupWindowPrototypeChain() {
// The global proxy object. Note this is not the global object.
v8::Local<v8::Object> globalProxy = context->Global();
CHECK(m_globalProxy == globalProxy);
- V8DOMWrapper::setNativeInfo(m_isolate, globalProxy, wrapperTypeInfo, window);
+ v8::Local<v8::Object> associatedWrapper =
+ V8DOMWrapper::associateObjectWithWrapper(
+ m_isolate, window, wrapperTypeInfo, globalProxy);
+ CHECK(globalProxy == associatedWrapper);
// Mark the handle to be traced by Oilpan, since the global proxy has a
// reference to the DOMWindow.
m_globalProxy.get().SetWrapperClassId(wrapperTypeInfo->wrapperClassId);
@@ -220,8 +235,8 @@ void WindowProxy::setupWindowPrototypeChain() {
// The global object, aka window wrapper object.
v8::Local<v8::Object> windowWrapper =
globalProxy->GetPrototype().As<v8::Object>();
- windowWrapper = V8DOMWrapper::associateObjectWithWrapper(
- m_isolate, window, wrapperTypeInfo, windowWrapper);
+ V8DOMWrapper::setNativeInfo(m_isolate, windowWrapper, wrapperTypeInfo,
+ window);
// The prototype object of Window interface.
v8::Local<v8::Object> windowPrototype =

Powered by Google App Engine
This is Rietveld 408576698