Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp

Issue 1653053002: Devtools: parse variables scopes and sourcemap them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const 144 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const
145 { 145 {
146 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame); 146 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
147 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, "scopeName"))); 147 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, "scopeName")));
148 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callIn ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); 148 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callIn ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
149 return scopeType->Get(scopeIndex)->ToString(); 149 return scopeType->Get(scopeIndex)->ToString();
150 } 150 }
151 151
152 v8::Local<v8::Value> JavaScriptCallFrame::scopeStartLocation(int scopeIndex) con st
153 {
154 return callScopeLocationFunction("scopeStartLocation", scopeIndex);
155 }
156
157 v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const
158 {
159 return callScopeLocationFunction("scopeEndLocation", scopeIndex);
160 }
161
162 v8::Local<v8::Value> JavaScriptCallFrame::callScopeLocationFunction(const char* name, int scopeIndex) const
163 {
164 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca llFrame);
165 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get( toV8StringInternalized(m_isolate, name)));
166 v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callIn ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
167 return locations->Get(scopeIndex);
168 }
169
152 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const 170 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const
153 { 171 {
154 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt ernalized(m_isolate, "thisObject")); 172 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt ernalized(m_isolate, "thisObject"));
155 } 173 }
156 174
157 String JavaScriptCallFrame::stepInPositions() const 175 String JavaScriptCallFrame::stepInPositions() const
158 { 176 {
159 return callV8FunctionReturnString("stepInPositions"); 177 return callV8FunctionReturnString("stepInPositions");
160 } 178 }
161 179
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer: :New(isolate, message->GetLineNumber())); 244 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer: :New(isolate, message->GetLineNumber()));
227 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege r::New(isolate, message->GetStartColumn())); 245 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege r::New(isolate, message->GetStartColumn()));
228 if (!message->GetStackTrace().IsEmpty()) 246 if (!message->GetStackTrace().IsEmpty())
229 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me ssage->GetStackTrace()->AsArray()); 247 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me ssage->GetStackTrace()->AsArray());
230 else 248 else
231 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8 ::Undefined(isolate)); 249 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8 ::Undefined(isolate));
232 return exceptionDetails; 250 return exceptionDetails;
233 } 251 }
234 252
235 } // namespace blink 253 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698