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

Side by Side Diff: src/inspector/v8-debugger-agent-impl.cc

Issue 2851853002: [inspector] entered into context before getPossibleBreakpoints call (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-debugger-agent-impl.h" 5 #include "src/inspector/v8-debugger-agent-impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/debug/debug-interface.h" 9 #include "src/debug/debug-interface.h"
10 #include "src/inspector/injected-script.h" 10 #include "src/inspector/injected-script.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 int line = end.fromJust()->getLineNumber(); 450 int line = end.fromJust()->getLineNumber();
451 int column = end.fromJust()->getColumnNumber(0); 451 int column = end.fromJust()->getColumnNumber(0);
452 if (line < 0 || column < 0) 452 if (line < 0 || column < 0)
453 return Response::Error( 453 return Response::Error(
454 "end.lineNumber and end.columnNumber should be >= 0"); 454 "end.lineNumber and end.columnNumber should be >= 0");
455 v8End = v8::debug::Location(line, column); 455 v8End = v8::debug::Location(line, column);
456 } 456 }
457 auto it = m_scripts.find(scriptId); 457 auto it = m_scripts.find(scriptId);
458 if (it == m_scripts.end()) return Response::Error("Script not found"); 458 if (it == m_scripts.end()) return Response::Error("Script not found");
459 459
460 int contextId = it->second->executionContextId();
461 int contextGroupId = m_inspector->contextGroupId(contextId);
462 InspectedContext* inspected =
463 m_inspector->getContext(contextGroupId, contextId);
464 if (!inspected) return Response::InternalError();
dgozman 2017/04/28 20:57:23 I don't like this return. Sometimes we don't have
kozy 2017/04/28 21:17:10 I think I can use debuggerContext to fix a crash a
465 v8::HandleScope handleScope(m_isolate);
466 v8::Context::Scope contextScope(inspected->context());
467
460 std::vector<v8::debug::BreakLocation> v8Locations; 468 std::vector<v8::debug::BreakLocation> v8Locations;
461 if (!it->second->getPossibleBreakpoints( 469
462 v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations)) { 470 {
463 return Response::InternalError(); 471 v8::TryCatch tryCatch(m_isolate);
dgozman 2017/04/28 20:57:23 Put all scopes inside of {} block?
kozy 2017/04/28 21:17:10 Done.
472 it->second->getPossibleBreakpoints(
473 v8Start, v8End, restrictToFunction.fromMaybe(false), &v8Locations);
464 } 474 }
465 475
466 *locations = protocol::Array<protocol::Debugger::BreakLocation>::create(); 476 *locations = protocol::Array<protocol::Debugger::BreakLocation>::create();
467 for (size_t i = 0; i < v8Locations.size(); ++i) { 477 for (size_t i = 0; i < v8Locations.size(); ++i) {
468 std::unique_ptr<protocol::Debugger::BreakLocation> breakLocation = 478 std::unique_ptr<protocol::Debugger::BreakLocation> breakLocation =
469 protocol::Debugger::BreakLocation::create() 479 protocol::Debugger::BreakLocation::create()
470 .setScriptId(scriptId) 480 .setScriptId(scriptId)
471 .setLineNumber(v8Locations[i].GetLineNumber()) 481 .setLineNumber(v8Locations[i].GetLineNumber())
472 .setColumnNumber(v8Locations[i].GetColumnNumber()) 482 .setColumnNumber(v8Locations[i].GetColumnNumber())
473 .build(); 483 .build();
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1296
1287 void V8DebuggerAgentImpl::reset() { 1297 void V8DebuggerAgentImpl::reset() {
1288 if (!enabled()) return; 1298 if (!enabled()) return;
1289 m_blackboxedPositions.clear(); 1299 m_blackboxedPositions.clear();
1290 resetBlackboxedStateCache(); 1300 resetBlackboxedStateCache();
1291 m_scripts.clear(); 1301 m_scripts.clear();
1292 m_breakpointIdToDebuggerBreakpointIds.clear(); 1302 m_breakpointIdToDebuggerBreakpointIds.clear();
1293 } 1303 }
1294 1304
1295 } // namespace v8_inspector 1305 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698