| 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 ExecutionContext* executionContext = toExecutionContext(injectedScript->cont
ext()); |
| 142 if (!executionContext) { |
| 143 *errorString = "Inspected frame has gone"; |
| 144 return; |
| 145 } |
| 146 |
| 141 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame()
); | 147 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame()
); |
| 142 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe
rsistScript, executionContextId, scriptId, exceptionDetails); | 148 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe
rsistScript, executionContextId, scriptId, exceptionDetails); |
| 143 if (!scriptId->isAssigned()) | 149 if (!scriptId->isAssigned()) |
| 144 return; | 150 return; |
| 145 | 151 |
| 146 String scriptIdValue = scriptId->getValue(); | 152 String scriptIdValue = scriptId->getValue(); |
| 147 if (!scriptIdValue.isEmpty()) | 153 if (!scriptIdValue.isEmpty()) |
| 148 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); | 154 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); |
| 149 } | 155 } |
| 150 | 156 |
| 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) | 157 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 { | 158 { |
| 153 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(executionContextId); | 159 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(executionContextId); |
| 154 if (!injectedScript) { | 160 if (!injectedScript) { |
| 155 *errorString = "Inspected frame has gone"; | 161 *errorString = "Inspected frame has gone"; |
| 156 return; | 162 return; |
| 157 } | 163 } |
| 158 ExecutionContext* executionContext = injectedScript->scriptState()->executio
nContext(); | 164 v8::HandleScope handles(injectedScript->isolate()); |
| 165 ExecutionContext* executionContext = toExecutionContext(injectedScript->cont
ext()); |
| 166 if (!executionContext) { |
| 167 *errorString = "Inspected frame has gone"; |
| 168 return; |
| 169 } |
| 159 | 170 |
| 160 String sourceURL = m_compiledScriptURLs.take(scriptId); | 171 String sourceURL = m_compiledScriptURLs.take(scriptId); |
| 161 LocalFrame* frame = toDocument(executionContext)->frame(); | 172 LocalFrame* frame = toDocument(executionContext)->frame(); |
| 162 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat
eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition())); | 173 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat
eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition())); |
| 163 | 174 |
| 164 RefPtrWillBeRawPtr<LocalFrame> protect(frame); | 175 RefPtrWillBeRawPtr<LocalFrame> protect(frame); |
| 165 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId,
objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); | 176 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId,
objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); |
| 166 | 177 |
| 167 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 178 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| 168 } | 179 } |
| 169 | 180 |
| 170 } // namespace blink | 181 } // namespace blink |
| OLD | NEW |