Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/bindings/core/v8/ScriptDebugServer.cpp

Issue 651533003: DevTools: Introduce Debugger::Reason::PromiseRejection pause reason. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: also disaply <exception> in scopes sidebar Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 void ScriptDebugServer::breakProgramCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 425 void ScriptDebugServer::breakProgramCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
426 { 426 {
427 ASSERT(2 == info.Length()); 427 ASSERT(2 == info.Length());
428 ScriptDebugServer* thisPtr = toScriptDebugServer(info.Data()); 428 ScriptDebugServer* thisPtr = toScriptDebugServer(info.Data());
429 ScriptState* pausedScriptState = ScriptState::current(thisPtr->m_isolate); 429 ScriptState* pausedScriptState = ScriptState::current(thisPtr->m_isolate);
430 v8::Handle<v8::Value> exception; 430 v8::Handle<v8::Value> exception;
431 v8::Handle<v8::Array> hitBreakpoints; 431 v8::Handle<v8::Array> hitBreakpoints;
432 thisPtr->handleProgramBreak(pausedScriptState, v8::Handle<v8::Object>::Cast( info[0]), exception, hitBreakpoints); 432 thisPtr->handleProgramBreak(pausedScriptState, v8::Handle<v8::Object>::Cast( info[0]), exception, hitBreakpoints);
433 } 433 }
434 434
435 void ScriptDebugServer::handleProgramBreak(ScriptState* pausedScriptState, v8::H andle<v8::Object> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8 ::Array> hitBreakpointNumbers) 435 void ScriptDebugServer::handleProgramBreak(ScriptState* pausedScriptState, v8::H andle<v8::Object> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8 ::Array> hitBreakpointNumbers, bool isPromiseRejection)
436 { 436 {
437 // Don't allow nested breaks. 437 // Don't allow nested breaks.
438 if (m_runningNestedMessageLoop) 438 if (m_runningNestedMessageLoop)
439 return; 439 return;
440 440
441 ScriptDebugListener* listener = getDebugListenerForContext(pausedScriptState ->context()); 441 ScriptDebugListener* listener = getDebugListenerForContext(pausedScriptState ->context());
442 if (!listener) 442 if (!listener)
443 return; 443 return;
444 444
445 Vector<String> breakpointIds; 445 Vector<String> breakpointIds;
446 if (!hitBreakpointNumbers.IsEmpty()) { 446 if (!hitBreakpointNumbers.IsEmpty()) {
447 breakpointIds.resize(hitBreakpointNumbers->Length()); 447 breakpointIds.resize(hitBreakpointNumbers->Length());
448 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) { 448 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
449 v8::Handle<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Ge t(i); 449 v8::Handle<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Ge t(i);
450 ASSERT(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt3 2()); 450 ASSERT(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt3 2());
451 breakpointIds[i] = String::number(hitBreakpointNumber->Int32Value()) ; 451 breakpointIds[i] = String::number(hitBreakpointNumber->Int32Value()) ;
452 } 452 }
453 } 453 }
454 454
455 m_pausedScriptState = pausedScriptState; 455 m_pausedScriptState = pausedScriptState;
456 m_executionState = executionState; 456 m_executionState = executionState;
457 ScriptDebugListener::SkipPauseRequest result = listener->didPause(pausedScri ptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpo intIds); 457 ScriptDebugListener::SkipPauseRequest result = listener->didPause(pausedScri ptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpo intIds, isPromiseRejection);
458 if (result == ScriptDebugListener::NoSkip) { 458 if (result == ScriptDebugListener::NoSkip) {
459 m_runningNestedMessageLoop = true; 459 m_runningNestedMessageLoop = true;
460 runMessageLoopOnPause(pausedScriptState->context()); 460 runMessageLoopOnPause(pausedScriptState->context());
461 m_runningNestedMessageLoop = false; 461 m_runningNestedMessageLoop = false;
462 } 462 }
463 m_pausedScriptState.clear(); 463 m_pausedScriptState.clear();
464 m_executionState.Clear(); 464 m_executionState.Clear();
465 465
466 if (result == ScriptDebugListener::StepInto) { 466 if (result == ScriptDebugListener::StepInto) {
467 v8::Handle<v8::Value> argv[] = { executionState }; 467 v8::Handle<v8::Value> argv[] = { executionState };
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } else if (event == v8::AfterCompile || event == v8::CompileError) { 509 } else if (event == v8::AfterCompile || event == v8::CompileError) {
510 v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); 510 v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
511 v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() }; 511 v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
512 v8::Handle<v8::Value> value = callDebuggerMethod("getAfterCompileScr ipt", 1, argv); 512 v8::Handle<v8::Value> value = callDebuggerMethod("getAfterCompileScr ipt", 1, argv);
513 ASSERT(value->IsObject()); 513 ASSERT(value->IsObject());
514 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); 514 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
515 dispatchDidParseSource(listener, object, event != v8::AfterCompile ? CompileError : CompileSuccess); 515 dispatchDidParseSource(listener, object, event != v8::AfterCompile ? CompileError : CompileSuccess);
516 } else if (event == v8::Exception) { 516 } else if (event == v8::Exception) {
517 v8::Handle<v8::Object> eventData = eventDetails.GetEventData(); 517 v8::Handle<v8::Object> eventData = eventDetails.GetEventData();
518 v8::Handle<v8::Value> exception = callInternalGetterFunction(eventDa ta, "exception", m_isolate); 518 v8::Handle<v8::Value> exception = callInternalGetterFunction(eventDa ta, "exception", m_isolate);
519 handleProgramBreak(ScriptState::from(eventContext), eventDetails.Get ExecutionState(), exception, v8::Handle<v8::Array>()); 519 v8::Handle<v8::Value> promise = callInternalGetterFunction(eventData , "promise", m_isolate);
520 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
521 handleProgramBreak(ScriptState::from(eventContext), eventDetails.Get ExecutionState(), exception, v8::Handle<v8::Array>(), isPromiseRejection);
520 } else if (event == v8::Break) { 522 } else if (event == v8::Break) {
521 v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() }; 523 v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
522 v8::Handle<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakp ointNumbers", 1, argv); 524 v8::Handle<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakp ointNumbers", 1, argv);
523 ASSERT(hitBreakpoints->IsArray()); 525 ASSERT(hitBreakpoints->IsArray());
524 handleProgramBreak(ScriptState::from(eventContext), eventDetails.Get ExecutionState(), v8::Handle<v8::Value>(), hitBreakpoints.As<v8::Array>()); 526 handleProgramBreak(ScriptState::from(eventContext), eventDetails.Get ExecutionState(), v8::Handle<v8::Value>(), hitBreakpoints.As<v8::Array>());
525 } else if (event == v8::AsyncTaskEvent) { 527 } else if (event == v8::AsyncTaskEvent) {
526 if (listener->v8AsyncTaskEventsEnabled()) 528 if (listener->v8AsyncTaskEventsEnabled())
527 handleV8AsyncTaskEvent(listener, ScriptState::from(eventContext) , eventDetails.GetExecutionState(), eventDetails.GetEventData()); 529 handleV8AsyncTaskEvent(listener, ScriptState::from(eventContext) , eventDetails.GetExecutionState(), eventDetails.GetEventData());
528 } else if (event == v8::PromiseEvent) { 530 } else if (event == v8::PromiseEvent) {
529 if (listener->v8PromiseEventsEnabled()) 531 if (listener->v8PromiseEventsEnabled())
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 { 718 {
717 return PassOwnPtr<ScriptSourceCode>(); 719 return PassOwnPtr<ScriptSourceCode>();
718 } 720 }
719 721
720 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName) 722 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName)
721 { 723 {
722 return source; 724 return source;
723 } 725 }
724 726
725 } // namespace blink 727 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptDebugServer.h ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698