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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WindowProxy.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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // clearForNavigation(). 85 // clearForNavigation().
86 DLOG_IF(FATAL, m_isGlobalObjectAttached) 86 DLOG_IF(FATAL, m_isGlobalObjectAttached)
87 << "Context not detached by calling clearForNavigation()"; 87 << "Context not detached by calling clearForNavigation()";
88 88
89 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate); 89 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate);
90 m_globalProxy.clear(); 90 m_globalProxy.clear();
91 return global; 91 return global;
92 } 92 }
93 93
94 void WindowProxy::setGlobal(v8::Local<v8::Object> global) { 94 void WindowProxy::setGlobal(v8::Local<v8::Object> global) {
95 CHECK(m_globalProxy.isEmpty());
95 m_globalProxy.set(m_isolate, global); 96 m_globalProxy.set(m_isolate, global);
96 97
97 // Initialize the window proxy now, to re-establish the connection between 98 // Initialize the window proxy now, to re-establish the connection between
98 // the global object and the v8::Context. This is really only needed for a 99 // the global object and the v8::Context. This is really only needed for a
99 // RemoteDOMWindow, since it has no scripting environment of its own. 100 // RemoteDOMWindow, since it has no scripting environment of its own.
100 // Without this, existing script references to a swapped in RemoteDOMWindow 101 // Without this, existing script references to a swapped in RemoteDOMWindow
101 // would be broken until that RemoteDOMWindow was vended again through an 102 // would be broken until that RemoteDOMWindow was vended again through an
102 // interface like window.frames. 103 // interface like window.frames.
103 initializeIfNeeded(); 104 initializeIfNeeded();
104 } 105 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // it won't be able to reach the outer window via its global object. 141 // it won't be able to reach the outer window via its global object.
141 void WindowProxy::initializeIfNeeded() { 142 void WindowProxy::initializeIfNeeded() {
142 // TODO(haraken): It is wrong to re-initialize an already detached window 143 // TODO(haraken): It is wrong to re-initialize an already detached window
143 // proxy. This must be 'if(m_lifecycle == Lifecycle::ContextUninitialized)'. 144 // proxy. This must be 'if(m_lifecycle == Lifecycle::ContextUninitialized)'.
144 if (m_lifecycle != Lifecycle::ContextInitialized) { 145 if (m_lifecycle != Lifecycle::ContextInitialized) {
145 initialize(); 146 initialize();
146 } 147 }
147 } 148 }
148 149
149 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698