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

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

Issue 2741923002: Add CHECKs in WindowProxy initialization/detach to enforce invariants (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 : WindowProxy(isolate, frame, std::move(world)) {} 53 : WindowProxy(isolate, frame, std::move(world)) {}
54 54
55 void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) { 55 void RemoteWindowProxy::disposeContext(GlobalDetachmentBehavior behavior) {
56 if (m_lifecycle != Lifecycle::ContextInitialized) 56 if (m_lifecycle != Lifecycle::ContextInitialized)
57 return; 57 return;
58 58
59 if (behavior == DetachGlobal) { 59 if (behavior == DetachGlobal) {
60 v8::Local<v8::Context> context = m_scriptState->context(); 60 v8::Local<v8::Context> context = m_scriptState->context();
61 // Clean up state on the global proxy, which will be reused. 61 // Clean up state on the global proxy, which will be reused.
62 if (!m_globalProxy.isEmpty()) { 62 if (!m_globalProxy.isEmpty()) {
63 // TODO(yukishiino): This DCHECK failed on Canary (M57) and Dev (M56). 63 CHECK(m_globalProxy == context->Global());
64 // We need to figure out why m_globalProxy != context->Global(). 64 CHECK_EQ(toScriptWrappable(context->Global()),
65 DCHECK(m_globalProxy == context->Global()); 65 toScriptWrappable(
66 DCHECK_EQ(toScriptWrappable(context->Global()), 66 context->Global()->GetPrototype().As<v8::Object>()));
67 toScriptWrappable(
68 context->Global()->GetPrototype().As<v8::Object>()));
69 m_globalProxy.get().SetWrapperClassId(0); 67 m_globalProxy.get().SetWrapperClassId(0);
70 } 68 }
71 V8DOMWrapper::clearNativeInfo(isolate(), context->Global()); 69 V8DOMWrapper::clearNativeInfo(isolate(), context->Global());
72 m_scriptState->detachGlobalObject(); 70 m_scriptState->detachGlobalObject();
73 71
74 #if DCHECK_IS_ON() 72 #if DCHECK_IS_ON()
75 didDetachGlobalObject(); 73 didDetachGlobalObject();
76 #endif 74 #endif
77 } 75 }
78 76
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 171
174 // The named properties object of Window interface. 172 // The named properties object of Window interface.
175 v8::Local<v8::Object> windowProperties = 173 v8::Local<v8::Object> windowProperties =
176 windowPrototype->GetPrototype().As<v8::Object>(); 174 windowPrototype->GetPrototype().As<v8::Object>();
177 CHECK(!windowProperties.IsEmpty()); 175 CHECK(!windowProperties.IsEmpty());
178 V8DOMWrapper::setNativeInfo(isolate(), windowProperties, wrapperTypeInfo, 176 V8DOMWrapper::setNativeInfo(isolate(), windowProperties, wrapperTypeInfo,
179 window); 177 window);
180 } 178 }
181 179
182 } // namespace blink 180 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698