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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 | 784 |
785 v8::Local<v8::Value> V8Debugger::collectionEntries( | 785 v8::Local<v8::Value> V8Debugger::collectionEntries( |
786 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { | 786 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { |
787 if (!enabled()) { | 787 if (!enabled()) { |
788 UNREACHABLE(); | 788 UNREACHABLE(); |
789 return v8::Undefined(m_isolate); | 789 return v8::Undefined(m_isolate); |
790 } | 790 } |
791 v8::Local<v8::Value> argv[] = {object}; | 791 v8::Local<v8::Value> argv[] = {object}; |
792 v8::Local<v8::Value> entriesValue = | 792 v8::Local<v8::Value> entriesValue = |
793 callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); | 793 callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); |
794 v8::Local<v8::Value> copied; | 794 CHECK(entriesValue->IsArray()); |
dgozman
2016/09/28 20:21:52
if (!array) return undefined
kozy
2016/09/28 20:32:37
Done.
| |
795 if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, | 795 |
796 entriesValue) | 796 v8::Local<v8::Array> entries = entriesValue.As<v8::Array>(); |
797 .ToLocal(&copied) || | 797 v8::Local<v8::Array> copiedArray = |
798 !copied->IsArray()) | 798 v8::Array::New(m_isolate, entries->Length()); |
799 if (!copiedArray->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) | |
799 return v8::Undefined(m_isolate); | 800 return v8::Undefined(m_isolate); |
800 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied), | 801 for (uint32_t i = 0; i < entries->Length(); ++i) { |
802 v8::Local<v8::Value> item; | |
803 if (!entries->Get(debuggerContext(), i).ToLocal(&item)) | |
804 return v8::Undefined(m_isolate); | |
805 v8::Local<v8::Value> copied; | |
806 if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, | |
807 item) | |
808 .ToLocal(&copied)) | |
809 return v8::Undefined(m_isolate); | |
810 if (!createDataProperty(context, copiedArray, i, copied).FromMaybe(false)) | |
811 return v8::Undefined(m_isolate); | |
812 } | |
813 if (!markArrayEntriesAsInternal(context, | |
814 v8::Local<v8::Array>::Cast(copiedArray), | |
801 V8InternalValueType::kEntry)) | 815 V8InternalValueType::kEntry)) |
802 return v8::Undefined(m_isolate); | 816 return v8::Undefined(m_isolate); |
803 return copied; | 817 return copiedArray; |
804 } | 818 } |
805 | 819 |
806 v8::Local<v8::Value> V8Debugger::generatorObjectLocation( | 820 v8::Local<v8::Value> V8Debugger::generatorObjectLocation( |
807 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { | 821 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { |
808 if (!enabled()) { | 822 if (!enabled()) { |
809 UNREACHABLE(); | 823 UNREACHABLE(); |
810 return v8::Null(m_isolate); | 824 return v8::Null(m_isolate); |
811 } | 825 } |
812 v8::Local<v8::Value> argv[] = {object}; | 826 v8::Local<v8::Value> argv[] = {object}; |
813 v8::Local<v8::Value> location = | 827 v8::Local<v8::Value> location = |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
979 | 993 |
980 size_t stackSize = | 994 size_t stackSize = |
981 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 995 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
982 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 996 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
983 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 997 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
984 | 998 |
985 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 999 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
986 } | 1000 } |
987 | 1001 |
988 } // namespace v8_inspector | 1002 } // namespace v8_inspector |
OLD | NEW |