Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 m_mainWorldContextCreated = true; | 98 m_mainWorldContextCreated = true; |
| 99 | 99 |
| 100 if (!m_enabled) | 100 if (!m_enabled) |
| 101 return; | 101 return; |
| 102 ASSERT(m_frontend); | 102 ASSERT(m_frontend); |
| 103 | 103 |
| 104 if (frame == m_inspectedPage->mainFrame()) { | 104 if (frame == m_inspectedPage->mainFrame()) { |
| 105 m_scriptStateToId.clear(); | 105 m_scriptStateToId.clear(); |
| 106 m_frontend->executionContextsCleared(); | 106 m_frontend->executionContextsCleared(); |
| 107 } | 107 } |
| 108 if (!frame->script().initializeMainWorld()) { | |
|
aandrey
2014/10/29 15:18:50
I don't think we should initialize main world from
eustas
2014/10/30 10:08:04
Actually, we need to initialize main world sooner
| |
| 109 // Reusing existing context. | |
| 110 String frameId = m_pageAgent->frameId(frame); | |
| 111 addExecutionContextToFrontend(ScriptState::forMainWorld(frame), true, "" , frameId); | |
| 112 } | |
| 113 } | |
| 114 | |
| 115 void PageRuntimeAgent::didCreateMainWorldContext(LocalFrame* frame, ScriptState* scriptState, SecurityOrigin* origin) | |
| 116 { | |
| 117 if (!m_enabled) | |
| 118 return; | |
| 119 ASSERT(m_frontend); | |
| 108 String frameId = m_pageAgent->frameId(frame); | 120 String frameId = m_pageAgent->frameId(frame); |
| 109 addExecutionContextToFrontend(ScriptState::forMainWorld(frame), true, "", fr ameId); | 121 addExecutionContextToFrontend(scriptState, true, origin->toRawString(), fram eId); |
| 110 } | 122 } |
| 111 | 123 |
| 112 void PageRuntimeAgent::didCreateIsolatedContext(LocalFrame* frame, ScriptState* scriptState, SecurityOrigin* origin) | 124 void PageRuntimeAgent::didCreateIsolatedContext(LocalFrame* frame, ScriptState* scriptState, SecurityOrigin* origin) |
| 113 { | 125 { |
| 114 if (!m_enabled) | 126 if (!m_enabled) |
| 115 return; | 127 return; |
| 116 ASSERT(m_frontend); | 128 ASSERT(m_frontend); |
| 117 String frameId = m_pageAgent->frameId(frame); | 129 String frameId = m_pageAgent->frameId(frame); |
| 118 addExecutionContextToFrontend(scriptState, false, origin->toRawString(), fra meId); | 130 addExecutionContextToFrontend(scriptState, false, origin->toRawString(), fra meId); |
| 119 } | 131 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 scriptStatesToRemove.append(scriptState); | 186 scriptStatesToRemove.append(scriptState); |
| 175 m_frontend->executionContextDestroyed(it->value); | 187 m_frontend->executionContextDestroyed(it->value); |
| 176 } | 188 } |
| 177 } | 189 } |
| 178 m_scriptStateToId.removeAll(scriptStatesToRemove); | 190 m_scriptStateToId.removeAll(scriptStatesToRemove); |
| 179 injectedScriptManager()->discardInjectedScriptsFor(window); | 191 injectedScriptManager()->discardInjectedScriptsFor(window); |
| 180 } | 192 } |
| 181 | 193 |
| 182 } // namespace blink | 194 } // namespace blink |
| 183 | 195 |
| OLD | NEW |