summaryrefslogtreecommitdiff
path: root/chromium/v8/src/debug/debug-scope-iterator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/debug/debug-scope-iterator.cc')
-rw-r--r--chromium/v8/src/debug/debug-scope-iterator.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/chromium/v8/src/debug/debug-scope-iterator.cc b/chromium/v8/src/debug/debug-scope-iterator.cc
index 5dc377375ee..2e06dccab68 100644
--- a/chromium/v8/src/debug/debug-scope-iterator.cc
+++ b/chromium/v8/src/debug/debug-scope-iterator.cc
@@ -15,13 +15,22 @@ namespace v8 {
std::unique_ptr<debug::ScopeIterator> debug::ScopeIterator::CreateForFunction(
v8::Isolate* v8_isolate, v8::Local<v8::Function> v8_func) {
- internal::Handle<internal::JSFunction> func =
- internal::Handle<internal::JSFunction>::cast(Utils::OpenHandle(*v8_func));
+ internal::Handle<internal::JSReceiver> receiver =
+ internal::Handle<internal::JSReceiver>::cast(Utils::OpenHandle(*v8_func));
+
+ // Besides JSFunction and JSBoundFunction, {v8_func} could be an
+ // ObjectTemplate with a CallAsFunctionHandler. We only handle plain
+ // JSFunctions.
+ if (!receiver->IsJSFunction()) return nullptr;
+
+ internal::Handle<internal::JSFunction> function =
+ internal::Handle<internal::JSFunction>::cast(receiver);
+
// Blink has function objects with callable map, JS_SPECIAL_API_OBJECT_TYPE
// but without context on heap.
- if (!func->has_context()) return nullptr;
+ if (!function->has_context()) return nullptr;
return std::unique_ptr<debug::ScopeIterator>(new internal::DebugScopeIterator(
- reinterpret_cast<internal::Isolate*>(v8_isolate), func));
+ reinterpret_cast<internal::Isolate*>(v8_isolate), function));
}
std::unique_ptr<debug::ScopeIterator>