OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-console.h" | 5 #include "src/inspector/v8-console.h" |
6 | 6 |
7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
8 #include "src/inspector/injected-script.h" | 8 #include "src/inspector/injected-script.h" |
9 #include "src/inspector/inspected-context.h" | 9 #include "src/inspector/inspected-context.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 void V8Console::Assert(const v8::debug::ConsoleCallArguments& info) { | 268 void V8Console::Assert(const v8::debug::ConsoleCallArguments& info) { |
269 ConsoleHelper helper(info, m_inspector); | 269 ConsoleHelper helper(info, m_inspector); |
270 DCHECK(!helper.firstArgToBoolean(false)); | 270 DCHECK(!helper.firstArgToBoolean(false)); |
271 | 271 |
272 std::vector<v8::Local<v8::Value>> arguments; | 272 std::vector<v8::Local<v8::Value>> arguments; |
273 for (int i = 1; i < info.Length(); ++i) arguments.push_back(info[i]); | 273 for (int i = 1; i < info.Length(); ++i) arguments.push_back(info[i]); |
274 if (info.Length() < 2) | 274 if (info.Length() < 2) |
275 arguments.push_back( | 275 arguments.push_back( |
276 toV8String(m_inspector->isolate(), String16("console.assert"))); | 276 toV8String(m_inspector->isolate(), String16("console.assert"))); |
277 helper.reportCall(ConsoleAPIType::kAssert, arguments); | 277 helper.reportCall(ConsoleAPIType::kAssert, arguments); |
278 | 278 m_inspector->debugger()->breakProgramOnAssert(helper.groupId()); |
279 // TODO(dgozman): only break once, not per each session. | |
280 helper.forEachSession([](V8InspectorSessionImpl* session) { | |
281 if (session->debuggerAgent()->enabled()) { | |
282 session->debuggerAgent()->breakProgramOnException( | |
283 protocol::Debugger::Paused::ReasonEnum::Assert, nullptr); | |
284 } | |
285 }); | |
286 } | 279 } |
287 | 280 |
288 void V8Console::MarkTimeline(const v8::debug::ConsoleCallArguments& info) { | 281 void V8Console::MarkTimeline(const v8::debug::ConsoleCallArguments& info) { |
289 ConsoleHelper(info, m_inspector) | 282 ConsoleHelper(info, m_inspector) |
290 .reportDeprecatedCall("V8Console#markTimelineDeprecated", | 283 .reportDeprecatedCall("V8Console#markTimelineDeprecated", |
291 "'console.markTimeline' is " | 284 "'console.markTimeline' is " |
292 "deprecated. Please use " | 285 "deprecated. Please use " |
293 "'console.timeStamp' instead."); | 286 "'console.timeStamp' instead."); |
294 TimeStamp(info); | 287 TimeStamp(info); |
295 } | 288 } |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 ->GetOwnPropertyDescriptor( | 748 ->GetOwnPropertyDescriptor( |
756 m_context, v8::Local<v8::String>::Cast(name)) | 749 m_context, v8::Local<v8::String>::Cast(name)) |
757 .ToLocal(&descriptor); | 750 .ToLocal(&descriptor); |
758 DCHECK(success); | 751 DCHECK(success); |
759 USE(success); | 752 USE(success); |
760 } | 753 } |
761 } | 754 } |
762 } | 755 } |
763 | 756 |
764 } // namespace v8_inspector | 757 } // namespace v8_inspector |
OLD | NEW |