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

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

Issue 272613002: DevTools: implemented scriptFailedToParse protocol event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 return String(); 1107 return String();
1108 1108
1109 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); 1109 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent();
1110 if (!pageAgent) 1110 if (!pageAgent)
1111 return String(); 1111 return String();
1112 return pageAgent->resourceSourceMapURL(script.url); 1112 return pageAgent->resourceSourceMapURL(script.url);
1113 } 1113 }
1114 1114
1115 // JavaScriptDebugListener functions 1115 // JavaScriptDebugListener functions
1116 1116
1117 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script & script) 1117 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script & script, bool hasSyntaxError)
1118 { 1118 {
1119 // Don't send script content to the front end until it's really needed. 1119 // Don't send script content to the front end until it's really needed.
1120 const bool* isContentScript = script.isContentScript ? &script.isContentScri pt : 0; 1120 const bool* isContentScript = script.isContentScript ? &script.isContentScri pt : 0;
1121 String sourceMapURL = sourceMapURLForScript(script); 1121 String sourceMapURL = sourceMapURLForScript(script);
1122 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; 1122 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL;
1123 String sourceURL; 1123 String sourceURL;
1124 if (!script.startLine && !script.startColumn) { 1124 if (!script.startLine && !script.startColumn) {
1125 bool deprecated; 1125 bool deprecated;
1126 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear chUtils::JavaScriptMagicComment, &deprecated); 1126 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear chUtils::JavaScriptMagicComment, &deprecated);
1127 // FIXME: add deprecated console message here. 1127 // FIXME: add deprecated console message here.
1128 } 1128 }
1129 bool hasSourceURL = !sourceURL.isEmpty(); 1129 bool hasSourceURL = !sourceURL.isEmpty();
1130 String scriptURL = hasSourceURL ? sourceURL : script.url; 1130 String scriptURL = hasSourceURL ? sourceURL : script.url;
1131 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; 1131 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0;
1132 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha sSourceURLParam); 1132 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha sSourceURLParam, hasSyntaxError);
1133 1133
1134 m_scripts.set(scriptId, script); 1134 m_scripts.set(scriptId, script);
1135 1135
1136 if (scriptURL.isEmpty()) 1136 if (scriptURL.isEmpty() || hasSyntaxError)
1137 return; 1137 return;
1138 1138
1139 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints); 1139 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints);
1140 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints Cookie->end(); ++it) { 1140 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints Cookie->end(); ++it) {
1141 RefPtr<JSONObject> breakpointObject = it->value->asObject(); 1141 RefPtr<JSONObject> breakpointObject = it->value->asObject();
1142 bool isAntibreakpoint; 1142 bool isAntibreakpoint;
1143 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi nt); 1143 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi nt);
1144 if (isAntibreakpoint) 1144 if (isAntibreakpoint)
1145 continue; 1145 continue;
1146 bool isRegex; 1146 bool isRegex;
1147 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); 1147 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
1148 String url; 1148 String url;
1149 breakpointObject->getString(DebuggerAgentState::url, &url); 1149 breakpointObject->getString(DebuggerAgentState::url, &url);
1150 if (!matches(scriptURL, url, isRegex)) 1150 if (!matches(scriptURL, url, isRegex))
1151 continue; 1151 continue;
1152 ScriptBreakpoint breakpoint; 1152 ScriptBreakpoint breakpoint;
1153 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); 1153 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber);
1154 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); 1154 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber);
1155 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); 1155 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition);
1156 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it- >key, scriptId, breakpoint, UserBreakpointSource); 1156 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it- >key, scriptId, breakpoint, UserBreakpointSource);
1157 if (location) 1157 if (location)
1158 m_frontend->breakpointResolved(it->key, location); 1158 m_frontend->breakpointResolved(it->key, location);
1159 } 1159 }
1160 } 1160 }
1161 1161
1162 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String & data, int firstLine, int errorLine, const String& errorMessage)
1163 {
1164 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag e);
1165 }
1166
1167 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co nst Vector<String>& hitBreakpoints) 1162 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co nst Vector<String>& hitBreakpoints)
1168 { 1163 {
1169 ScriptDebugListener::SkipPauseRequest result; 1164 ScriptDebugListener::SkipPauseRequest result;
1170 if (m_javaScriptPauseScheduled) 1165 if (m_javaScriptPauseScheduled)
1171 result = ScriptDebugListener::NoSkip; // Don't skip explicit pause reque sts from front-end. 1166 result = ScriptDebugListener::NoSkip; // Don't skip explicit pause reque sts from front-end.
1172 else if (m_skipAllPauses) 1167 else if (m_skipAllPauses)
1173 result = ScriptDebugListener::Continue; 1168 result = ScriptDebugListener::Continue;
1174 else if (!hitBreakpoints.isEmpty()) 1169 else if (!hitBreakpoints.isEmpty())
1175 result = ScriptDebugListener::NoSkip; // Don't skip explicit breakpoints even if set in frameworks. 1170 result = ScriptDebugListener::NoSkip; // Don't skip explicit breakpoints even if set in frameworks.
1176 else if (!exception.isEmpty()) 1171 else if (!exception.isEmpty())
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 { 1294 {
1300 m_scripts.clear(); 1295 m_scripts.clear();
1301 m_breakpointIdToDebugServerBreakpointIds.clear(); 1296 m_breakpointIdToDebugServerBreakpointIds.clear();
1302 m_asyncCallStackTracker.clear(); 1297 m_asyncCallStackTracker.clear();
1303 if (m_frontend) 1298 if (m_frontend)
1304 m_frontend->globalObjectCleared(); 1299 m_frontend->globalObjectCleared();
1305 } 1300 }
1306 1301
1307 } // namespace WebCore 1302 } // namespace WebCore
1308 1303
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698