| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 : m_context(context) | 114 : m_context(context) |
| 115 , m_value(context->isolate(), object) | 115 , m_value(context->isolate(), object) |
| 116 , m_native(injectedScriptNative) | 116 , m_native(injectedScriptNative) |
| 117 { | 117 { |
| 118 } | 118 } |
| 119 | 119 |
| 120 InjectedScript::~InjectedScript() | 120 InjectedScript::~InjectedScript() |
| 121 { | 121 { |
| 122 } | 122 } |
| 123 | 123 |
| 124 v8::Isolate* InjectedScript::isolate() const | |
| 125 { | |
| 126 return m_context->isolate(); | |
| 127 } | |
| 128 | |
| 129 void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Objec
t> object, const String16& groupName, bool ownProperties, bool accessorPropertie
sOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Mayb
e<protocol::Runtime::ExceptionDetails>* exceptionDetails) | 124 void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Objec
t> object, const String16& groupName, bool ownProperties, bool accessorPropertie
sOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Mayb
e<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| 130 { | 125 { |
| 131 v8::HandleScope handles(isolate()); | 126 v8::HandleScope handles(m_context->isolate()); |
| 132 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "getProperties"); | 127 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "getProperties"); |
| 133 function.appendArgument(object); | 128 function.appendArgument(object); |
| 134 function.appendArgument(groupName); | 129 function.appendArgument(groupName); |
| 135 function.appendArgument(ownProperties); | 130 function.appendArgument(ownProperties); |
| 136 function.appendArgument(accessorPropertiesOnly); | 131 function.appendArgument(accessorPropertiesOnly); |
| 137 function.appendArgument(generatePreview); | 132 function.appendArgument(generatePreview); |
| 138 | 133 |
| 139 v8::TryCatch tryCatch(isolate()); | 134 v8::TryCatch tryCatch(m_context->isolate()); |
| 140 v8::Local<v8::Value> resultValue = function.callWithoutExceptionHandling(); | 135 v8::Local<v8::Value> resultValue = function.callWithoutExceptionHandling(); |
| 141 if (tryCatch.HasCaught()) { | 136 if (tryCatch.HasCaught()) { |
| 142 *exceptionDetails = createExceptionDetails(tryCatch.Message()); | 137 *exceptionDetails = createExceptionDetails(tryCatch.Message()); |
| 143 // FIXME: make properties optional | 138 // FIXME: make properties optional |
| 144 *properties = Array<PropertyDescriptor>::create(); | 139 *properties = Array<PropertyDescriptor>::create(); |
| 145 return; | 140 return; |
| 146 } | 141 } |
| 147 | 142 |
| 148 OwnPtr<protocol::Value> protocolValue = toProtocolValue(function.context(),
resultValue); | 143 OwnPtr<protocol::Value> protocolValue = toProtocolValue(function.context(),
resultValue); |
| 149 if (hasInternalError(errorString, !protocolValue)) | 144 if (hasInternalError(errorString, !protocolValue)) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 163 if (!object) | 158 if (!object) |
| 164 return; | 159 return; |
| 165 int boundId = 0; | 160 int boundId = 0; |
| 166 if (!object->getNumber("id", &boundId)) | 161 if (!object->getNumber("id", &boundId)) |
| 167 return; | 162 return; |
| 168 m_native->unbind(boundId); | 163 m_native->unbind(boundId); |
| 169 } | 164 } |
| 170 | 165 |
| 171 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(ErrorStri
ng* errorString, v8::Local<v8::Value> value, const String16& groupName, bool for
ceValueType, bool generatePreview) const | 166 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(ErrorStri
ng* errorString, v8::Local<v8::Value> value, const String16& groupName, bool for
ceValueType, bool generatePreview) const |
| 172 { | 167 { |
| 173 v8::HandleScope handles(isolate()); | 168 v8::HandleScope handles(m_context->isolate()); |
| 174 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "wrapObject"); | 169 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "wrapObject"); |
| 175 v8::Local<v8::Value> wrappedObject; | 170 v8::Local<v8::Value> wrappedObject; |
| 176 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) | 171 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) |
| 177 return nullptr; | 172 return nullptr; |
| 178 protocol::ErrorSupport errors; | 173 protocol::ErrorSupport errors; |
| 179 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::parse(toProtocolValue(m_context->context(), wrappedObject).get(), &e
rrors); | 174 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::parse(toProtocolValue(m_context->context(), wrappedObject).get(), &e
rrors); |
| 180 if (!remoteObject) | 175 if (!remoteObject) |
| 181 *errorString = "Object has too long reference chain"; | 176 *errorString = "Object has too long reference chain"; |
| 182 return remoteObject.release(); | 177 return remoteObject.release(); |
| 183 } | 178 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 function.appendArgument(generatePreview); | 228 function.appendArgument(generatePreview); |
| 234 bool hadException = false; | 229 bool hadException = false; |
| 235 v8::Local<v8::Value> r = function.call(hadException); | 230 v8::Local<v8::Value> r = function.call(hadException); |
| 236 if (hasInternalError(errorString, hadException || r.IsEmpty())) | 231 if (hasInternalError(errorString, hadException || r.IsEmpty())) |
| 237 return v8::MaybeLocal<v8::Value>(); | 232 return v8::MaybeLocal<v8::Value>(); |
| 238 return r; | 233 return r; |
| 239 } | 234 } |
| 240 | 235 |
| 241 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<
v8::Value> table, v8::Local<v8::Value> columns) const | 236 PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<
v8::Value> table, v8::Local<v8::Value> columns) const |
| 242 { | 237 { |
| 243 v8::HandleScope handles(isolate()); | 238 v8::HandleScope handles(m_context->isolate()); |
| 244 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "wrapTable"); | 239 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "wrapTable"); |
| 245 function.appendArgument(canAccessInspectedWindow()); | 240 function.appendArgument(canAccessInspectedWindow()); |
| 246 function.appendArgument(table); | 241 function.appendArgument(table); |
| 247 if (columns.IsEmpty()) | 242 if (columns.IsEmpty()) |
| 248 function.appendArgument(false); | 243 function.appendArgument(false); |
| 249 else | 244 else |
| 250 function.appendArgument(columns); | 245 function.appendArgument(columns); |
| 251 bool hadException = false; | 246 bool hadException = false; |
| 252 v8::Local<v8::Value> r = function.call(hadException); | 247 v8::Local<v8::Value> r = function.call(hadException); |
| 253 if (hadException) | 248 if (hadException) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 264 return !outObject->IsEmpty(); | 259 return !outObject->IsEmpty(); |
| 265 } | 260 } |
| 266 | 261 |
| 267 String16 InjectedScript::objectGroupName(const RemoteObjectId& objectId) const | 262 String16 InjectedScript::objectGroupName(const RemoteObjectId& objectId) const |
| 268 { | 263 { |
| 269 return m_native->groupName(objectId.id()); | 264 return m_native->groupName(objectId.id()); |
| 270 } | 265 } |
| 271 | 266 |
| 272 void InjectedScript::releaseObjectGroup(const String16& objectGroup) | 267 void InjectedScript::releaseObjectGroup(const String16& objectGroup) |
| 273 { | 268 { |
| 274 v8::HandleScope handles(isolate()); | 269 v8::HandleScope handles(m_context->isolate()); |
| 275 m_native->releaseObjectGroup(objectGroup); | 270 m_native->releaseObjectGroup(objectGroup); |
| 276 if (objectGroup == "console") { | 271 if (objectGroup == "console") { |
| 277 V8FunctionCall function(m_context->debugger(), m_context->context(), v8V
alue(), "clearLastEvaluationResult"); | 272 V8FunctionCall function(m_context->debugger(), m_context->context(), v8V
alue(), "clearLastEvaluationResult"); |
| 278 bool hadException = false; | 273 bool hadException = false; |
| 279 function.call(hadException); | 274 function.call(hadException); |
| 280 ASSERT(!hadException); | 275 ASSERT(!hadException); |
| 281 } | 276 } |
| 282 } | 277 } |
| 283 | 278 |
| 284 void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) | 279 void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) |
| 285 { | 280 { |
| 286 v8::HandleScope handles(isolate()); | 281 v8::HandleScope handles(m_context->isolate()); |
| 287 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "setCustomObjectFormatterEnabled"); | 282 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "setCustomObjectFormatterEnabled"); |
| 288 function.appendArgument(enabled); | 283 function.appendArgument(enabled); |
| 289 bool hadException = false; | 284 bool hadException = false; |
| 290 function.call(hadException); | 285 function.call(hadException); |
| 291 ASSERT(!hadException); | 286 ASSERT(!hadException); |
| 292 } | 287 } |
| 293 | 288 |
| 294 bool InjectedScript::canAccessInspectedWindow() const | 289 bool InjectedScript::canAccessInspectedWindow() const |
| 295 { | 290 { |
| 296 v8::Local<v8::Context> callingContext = isolate()->GetCallingContext(); | 291 v8::Local<v8::Context> callingContext = m_context->isolate()->GetCallingCont
ext(); |
| 297 if (callingContext.IsEmpty()) | 292 if (callingContext.IsEmpty()) |
| 298 return true; | 293 return true; |
| 299 return m_context->debugger()->client()->callingContextCanAccessContext(calli
ngContext, m_context->context()); | 294 return m_context->debugger()->client()->callingContextCanAccessContext(calli
ngContext, m_context->context()); |
| 300 } | 295 } |
| 301 | 296 |
| 302 v8::Local<v8::Value> InjectedScript::v8Value() const | 297 v8::Local<v8::Value> InjectedScript::v8Value() const |
| 303 { | 298 { |
| 304 return m_value.Get(isolate()); | 299 return m_value.Get(m_context->isolate()); |
| 305 } | 300 } |
| 306 | 301 |
| 307 bool InjectedScript::setLastEvaluationResult(ErrorString* errorString, v8::Local
<v8::Value> value) | 302 bool InjectedScript::setLastEvaluationResult(ErrorString* errorString, v8::Local
<v8::Value> value) |
| 308 { | 303 { |
| 309 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "setLastEvaluationResult"); | 304 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "setLastEvaluationResult"); |
| 310 function.appendArgument(value); | 305 function.appendArgument(value); |
| 311 bool hadException = false; | 306 bool hadException = false; |
| 312 function.call(hadException, false); | 307 function.call(hadException, false); |
| 313 return !hasInternalError(errorString, hadException); | 308 return !hasInternalError(errorString, hadException); |
| 314 } | 309 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 326 v8::Local<v8::Value> object; | 321 v8::Local<v8::Value> object; |
| 327 if (!findObject(errorString, *remoteObjectId, &object)) | 322 if (!findObject(errorString, *remoteObjectId, &object)) |
| 328 return v8::MaybeLocal<v8::Value>(); | 323 return v8::MaybeLocal<v8::Value>(); |
| 329 return object; | 324 return object; |
| 330 } | 325 } |
| 331 if (callArgument->hasValue()) { | 326 if (callArgument->hasValue()) { |
| 332 String16 value = callArgument->getValue(nullptr)->toJSONString(); | 327 String16 value = callArgument->getValue(nullptr)->toJSONString(); |
| 333 if (callArgument->getType(String16()) == "number") | 328 if (callArgument->getType(String16()) == "number") |
| 334 value = "Number(" + value + ")"; | 329 value = "Number(" + value + ")"; |
| 335 v8::Local<v8::Value> object; | 330 v8::Local<v8::Value> object; |
| 336 if (!m_context->debugger()->compileAndRunInternalScript(m_context->conte
xt(), toV8String(isolate(), value)).ToLocal(&object)) { | 331 if (!m_context->debugger()->compileAndRunInternalScript(m_context->conte
xt(), toV8String(m_context->isolate(), value)).ToLocal(&object)) { |
| 337 *errorString = "Couldn't parse value object in call argument"; | 332 *errorString = "Couldn't parse value object in call argument"; |
| 338 return v8::MaybeLocal<v8::Value>(); | 333 return v8::MaybeLocal<v8::Value>(); |
| 339 } | 334 } |
| 340 return object; | 335 return object; |
| 341 } | 336 } |
| 342 return v8::Undefined(isolate()); | 337 return v8::Undefined(m_context->isolate()); |
| 343 } | |
| 344 | |
| 345 v8::MaybeLocal<v8::Object> InjectedScript::commandLineAPI(ErrorString* errorStri
ng) const | |
| 346 { | |
| 347 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "commandLineAPI"); | |
| 348 return callFunctionReturnObject(errorString, function); | |
| 349 } | |
| 350 | |
| 351 v8::MaybeLocal<v8::Object> InjectedScript::remoteObjectAPI(ErrorString* errorStr
ing, const String16& groupName) const | |
| 352 { | |
| 353 V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value
(), "remoteObjectAPI"); | |
| 354 function.appendArgument(groupName); | |
| 355 return callFunctionReturnObject(errorString, function); | |
| 356 } | |
| 357 | |
| 358 v8::MaybeLocal<v8::Object> InjectedScript::callFunctionReturnObject(ErrorString*
errorString, V8FunctionCall& function) const | |
| 359 { | |
| 360 bool hadException = false; | |
| 361 v8::Local<v8::Value> result = function.call(hadException, false); | |
| 362 v8::Local<v8::Object> resultObject; | |
| 363 if (hasInternalError(errorString, hadException || result.IsEmpty() || !resul
t->ToObject(m_context->context()).ToLocal(&resultObject))) | |
| 364 return v8::MaybeLocal<v8::Object>(); | |
| 365 return resultObject; | |
| 366 } | 338 } |
| 367 | 339 |
| 368 PassOwnPtr<protocol::Runtime::ExceptionDetails> InjectedScript::createExceptionD
etails(v8::Local<v8::Message> message) | 340 PassOwnPtr<protocol::Runtime::ExceptionDetails> InjectedScript::createExceptionD
etails(v8::Local<v8::Message> message) |
| 369 { | 341 { |
| 370 OwnPtr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject = protoco
l::Runtime::ExceptionDetails::create().setText(toProtocolString(message->Get()))
.build(); | 342 OwnPtr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject = protoco
l::Runtime::ExceptionDetails::create().setText(toProtocolString(message->Get()))
.build(); |
| 371 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr
iptResourceName())); | 343 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr
iptResourceName())); |
| 372 exceptionDetailsObject->setScriptId(String16::number(message->GetScriptOrigi
n().ScriptID()->Value())); | 344 exceptionDetailsObject->setScriptId(String16::number(message->GetScriptOrigi
n().ScriptID()->Value())); |
| 373 | 345 |
| 374 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); | 346 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); |
| 375 if (lineNumber.IsJust()) | 347 if (lineNumber.IsJust()) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 383 } |
| 412 } | 384 } |
| 413 | 385 |
| 414 InjectedScript::Scope::Scope(ErrorString* errorString, V8DebuggerImpl* debugger,
int contextGroupId) | 386 InjectedScript::Scope::Scope(ErrorString* errorString, V8DebuggerImpl* debugger,
int contextGroupId) |
| 415 : m_errorString(errorString) | 387 : m_errorString(errorString) |
| 416 , m_debugger(debugger) | 388 , m_debugger(debugger) |
| 417 , m_contextGroupId(contextGroupId) | 389 , m_contextGroupId(contextGroupId) |
| 418 , m_injectedScript(nullptr) | 390 , m_injectedScript(nullptr) |
| 419 , m_handleScope(debugger->isolate()) | 391 , m_handleScope(debugger->isolate()) |
| 420 , m_tryCatch(debugger->isolate()) | 392 , m_tryCatch(debugger->isolate()) |
| 393 , m_ignoreExceptionsAndMuteConsole(false) |
| 394 , m_previousPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions) |
| 421 { | 395 { |
| 422 } | 396 } |
| 423 | 397 |
| 424 bool InjectedScript::Scope::initialize() | 398 bool InjectedScript::Scope::initialize() |
| 425 { | 399 { |
| 426 cleanup(); | 400 cleanup(); |
| 427 // TODO(dgozman): what if we reattach to the same context group during evalu
ate? Introduce a session id? | 401 // TODO(dgozman): what if we reattach to the same context group during evalu
ate? Introduce a session id? |
| 428 V8InspectorSessionImpl* session = m_debugger->sessionForContextGroup(m_conte
xtGroupId); | 402 V8InspectorSessionImpl* session = m_debugger->sessionForContextGroup(m_conte
xtGroupId); |
| 429 if (!session) { | 403 if (!session) { |
| 430 *m_errorString = "Internal error"; | 404 *m_errorString = "Internal error"; |
| 431 return false; | 405 return false; |
| 432 } | 406 } |
| 433 findInjectedScript(session); | 407 findInjectedScript(session); |
| 434 if (!m_injectedScript) | 408 if (!m_injectedScript) |
| 435 return false; | 409 return false; |
| 436 m_context = m_injectedScript->context()->context(); | 410 m_context = m_injectedScript->context()->context(); |
| 437 m_context->Enter(); | 411 m_context->Enter(); |
| 438 return true; | 412 return true; |
| 439 } | 413 } |
| 440 | 414 |
| 441 void InjectedScript::Scope::installGlobalObjectExtension(v8::MaybeLocal<v8::Obje
ct> extension) | 415 bool InjectedScript::Scope::installCommandLineAPI() |
| 442 { | 416 { |
| 443 v8::Local<v8::Object> extensionObject; | 417 ASSERT(m_injectedScript && !m_context.IsEmpty()); |
| 444 if (m_context.IsEmpty() || !extension.ToLocal(&extensionObject)) | 418 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(),
"commandLineAPI"); |
| 445 return; | 419 return installGlobalObjectExtension(function); |
| 420 } |
| 446 | 421 |
| 422 bool InjectedScript::Scope::installRemoteObjectAPI(const String16& objectGroupNa
me) |
| 423 { |
| 424 ASSERT(m_injectedScript && !m_context.IsEmpty()); |
| 425 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(),
"remoteObjectAPI"); |
| 426 function.appendArgument(objectGroupName); |
| 427 return installGlobalObjectExtension(function); |
| 428 } |
| 429 |
| 430 bool InjectedScript::Scope::installGlobalObjectExtension(V8FunctionCall& functio
n) |
| 431 { |
| 432 bool hadException = false; |
| 433 v8::Local<v8::Value> extension = function.call(hadException, false); |
| 434 if (hadException || extension.IsEmpty()) { |
| 435 *m_errorString = "Internal error"; |
| 436 return false; |
| 437 } |
| 438 |
| 439 ASSERT(m_global.IsEmpty()); |
| 447 m_extensionSymbol = V8Debugger::scopeExtensionSymbol(m_debugger->isolate()); | 440 m_extensionSymbol = V8Debugger::scopeExtensionSymbol(m_debugger->isolate()); |
| 448 v8::Local<v8::Object> global = m_context->Global(); | 441 v8::Local<v8::Object> global = m_context->Global(); |
| 449 if (global->Set(m_context, m_extensionSymbol, extensionObject).FromMaybe(fal
se)) | 442 if (!global->Set(m_context, m_extensionSymbol, extension).FromMaybe(false))
{ |
| 450 m_global = global; | 443 *m_errorString = "Internal error"; |
| 444 return false; |
| 445 } |
| 446 |
| 447 m_global = global; |
| 448 return true; |
| 449 } |
| 450 |
| 451 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() |
| 452 { |
| 453 ASSERT(!m_ignoreExceptionsAndMuteConsole); |
| 454 m_ignoreExceptionsAndMuteConsole = true; |
| 455 m_debugger->client()->muteConsole(); |
| 456 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl:
:DontPauseOnExceptions); |
| 457 } |
| 458 |
| 459 V8DebuggerImpl::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExceptio
nsState(V8DebuggerImpl::PauseOnExceptionsState newState) |
| 460 { |
| 461 if (!m_debugger->enabled()) |
| 462 return newState; |
| 463 V8DebuggerImpl::PauseOnExceptionsState presentState = m_debugger->getPauseOn
ExceptionsState(); |
| 464 if (presentState != newState) |
| 465 m_debugger->setPauseOnExceptionsState(newState); |
| 466 return presentState; |
| 451 } | 467 } |
| 452 | 468 |
| 453 void InjectedScript::Scope::cleanup() | 469 void InjectedScript::Scope::cleanup() |
| 454 { | 470 { |
| 455 v8::Local<v8::Object> global; | 471 v8::Local<v8::Object> global; |
| 456 if (m_global.ToLocal(&global)) { | 472 if (m_global.ToLocal(&global)) { |
| 457 ASSERT(!m_context.IsEmpty()); | 473 ASSERT(!m_context.IsEmpty()); |
| 458 global->Delete(m_context, m_extensionSymbol); | 474 global->Delete(m_context, m_extensionSymbol); |
| 459 m_global = v8::MaybeLocal<v8::Object>(); | 475 m_global = v8::MaybeLocal<v8::Object>(); |
| 460 } | 476 } |
| 461 if (!m_context.IsEmpty()) { | 477 if (!m_context.IsEmpty()) { |
| 462 m_context->Exit(); | 478 m_context->Exit(); |
| 463 m_context.Clear(); | 479 m_context.Clear(); |
| 464 } | 480 } |
| 465 } | 481 } |
| 466 | 482 |
| 467 InjectedScript::Scope::~Scope() | 483 InjectedScript::Scope::~Scope() |
| 468 { | 484 { |
| 485 if (m_ignoreExceptionsAndMuteConsole) { |
| 486 setPauseOnExceptionsState(m_previousPauseOnExceptionsState); |
| 487 m_debugger->client()->unmuteConsole(); |
| 488 } |
| 469 cleanup(); | 489 cleanup(); |
| 470 } | 490 } |
| 471 | 491 |
| 472 InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8DebuggerI
mpl* debugger, int contextGroupId, int executionContextId) | 492 InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8DebuggerI
mpl* debugger, int contextGroupId, int executionContextId) |
| 473 : InjectedScript::Scope(errorString, debugger, contextGroupId) | 493 : InjectedScript::Scope(errorString, debugger, contextGroupId) |
| 474 , m_executionContextId(executionContextId) | 494 , m_executionContextId(executionContextId) |
| 475 { | 495 { |
| 476 } | 496 } |
| 477 | 497 |
| 478 InjectedScript::ContextScope::~ContextScope() | 498 InjectedScript::ContextScope::~ContextScope() |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 541 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 522 { | 542 { |
| 523 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString,
m_remoteCallFrameId); | 543 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString,
m_remoteCallFrameId); |
| 524 if (!remoteId) | 544 if (!remoteId) |
| 525 return; | 545 return; |
| 526 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 546 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 527 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 547 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 528 } | 548 } |
| 529 | 549 |
| 530 } // namespace blink | 550 } // namespace blink |
| OLD | NEW |