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-debugger.h" | 5 #include "src/inspector/v8-debugger.h" |
6 | 6 |
7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 v8::HandleScope scope(m_isolate); | 581 v8::HandleScope scope(m_isolate); |
582 if (event == v8::AfterCompile || event == v8::CompileError) { | 582 if (event == v8::AfterCompile || event == v8::CompileError) { |
583 v8::Context::Scope contextScope(debuggerContext()); | 583 v8::Context::Scope contextScope(debuggerContext()); |
584 // Determine if the script is a wasm script. | 584 // Determine if the script is a wasm script. |
585 v8::Local<v8::Value> scriptMirror = | 585 v8::Local<v8::Value> scriptMirror = |
586 callInternalGetterFunction(eventDetails.GetEventData(), "script"); | 586 callInternalGetterFunction(eventDetails.GetEventData(), "script"); |
587 DCHECK(scriptMirror->IsObject()); | 587 DCHECK(scriptMirror->IsObject()); |
588 v8::Local<v8::Value> scriptWrapper = | 588 v8::Local<v8::Value> scriptWrapper = |
589 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); | 589 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value"); |
590 DCHECK(scriptWrapper->IsObject()); | 590 DCHECK(scriptWrapper->IsObject()); |
591 v8::Local<v8::DebugInterface::Script> script = | 591 v8::Local<v8::DebugInterface::Script> script; |
592 v8::DebugInterface::Script::Wrap(m_isolate, | 592 if (!v8::DebugInterface::Script::Wrap(m_isolate, |
593 scriptWrapper.As<v8::Object>()) | 593 scriptWrapper.As<v8::Object>()) |
594 .ToLocalChecked(); | 594 .ToLocal(&script)) { |
| 595 return; |
| 596 } |
595 if (script->IsWasm()) { | 597 if (script->IsWasm()) { |
596 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); | 598 m_wasmTranslation.AddScript(scriptWrapper.As<v8::Object>()); |
597 } else if (m_ignoreScriptParsedEventsCounter == 0) { | 599 } else if (m_ignoreScriptParsedEventsCounter == 0) { |
598 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; | |
599 v8::Local<v8::Value> value = | |
600 callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); | |
601 if (value->IsNull()) return; | |
602 DCHECK(value->IsObject()); | |
603 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); | |
604 v8::Local<v8::DebugInterface::Script> script; | |
605 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) | |
606 .ToLocal(&script)) | |
607 return; | |
608 agent->didParseSource( | 600 agent->didParseSource( |
609 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), | 601 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), |
610 event == v8::AfterCompile); | 602 event == v8::AfterCompile); |
611 } | 603 } |
612 } else if (event == v8::Exception) { | 604 } else if (event == v8::Exception) { |
613 v8::Local<v8::Context> context = debuggerContext(); | 605 v8::Local<v8::Context> context = debuggerContext(); |
614 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); | 606 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); |
615 v8::Local<v8::Value> exception = | 607 v8::Local<v8::Value> exception = |
616 callInternalGetterFunction(eventData, "exception"); | 608 callInternalGetterFunction(eventData, "exception"); |
617 v8::Local<v8::Value> promise = | 609 v8::Local<v8::Value> promise = |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 983 |
992 size_t stackSize = | 984 size_t stackSize = |
993 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 985 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
994 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 986 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
995 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 987 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
996 | 988 |
997 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 989 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
998 } | 990 } |
999 | 991 |
1000 } // namespace v8_inspector | 992 } // namespace v8_inspector |
OLD | NEW |