| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (m_lifecycle == Lifecycle::ContextInitialized) { | 73 if (m_lifecycle == Lifecycle::ContextInitialized) { |
| 74 DCHECK(m_scriptState->contextIsValid()); | 74 DCHECK(m_scriptState->contextIsValid()); |
| 75 DCHECK(m_globalProxy == m_scriptState->context()->Global()); | 75 DCHECK(m_globalProxy == m_scriptState->context()->Global()); |
| 76 return m_globalProxy.newLocal(m_isolate); | 76 return m_globalProxy.newLocal(m_isolate); |
| 77 } | 77 } |
| 78 return v8::Local<v8::Object>(); | 78 return v8::Local<v8::Object>(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 v8::Local<v8::Object> WindowProxy::releaseGlobal() { | 81 v8::Local<v8::Object> WindowProxy::releaseGlobal() { |
| 82 DCHECK(m_lifecycle != Lifecycle::ContextInitialized); | 82 DCHECK(m_lifecycle != Lifecycle::ContextInitialized); |
| 83 |
| 83 // Make sure the global object was detached from the proxy by calling | 84 // Make sure the global object was detached from the proxy by calling |
| 84 // clearForNavigation(). | 85 // clearForNavigation(). |
| 85 if (m_lifecycle == Lifecycle::ContextDetached) | 86 DLOG_IF(FATAL, m_isGlobalObjectAttached) |
| 86 ASSERT(m_scriptState->isGlobalObjectDetached()); | 87 << "Context not detached by calling clearForNavigation()"; |
| 87 | 88 |
| 88 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate); | 89 v8::Local<v8::Object> global = m_globalProxy.newLocal(m_isolate); |
| 89 m_globalProxy.clear(); | 90 m_globalProxy.clear(); |
| 90 return global; | 91 return global; |
| 91 } | 92 } |
| 92 | 93 |
| 93 void WindowProxy::setGlobal(v8::Local<v8::Object> global) { | 94 void WindowProxy::setGlobal(v8::Local<v8::Object> global) { |
| 94 m_globalProxy.set(m_isolate, global); | 95 m_globalProxy.set(m_isolate, global); |
| 95 | 96 |
| 96 // Initialize the window proxy now, to re-establish the connection between | 97 // Initialize the window proxy now, to re-establish the connection between |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // it won't be able to reach the outer window via its global object. | 140 // it won't be able to reach the outer window via its global object. |
| 140 void WindowProxy::initializeIfNeeded() { | 141 void WindowProxy::initializeIfNeeded() { |
| 141 // TODO(haraken): It is wrong to re-initialize an already detached window | 142 // TODO(haraken): It is wrong to re-initialize an already detached window |
| 142 // proxy. This must be 'if(m_lifecycle == Lifecycle::ContextUninitialized)'. | 143 // proxy. This must be 'if(m_lifecycle == Lifecycle::ContextUninitialized)'. |
| 143 if (m_lifecycle != Lifecycle::ContextInitialized) { | 144 if (m_lifecycle != Lifecycle::ContextInitialized) { |
| 144 initialize(); | 145 initialize(); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |