OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |