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

Side by Side Diff: Source/core/inspector/InjectedScriptBase.cpp

Issue 566883002: [DevTools] Report correct syntax error location for evaluated in console script (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/core/inspector/JavaScriptCallFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 RefPtr<TypeBuilder::Debugger::ExceptionDetails> exceptionDetails = TypeBuild er::Debugger::ExceptionDetails::create().setText(text); 53 RefPtr<TypeBuilder::Debugger::ExceptionDetails> exceptionDetails = TypeBuild er::Debugger::ExceptionDetails::create().setText(text);
54 String url; 54 String url;
55 if (object->getString("url", &url)) 55 if (object->getString("url", &url))
56 exceptionDetails->setUrl(url); 56 exceptionDetails->setUrl(url);
57 int line = 0; 57 int line = 0;
58 if (object->getNumber("line", &line)) 58 if (object->getNumber("line", &line))
59 exceptionDetails->setLine(line); 59 exceptionDetails->setLine(line);
60 int column = 0; 60 int column = 0;
61 if (object->getNumber("column", &column)) 61 if (object->getNumber("column", &column))
62 exceptionDetails->setColumn(column); 62 exceptionDetails->setColumn(column);
63 int originScriptId = 0;
64 object->getNumber("scriptId", &originScriptId);
65
63 RefPtr<JSONArray> stackTrace = object->getArray("stackTrace"); 66 RefPtr<JSONArray> stackTrace = object->getArray("stackTrace");
64 if (stackTrace && stackTrace->length() > 0) { 67 if (stackTrace && stackTrace->length() > 0) {
65 RefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > frames = Ty peBuilder::Array<TypeBuilder::Console::CallFrame>::create(); 68 RefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > frames = Ty peBuilder::Array<TypeBuilder::Console::CallFrame>::create();
66 for (unsigned i = 0; i < stackTrace->length(); ++i) { 69 for (unsigned i = 0; i < stackTrace->length(); ++i) {
67 RefPtr<JSONObject> stackFrame = stackTrace->get(i)->asObject(); 70 RefPtr<JSONObject> stackFrame = stackTrace->get(i)->asObject();
68 int lineNumber = 0; 71 int lineNumber = 0;
69 stackFrame->getNumber("lineNumber", &lineNumber); 72 stackFrame->getNumber("lineNumber", &lineNumber);
70 int column = 0; 73 int column = 0;
71 stackFrame->getNumber("column", &column); 74 stackFrame->getNumber("column", &column);
72 int scriptId = 0; 75 int scriptId = 0;
73 stackFrame->getNumber("scriptId", &scriptId); 76 stackFrame->getNumber("scriptId", &scriptId);
77 if (i == 0 && scriptId == originScriptId)
apavlov 2014/10/03 09:54:43 !i
kozyatinskiy1 2014/10/03 10:08:26 Done.
78 originScriptId = 0;
79
74 String sourceURL; 80 String sourceURL;
75 stackFrame->getString("scriptNameOrSourceURL", &sourceURL); 81 stackFrame->getString("scriptNameOrSourceURL", &sourceURL);
76 String functionName; 82 String functionName;
77 stackFrame->getString("functionName", &functionName); 83 stackFrame->getString("functionName", &functionName);
78 84
79 RefPtr<TypeBuilder::Console::CallFrame> callFrame = TypeBuilder::Con sole::CallFrame::create() 85 RefPtr<TypeBuilder::Console::CallFrame> callFrame = TypeBuilder::Con sole::CallFrame::create()
80 .setFunctionName(functionName) 86 .setFunctionName(functionName)
81 .setScriptId(String::number(scriptId)) 87 .setScriptId(String::number(scriptId))
82 .setUrl(sourceURL) 88 .setUrl(sourceURL)
83 .setLineNumber(lineNumber) 89 .setLineNumber(lineNumber)
84 .setColumnNumber(column); 90 .setColumnNumber(column);
85 91
86 frames->addItem(callFrame.release()); 92 frames->addItem(callFrame.release());
87 } 93 }
88 exceptionDetails->setStackTrace(frames.release()); 94 exceptionDetails->setStackTrace(frames.release());
89 } 95 }
96 if (originScriptId)
97 exceptionDetails->setScriptId(String::number(originScriptId));
90 return exceptionDetails.release(); 98 return exceptionDetails.release();
91 } 99 }
92 100
93 InjectedScriptBase::InjectedScriptBase(const String& name) 101 InjectedScriptBase::InjectedScriptBase(const String& name)
94 : m_name(name) 102 : m_name(name)
95 , m_inspectedStateAccessCheck(0) 103 , m_inspectedStateAccessCheck(0)
96 { 104 {
97 } 105 }
98 106
99 InjectedScriptBase::InjectedScriptBase(const String& name, ScriptValue injectedS criptObject, InspectedStateAccessCheck accessCheck) 107 InjectedScriptBase::InjectedScriptBase(const String& name, ScriptValue injectedS criptObject, InspectedStateAccessCheck accessCheck)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 RefPtr<JSONObject> objectExceptionDetails = resultPair->getObject("excep tionDetails"); 204 RefPtr<JSONObject> objectExceptionDetails = resultPair->getObject("excep tionDetails");
197 if (objectExceptionDetails) 205 if (objectExceptionDetails)
198 *exceptionDetails = toExceptionDetails(objectExceptionDetails.releas e()); 206 *exceptionDetails = toExceptionDetails(objectExceptionDetails.releas e());
199 } 207 }
200 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); 208 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj);
201 *wasThrown = wasThrownVal; 209 *wasThrown = wasThrownVal;
202 } 210 }
203 211
204 } // namespace blink 212 } // namespace blink
205 213
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/JavaScriptCallFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698