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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 132 |
133 v8::MaybeLocal<v8::Object> firstArgAsObject() { | 133 v8::MaybeLocal<v8::Object> firstArgAsObject() { |
134 if (m_info.Length() < 1 || !m_info[0]->IsObject()) | 134 if (m_info.Length() < 1 || !m_info[0]->IsObject()) |
135 return v8::MaybeLocal<v8::Object>(); | 135 return v8::MaybeLocal<v8::Object>(); |
136 return m_info[0].As<v8::Object>(); | 136 return m_info[0].As<v8::Object>(); |
137 } | 137 } |
138 | 138 |
139 v8::MaybeLocal<v8::Function> firstArgAsFunction() { | 139 v8::MaybeLocal<v8::Function> firstArgAsFunction() { |
140 if (m_info.Length() < 1 || !m_info[0]->IsFunction()) | 140 if (m_info.Length() < 1 || !m_info[0]->IsFunction()) |
141 return v8::MaybeLocal<v8::Function>(); | 141 return v8::MaybeLocal<v8::Function>(); |
142 return m_info[0].As<v8::Function>(); | 142 v8::Local<v8::Function> func = m_info[0].As<v8::Function>(); |
143 v8::Local<v8::Value> targetFunction = func->GetBoundFunction(); | |
144 while (targetFunction->IsFunction()) { | |
dgozman
2016/10/05 17:23:32
while (func->GetBoundFunction()->IsFunction())
f
kozy
2016/10/05 17:33:10
Done.
| |
145 func = targetFunction.As<v8::Function>(); | |
146 targetFunction = targetFunction.As<v8::Function>()->GetBoundFunction(); | |
147 } | |
148 return func; | |
143 } | 149 } |
144 | 150 |
145 v8::MaybeLocal<v8::Map> privateMap(const char* name) { | 151 v8::MaybeLocal<v8::Map> privateMap(const char* name) { |
146 v8::Local<v8::Object> console = ensureConsole(); | 152 v8::Local<v8::Object> console = ensureConsole(); |
147 v8::Local<v8::Private> privateKey = | 153 v8::Local<v8::Private> privateKey = |
148 v8::Private::ForApi(m_isolate, toV8StringInternalized(m_isolate, name)); | 154 v8::Private::ForApi(m_isolate, toV8StringInternalized(m_isolate, name)); |
149 v8::Local<v8::Value> mapValue; | 155 v8::Local<v8::Value> mapValue; |
150 if (!console->GetPrivate(m_context, privateKey).ToLocal(&mapValue)) | 156 if (!console->GetPrivate(m_context, privateKey).ToLocal(&mapValue)) |
151 return v8::MaybeLocal<v8::Map>(); | 157 return v8::MaybeLocal<v8::Map>(); |
152 if (mapValue->IsUndefined()) { | 158 if (mapValue->IsUndefined()) { |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 ->GetOwnPropertyDescriptor( | 916 ->GetOwnPropertyDescriptor( |
911 m_context, v8::Local<v8::String>::Cast(name)) | 917 m_context, v8::Local<v8::String>::Cast(name)) |
912 .ToLocal(&descriptor); | 918 .ToLocal(&descriptor); |
913 DCHECK(success); | 919 DCHECK(success); |
914 USE(success); | 920 USE(success); |
915 } | 921 } |
916 } | 922 } |
917 } | 923 } |
918 | 924 |
919 } // namespace v8_inspector | 925 } // namespace v8_inspector |
OLD | NEW |