Chromium Code Reviews| 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 if (!m_injectedScript || m_context.IsEmpty()) |
|
kozy
2016/04/12 22:16:13
Set errorString here.
dgozman
2016/04/12 22:25:59
Not sure. This means we call this method when init
dgozman
2016/04/13 19:20:59
Added ASSERT.
| |
| 444 if (m_context.IsEmpty() || !extension.ToLocal(&extensionObject)) | 418 return false; |
| 445 return; | 419 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(), "commandLineAPI"); |
| 420 return installGlobalObjectExtension(function); | |
| 421 } | |
| 446 | 422 |
| 423 bool InjectedScript::Scope::installRemoteObjectAPI(const String16& objectGroupNa me) | |
| 424 { | |
| 425 if (!m_injectedScript || m_context.IsEmpty()) | |
| 426 return false; | |
| 427 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(), "remoteObjectAPI"); | |
| 428 function.appendArgument(objectGroupName); | |
| 429 return installGlobalObjectExtension(function); | |
| 430 } | |
| 431 | |
| 432 bool InjectedScript::Scope::installGlobalObjectExtension(V8FunctionCall& functio n) | |
| 433 { | |
| 434 bool hadException = false; | |
| 435 v8::Local<v8::Value> extension = function.call(hadException, false); | |
| 436 if (hadException || extension.IsEmpty()) { | |
| 437 *m_errorString = "Internal error"; | |
| 438 return false; | |
| 439 } | |
| 440 | |
| 441 ASSERT(m_global.IsEmpty()); | |
| 447 m_extensionSymbol = V8Debugger::scopeExtensionSymbol(m_debugger->isolate()); | 442 m_extensionSymbol = V8Debugger::scopeExtensionSymbol(m_debugger->isolate()); |
| 448 v8::Local<v8::Object> global = m_context->Global(); | 443 v8::Local<v8::Object> global = m_context->Global(); |
| 449 if (global->Set(m_context, m_extensionSymbol, extensionObject).FromMaybe(fal se)) | 444 if (!global->Set(m_context, m_extensionSymbol, extension).FromMaybe(false)) { |
| 450 m_global = global; | 445 *m_errorString = "Internal error"; |
| 446 return false; | |
| 447 } | |
| 448 | |
| 449 m_global = global; | |
| 450 return true; | |
| 451 } | |
| 452 | |
| 453 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() | |
| 454 { | |
| 455 ASSERT(!m_ignoreExceptionsAndMuteConsole); | |
| 456 m_ignoreExceptionsAndMuteConsole = true; | |
| 457 m_debugger->client()->muteConsole(); | |
| 458 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl: :DontPauseOnExceptions); | |
| 459 } | |
| 460 | |
| 461 V8DebuggerImpl::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExceptio nsState(V8DebuggerImpl::PauseOnExceptionsState newState) | |
| 462 { | |
| 463 if (!m_debugger->enabled()) | |
| 464 return newState; | |
| 465 V8DebuggerImpl::PauseOnExceptionsState presentState = m_debugger->getPauseOn ExceptionsState(); | |
| 466 if (presentState != newState) | |
| 467 m_debugger->setPauseOnExceptionsState(newState); | |
| 468 return presentState; | |
| 451 } | 469 } |
| 452 | 470 |
| 453 void InjectedScript::Scope::cleanup() | 471 void InjectedScript::Scope::cleanup() |
| 454 { | 472 { |
| 455 v8::Local<v8::Object> global; | 473 v8::Local<v8::Object> global; |
| 456 if (m_global.ToLocal(&global)) { | 474 if (m_global.ToLocal(&global)) { |
| 457 ASSERT(!m_context.IsEmpty()); | 475 ASSERT(!m_context.IsEmpty()); |
| 458 global->Delete(m_context, m_extensionSymbol); | 476 global->Delete(m_context, m_extensionSymbol); |
| 459 m_global = v8::MaybeLocal<v8::Object>(); | 477 m_global = v8::MaybeLocal<v8::Object>(); |
| 460 } | 478 } |
| 461 if (!m_context.IsEmpty()) { | 479 if (!m_context.IsEmpty()) { |
| 462 m_context->Exit(); | 480 m_context->Exit(); |
| 463 m_context.Clear(); | 481 m_context.Clear(); |
| 464 } | 482 } |
| 465 } | 483 } |
| 466 | 484 |
| 467 InjectedScript::Scope::~Scope() | 485 InjectedScript::Scope::~Scope() |
| 468 { | 486 { |
| 487 if (m_ignoreExceptionsAndMuteConsole) { | |
| 488 setPauseOnExceptionsState(m_previousPauseOnExceptionsState); | |
| 489 m_debugger->client()->unmuteConsole(); | |
| 490 } | |
| 469 cleanup(); | 491 cleanup(); |
| 470 } | 492 } |
| 471 | 493 |
| 472 InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8DebuggerI mpl* debugger, int contextGroupId, int executionContextId) | 494 InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8DebuggerI mpl* debugger, int contextGroupId, int executionContextId) |
| 473 : InjectedScript::Scope(errorString, debugger, contextGroupId) | 495 : InjectedScript::Scope(errorString, debugger, contextGroupId) |
| 474 , m_executionContextId(executionContextId) | 496 , m_executionContextId(executionContextId) |
| 475 { | 497 { |
| 476 } | 498 } |
| 477 | 499 |
| 478 InjectedScript::ContextScope::~ContextScope() | 500 InjectedScript::ContextScope::~ContextScope() |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) | 543 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) |
| 522 { | 544 { |
| 523 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId); | 545 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId); |
| 524 if (!remoteId) | 546 if (!remoteId) |
| 525 return; | 547 return; |
| 526 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 548 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 527 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); | 549 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); |
| 528 } | 550 } |
| 529 | 551 |
| 530 } // namespace blink | 552 } // namespace blink |
| OLD | NEW |