| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI()
) | 109 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI()
) |
| 110 return; | 110 return; |
| 111 | 111 |
| 112 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed()
; | 112 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed()
; |
| 113 // Temporarily enable allow evals for inspector. | 113 // Temporarily enable allow evals for inspector. |
| 114 if (evalIsDisabled) | 114 if (evalIsDisabled) |
| 115 scope.context()->AllowCodeGenerationFromStrings(true); | 115 scope.context()->AllowCodeGenerationFromStrings(true); |
| 116 | 116 |
| 117 v8::MaybeLocal<v8::Value> maybeResultValue; | 117 v8::MaybeLocal<v8::Value> maybeResultValue; |
| 118 v8::Local<v8::Script> script = m_debugger->compileInternalScript(scope.conte
xt(), toV8String(m_debugger->isolate(), expression), String16()); | 118 v8::Local<v8::Script> script = m_debugger->compileScript(scope.context(), to
V8String(m_debugger->isolate(), expression), String16(), false); |
| 119 if (!script.IsEmpty()) | 119 if (!script.IsEmpty()) |
| 120 maybeResultValue = m_debugger->runCompiledScript(scope.context(), script
); | 120 maybeResultValue = m_debugger->runCompiledScript(scope.context(), script
); |
| 121 | 121 |
| 122 if (evalIsDisabled) | 122 if (evalIsDisabled) |
| 123 scope.context()->AllowCodeGenerationFromStrings(false); | 123 scope.context()->AllowCodeGenerationFromStrings(false); |
| 124 | 124 |
| 125 // Re-initialize after running client's code, as it could have destroyed con
text or session. | 125 // Re-initialize after running client's code, as it could have destroyed con
text or session. |
| 126 if (!scope.initialize()) | 126 if (!scope.initialize()) |
| 127 return; | 127 return; |
| 128 scope.injectedScript()->wrapEvaluateResult(errorString, | 128 scope.injectedScript()->wrapEvaluateResult(errorString, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 Maybe<ExceptionDetails>* exceptionDetails) | 282 Maybe<ExceptionDetails>* exceptionDetails) |
| 283 { | 283 { |
| 284 if (!m_enabled) { | 284 if (!m_enabled) { |
| 285 *errorString = "Runtime agent is not enabled"; | 285 *errorString = "Runtime agent is not enabled"; |
| 286 return; | 286 return; |
| 287 } | 287 } |
| 288 InjectedScript::ContextScope scope(errorString, m_debugger, m_session->conte
xtGroupId(), executionContextId); | 288 InjectedScript::ContextScope scope(errorString, m_debugger, m_session->conte
xtGroupId(), executionContextId); |
| 289 if (!scope.initialize()) | 289 if (!scope.initialize()) |
| 290 return; | 290 return; |
| 291 | 291 |
| 292 v8::Local<v8::Script> script = m_debugger->compileInternalScript(scope.conte
xt(), toV8String(m_debugger->isolate(), expression), sourceURL); | 292 v8::Local<v8::Script> script = m_debugger->compileScript(scope.context(), to
V8String(m_debugger->isolate(), expression), sourceURL, false); |
| 293 if (script.IsEmpty()) { | 293 if (script.IsEmpty()) { |
| 294 v8::Local<v8::Message> message = scope.tryCatch().Message(); | 294 v8::Local<v8::Message> message = scope.tryCatch().Message(); |
| 295 if (!message.IsEmpty()) | 295 if (!message.IsEmpty()) |
| 296 *exceptionDetails = scope.injectedScript()->createExceptionDetails(m
essage); | 296 *exceptionDetails = scope.injectedScript()->createExceptionDetails(m
essage); |
| 297 else | 297 else |
| 298 *errorString = "Script compilation failed"; | 298 *errorString = "Script compilation failed"; |
| 299 return; | 299 return; |
| 300 } | 300 } |
| 301 | 301 |
| 302 if (!persistScript) | 302 if (!persistScript) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 reportMessage(message, true); | 437 reportMessage(message, true); |
| 438 } | 438 } |
| 439 | 439 |
| 440 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) | 440 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) |
| 441 { | 441 { |
| 442 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 442 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
| 443 m_frontend.flush(); | 443 m_frontend.flush(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace blink | 446 } // namespace blink |
| OLD | NEW |