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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 if (!persistScript) | 209 if (!persistScript) |
210 return; | 210 return; |
211 | 211 |
212 String scriptValueId = String::number(script->GetUnboundScript()->GetId()); | 212 String scriptValueId = String::number(script->GetUnboundScript()->GetId()); |
213 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>(
isolate, script)); | 213 OwnPtr<v8::Global<v8::Script>> global = adoptPtr(new v8::Global<v8::Script>(
isolate, script)); |
214 m_compiledScripts.set(scriptValueId, global.release()); | 214 m_compiledScripts.set(scriptValueId, global.release()); |
215 *scriptId = scriptValueId; | 215 *scriptId = scriptValueId; |
216 } | 216 } |
217 | 217 |
218 void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scr
iptId, int executionContextId, const String* const objectGroup, const bool* cons
t doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<Exc
eptionDetails>& exceptionDetails) | 218 void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scr
iptId, int executionContextId, const String* const objectGroup, const bool* cons
t doNotPauseOnExceptionsAndMuteConsole, const bool* includeCommandLineAPI, RefPt
r<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails) |
219 { | 219 { |
220 if (!m_enabled) { | 220 if (!m_enabled) { |
221 *errorString = "Runtime agent is not enabled"; | 221 *errorString = "Runtime agent is not enabled"; |
222 return; | 222 return; |
223 } | 223 } |
224 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(executionContextId); | 224 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript
(executionContextId); |
225 if (!injectedScript) { | 225 if (!injectedScript) { |
226 *errorString = "Inspected frame has gone"; | 226 *errorString = "Inspected frame has gone"; |
227 return; | 227 return; |
228 } | 228 } |
(...skipping 12 matching lines...) Expand all Loading... |
241 v8::Local<v8::Context> context = injectedScript->context(); | 241 v8::Local<v8::Context> context = injectedScript->context(); |
242 v8::Context::Scope scope(context); | 242 v8::Context::Scope scope(context); |
243 OwnPtr<v8::Global<v8::Script>> scriptWrapper = m_compiledScripts.take(script
Id); | 243 OwnPtr<v8::Global<v8::Script>> scriptWrapper = m_compiledScripts.take(script
Id); |
244 v8::Local<v8::Script> script = scriptWrapper->Get(isolate); | 244 v8::Local<v8::Script> script = scriptWrapper->Get(isolate); |
245 | 245 |
246 if (script.IsEmpty()) { | 246 if (script.IsEmpty()) { |
247 *errorString = "Script execution failed"; | 247 *errorString = "Script execution failed"; |
248 return; | 248 return; |
249 } | 249 } |
250 v8::TryCatch tryCatch(isolate); | 250 v8::TryCatch tryCatch(isolate); |
| 251 |
251 v8::Local<v8::Value> value; | 252 v8::Local<v8::Value> value; |
252 v8::MaybeLocal<v8::Value> maybeValue = m_debugger->client()->runCompiledScri
pt(context, script); | 253 v8::MaybeLocal<v8::Value> maybeValue = injectedScript->runCompiledScript(scr
ipt, asBool(includeCommandLineAPI)); |
253 if (maybeValue.IsEmpty()) { | 254 if (maybeValue.IsEmpty()) { |
254 value = tryCatch.Exception(); | 255 value = tryCatch.Exception(); |
255 v8::Local<v8::Message> message = tryCatch.Message(); | 256 v8::Local<v8::Message> message = tryCatch.Message(); |
256 if (!message.IsEmpty()) | 257 if (!message.IsEmpty()) |
257 exceptionDetails = createExceptionDetails(isolate, message); | 258 exceptionDetails = createExceptionDetails(isolate, message); |
258 } else { | 259 } else { |
259 value = maybeValue.ToLocalChecked(); | 260 value = maybeValue.ToLocalChecked(); |
260 } | 261 } |
261 | 262 |
262 if (value.IsEmpty()) { | 263 if (value.IsEmpty()) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toWTFStringWithTypeCheck(message->Get())); | 402 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toWTFStringWithTypeCheck(message->Get())); |
402 exceptionDetails->setLine(message->GetLineNumber()); | 403 exceptionDetails->setLine(message->GetLineNumber()); |
403 exceptionDetails->setColumn(message->GetStartColumn()); | 404 exceptionDetails->setColumn(message->GetStartColumn()); |
404 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); | 405 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); |
405 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) | 406 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) |
406 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac
e, messageStackTrace->GetFrameCount())->buildInspectorObject()); | 407 exceptionDetails->setStack(m_debugger->createStackTrace(messageStackTrac
e, messageStackTrace->GetFrameCount())->buildInspectorObject()); |
407 return exceptionDetails.release(); | 408 return exceptionDetails.release(); |
408 } | 409 } |
409 | 410 |
410 } // namespace blink | 411 } // namespace blink |
OLD | NEW |