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

Unified Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2693893007: binding: Changes the association among global-proxy/global/window-instance (2nd attempt). (Closed)
Patch Set: Fixed a typo in DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds. 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/core/frame/DOMWindow.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
index c3b074835ff443c04d96986b9ae2424d3e3d7be9..dadbe0fb0c54653b1853fa7a13173c8d3353ae8c 100644
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -39,23 +39,31 @@ DOMWindow::DOMWindow(Frame& frame)
DOMWindow::~DOMWindow() {
// The frame must be disconnected before finalization.
DCHECK(!frame_);
+
+ // Because the wrapper object of a DOMWindow is the global proxy, which may
+ // live much longer than the DOMWindow, we need to dissociate all wrappers
+ // for this instance.
+ DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds(this);
}
-v8::Local<v8::Object> DOMWindow::Wrap(v8::Isolate*,
+v8::Local<v8::Object> DOMWindow::Wrap(v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
- LOG(FATAL) << "DOMWindow must never be wrapped with wrap method. The "
- "wrappers must be created at WindowProxy::createContext() and "
- "setupWindowPrototypeChain().";
- return v8::Local<v8::Object>();
+ // Notice that we explicitly ignore |creation_context| because the DOMWindow
+ // has its own creation context.
+
+ // TODO(yukishiino): Make this function always return the non-empty handle
+ // even if the frame is detached because the global proxy must always exist
+ // per spec.
+ return window_proxy_manager_
+ ->GetWindowProxy(DOMWrapperWorld::Current(isolate))
+ ->GlobalProxyIfNotDetached();
}
v8::Local<v8::Object> DOMWindow::AssociateWithWrapper(
v8::Isolate*,
const WrapperTypeInfo*,
v8::Local<v8::Object> wrapper) {
- LOG(FATAL) << "DOMWindow must never be wrapped with wrap method. The "
- "wrappers must be created at WindowProxy::createContext() and "
- "setupWindowPrototypeChain().";
+ NOTREACHED();
return v8::Local<v8::Object>();
}
@@ -437,14 +445,6 @@ void DOMWindow::focus(ExecutionContext* context) {
true /* notifyEmbedder */);
}
-v8::Local<v8::Object> DOMWindow::GlobalProxy(DOMWrapperWorld& world) {
- // TODO(yukishiino): Make this function always return the non-empty handle
- // even if the frame is detached because the global proxy must always exist
- // per spec.
- return window_proxy_manager_->GetWindowProxy(world)
- ->GlobalProxyIfNotDetached();
-}
-
InputDeviceCapabilitiesConstants* DOMWindow::GetInputDeviceCapabilities() {
if (!input_capabilities_)
input_capabilities_ = new InputDeviceCapabilitiesConstants;
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698