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

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

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Address feedback and fix cross-origin location set Created 4 years, 1 month 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 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>();

Powered by Google App Engine
This is Rietveld 408576698