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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 m_v8DebuggerAgent->reset(); | 130 m_v8DebuggerAgent->reset(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, int executionContextId, T ypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDe tails) | 133 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, int executionContextId, T ypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDe tails) |
| 134 { | 134 { |
| 135 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); | 135 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); |
| 136 if (!injectedScript) { | 136 if (!injectedScript) { |
| 137 *errorString = "Inspected frame has gone"; | 137 *errorString = "Inspected frame has gone"; |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 ExecutionContext* executionContext = injectedScript->scriptState()->executio nContext(); | 140 v8::HandleScope handles(injectedScript->isolate()); |
| 141 ScriptState* scriptState = ScriptState::from(injectedScript->context()); | |
| 142 if (!scriptState) { | |
| 143 *errorString = "Inspected frame has gone"; | |
| 144 return; | |
| 145 } | |
| 146 | |
| 147 ExecutionContext* executionContext = scriptState->executionContext(); | |
|
dgozman
2016/01/27 22:05:47
toExecutionContext(injectedScript->context())
pfeldman
2016/01/27 22:15:45
Done.
| |
| 141 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() ); | 148 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() ); |
| 142 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails); | 149 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails); |
| 143 if (!scriptId->isAssigned()) | 150 if (!scriptId->isAssigned()) |
| 144 return; | 151 return; |
| 145 | 152 |
| 146 String scriptIdValue = scriptId->getValue(); | 153 String scriptIdValue = scriptId->getValue(); |
| 147 if (!scriptIdValue.isEmpty()) | 154 if (!scriptIdValue.isEmpty()) |
| 148 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); | 155 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); |
| 149 } | 156 } |
| 150 | 157 |
| 151 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<Exce ptionDetails>& exceptionDetails) | 158 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<Exce ptionDetails>& exceptionDetails) |
| 152 { | 159 { |
| 153 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); | 160 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId); |
| 154 if (!injectedScript) { | 161 if (!injectedScript) { |
| 155 *errorString = "Inspected frame has gone"; | 162 *errorString = "Inspected frame has gone"; |
| 156 return; | 163 return; |
| 157 } | 164 } |
| 158 ExecutionContext* executionContext = injectedScript->scriptState()->executio nContext(); | 165 v8::HandleScope handles(injectedScript->isolate()); |
| 166 ScriptState* scriptState = ScriptState::from(injectedScript->context()); | |
| 167 if (!scriptState) { | |
| 168 *errorString = "Inspected frame has gone"; | |
| 169 return; | |
| 170 } | |
| 159 | 171 |
| 172 ExecutionContext* executionContext = scriptState->executionContext(); | |
| 160 String sourceURL = m_compiledScriptURLs.take(scriptId); | 173 String sourceURL = m_compiledScriptURLs.take(scriptId); |
| 161 LocalFrame* frame = toDocument(executionContext)->frame(); | 174 LocalFrame* frame = toDocument(executionContext)->frame(); |
| 162 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition())); | 175 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition())); |
| 163 | 176 |
| 164 RefPtrWillBeRawPtr<LocalFrame> protect(frame); | 177 RefPtrWillBeRawPtr<LocalFrame> protect(frame); |
| 165 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); | 178 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); |
| 166 | 179 |
| 167 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); | 180 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); |
| 168 } | 181 } |
| 169 | 182 |
| 170 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |