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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return; | 92 return; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 InjectedScript::ContextScope scope(errorString, m_debugger, m_session->conte
xtGroupId(), contextId); | 96 InjectedScript::ContextScope scope(errorString, m_debugger, m_session->conte
xtGroupId(), contextId); |
97 if (!scope.initialize()) | 97 if (!scope.initialize()) |
98 return; | 98 return; |
99 | 99 |
100 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) | 100 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) |
101 scope.ignoreExceptionsAndMuteConsole(); | 101 scope.ignoreExceptionsAndMuteConsole(); |
| 102 if (userGesture.fromMaybe(false)) |
| 103 scope.pretendUserGesture(); |
102 | 104 |
103 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI()
) | 105 if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI()
) |
104 return; | 106 return; |
105 | 107 |
106 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed()
; | 108 bool evalIsDisabled = !scope.context()->IsCodeGenerationFromStringsAllowed()
; |
107 // Temporarily enable allow evals for inspector. | 109 // Temporarily enable allow evals for inspector. |
108 if (evalIsDisabled) | 110 if (evalIsDisabled) |
109 scope.context()->AllowCodeGenerationFromStrings(true); | 111 scope.context()->AllowCodeGenerationFromStrings(true); |
110 | 112 |
111 v8::MaybeLocal<v8::Value> maybeResultValue; | 113 v8::MaybeLocal<v8::Value> maybeResultValue; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 for (int i = 0; i < argc; ++i) { | 156 for (int i = 0; i < argc; ++i) { |
155 v8::Local<v8::Value> argumentValue; | 157 v8::Local<v8::Value> argumentValue; |
156 if (!scope.injectedScript()->resolveCallArgument(errorString, argume
nts->get(i)).ToLocal(&argumentValue)) | 158 if (!scope.injectedScript()->resolveCallArgument(errorString, argume
nts->get(i)).ToLocal(&argumentValue)) |
157 return; | 159 return; |
158 argv[i] = argumentValue; | 160 argv[i] = argumentValue; |
159 } | 161 } |
160 } | 162 } |
161 | 163 |
162 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) | 164 if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) |
163 scope.ignoreExceptionsAndMuteConsole(); | 165 scope.ignoreExceptionsAndMuteConsole(); |
| 166 if (userGesture.fromMaybe(false)) |
| 167 scope.pretendUserGesture(); |
164 | 168 |
165 v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInte
rnalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression +
")")); | 169 v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInte
rnalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression +
")")); |
166 // Re-initialize after running client's code, as it could have destroyed con
text or session. | 170 // Re-initialize after running client's code, as it could have destroyed con
text or session. |
167 if (!scope.initialize()) | 171 if (!scope.initialize()) |
168 return; | 172 return; |
169 | 173 |
170 if (scope.tryCatch().HasCaught()) { | 174 if (scope.tryCatch().HasCaught()) { |
171 scope.injectedScript()->wrapEvaluateResult(errorString, maybeFunctionVal
ue, scope.tryCatch(), scope.objectGroupName(), false, false, result, wasThrown,
nullptr); | 175 scope.injectedScript()->wrapEvaluateResult(errorString, maybeFunctionVal
ue, scope.tryCatch(), scope.objectGroupName(), false, false, result, wasThrown,
nullptr); |
172 return; | 176 return; |
173 } | 177 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 scope.injectedScript()->releaseObject(objectId); | 250 scope.injectedScript()->releaseObject(objectId); |
247 } | 251 } |
248 | 252 |
249 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object
Group) | 253 void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object
Group) |
250 { | 254 { |
251 m_session->releaseObjectGroup(objectGroup); | 255 m_session->releaseObjectGroup(objectGroup); |
252 } | 256 } |
253 | 257 |
254 void V8RuntimeAgentImpl::run(ErrorString* errorString) | 258 void V8RuntimeAgentImpl::run(ErrorString* errorString) |
255 { | 259 { |
256 *errorString = "Not paused"; | 260 m_session->client()->resumeStartup(); |
257 } | 261 } |
258 | 262 |
259 void V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(ErrorString*, bool enab
led) | 263 void V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(ErrorString*, bool enab
led) |
260 { | 264 { |
261 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, e
nabled); | 265 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, e
nabled); |
262 m_session->setCustomObjectFormatterEnabled(enabled); | 266 m_session->setCustomObjectFormatterEnabled(enabled); |
263 } | 267 } |
264 | 268 |
265 void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, | 269 void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, |
266 const String16& expression, | 270 const String16& expression, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 426 } |
423 } | 427 } |
424 | 428 |
425 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) | 429 void V8RuntimeAgentImpl::inspect(PassOwnPtr<protocol::Runtime::RemoteObject> obj
ectToInspect, PassOwnPtr<protocol::DictionaryValue> hints) |
426 { | 430 { |
427 if (m_enabled) | 431 if (m_enabled) |
428 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); | 432 m_frontend->inspectRequested(std::move(objectToInspect), std::move(hints
)); |
429 } | 433 } |
430 | 434 |
431 } // namespace blink | 435 } // namespace blink |
OLD | NEW |