| OLD | NEW |
| 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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 return String(); | 1192 return String(); |
| 1193 | 1193 |
| 1194 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); | 1194 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); |
| 1195 if (!pageAgent) | 1195 if (!pageAgent) |
| 1196 return String(); | 1196 return String(); |
| 1197 return pageAgent->resourceSourceMapURL(script.url); | 1197 return pageAgent->resourceSourceMapURL(script.url); |
| 1198 } | 1198 } |
| 1199 | 1199 |
| 1200 // JavaScriptDebugListener functions | 1200 // JavaScriptDebugListener functions |
| 1201 | 1201 |
| 1202 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
& script) | 1202 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
& script, CompileResult compileResult) |
| 1203 { | 1203 { |
| 1204 // Don't send script content to the front end until it's really needed. | 1204 // Don't send script content to the front end until it's really needed. |
| 1205 const bool* isContentScript = script.isContentScript ? &script.isContentScri
pt : 0; | 1205 const bool* isContentScript = script.isContentScript ? &script.isContentScri
pt : 0; |
| 1206 String sourceMapURL = sourceMapURLForScript(script); | 1206 String sourceMapURL = sourceMapURLForScript(script); |
| 1207 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; | 1207 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; |
| 1208 String sourceURL; | 1208 String sourceURL; |
| 1209 if (!script.startLine && !script.startColumn) { | 1209 if (!script.startLine && !script.startColumn) { |
| 1210 bool deprecated; | 1210 bool deprecated; |
| 1211 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear
chUtils::JavaScriptMagicComment, &deprecated); | 1211 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear
chUtils::JavaScriptMagicComment, &deprecated); |
| 1212 // FIXME: add deprecated console message here. | 1212 // FIXME: add deprecated console message here. |
| 1213 } | 1213 } |
| 1214 bool hasSourceURL = !sourceURL.isEmpty(); | 1214 bool hasSourceURL = !sourceURL.isEmpty(); |
| 1215 String scriptURL = hasSourceURL ? sourceURL : script.url; | 1215 String scriptURL = hasSourceURL ? sourceURL : script.url; |
| 1216 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; | 1216 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; |
| 1217 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start
Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha
sSourceURLParam); | 1217 bool hasSyntaxError = compileResult != CompileSuccess; |
| 1218 if (!hasSyntaxError) |
| 1219 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.s
tartColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam
, hasSourceURLParam); |
| 1220 else |
| 1221 m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine, s
cript.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapU
RLParam, hasSourceURLParam); |
| 1218 | 1222 |
| 1219 m_scripts.set(scriptId, script); | 1223 m_scripts.set(scriptId, script); |
| 1220 | 1224 |
| 1221 if (scriptURL.isEmpty()) | 1225 if (scriptURL.isEmpty() || hasSyntaxError) |
| 1222 return; | 1226 return; |
| 1223 | 1227 |
| 1224 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); | 1228 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); |
| 1225 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints
Cookie->end(); ++it) { | 1229 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints
Cookie->end(); ++it) { |
| 1226 RefPtr<JSONObject> breakpointObject = it->value->asObject(); | 1230 RefPtr<JSONObject> breakpointObject = it->value->asObject(); |
| 1227 bool isAntibreakpoint; | 1231 bool isAntibreakpoint; |
| 1228 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi
nt); | 1232 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi
nt); |
| 1229 if (isAntibreakpoint) | 1233 if (isAntibreakpoint) |
| 1230 continue; | 1234 continue; |
| 1231 bool isRegex; | 1235 bool isRegex; |
| 1232 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); | 1236 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); |
| 1233 String url; | 1237 String url; |
| 1234 breakpointObject->getString(DebuggerAgentState::url, &url); | 1238 breakpointObject->getString(DebuggerAgentState::url, &url); |
| 1235 if (!matches(scriptURL, url, isRegex)) | 1239 if (!matches(scriptURL, url, isRegex)) |
| 1236 continue; | 1240 continue; |
| 1237 ScriptBreakpoint breakpoint; | 1241 ScriptBreakpoint breakpoint; |
| 1238 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); | 1242 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); |
| 1239 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); | 1243 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); |
| 1240 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); | 1244 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); |
| 1241 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it-
>key, scriptId, breakpoint, UserBreakpointSource); | 1245 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it-
>key, scriptId, breakpoint, UserBreakpointSource); |
| 1242 if (location) | 1246 if (location) |
| 1243 m_frontend->breakpointResolved(it->key, location); | 1247 m_frontend->breakpointResolved(it->key, location); |
| 1244 } | 1248 } |
| 1245 } | 1249 } |
| 1246 | 1250 |
| 1247 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String
& data, int firstLine, int errorLine, const String& errorMessage) | |
| 1248 { | |
| 1249 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag
e); | |
| 1250 } | |
| 1251 | |
| 1252 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta
te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co
nst Vector<String>& hitBreakpoints) | 1251 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta
te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co
nst Vector<String>& hitBreakpoints) |
| 1253 { | 1252 { |
| 1254 ScriptDebugListener::SkipPauseRequest result; | 1253 ScriptDebugListener::SkipPauseRequest result; |
| 1255 if (m_javaScriptPauseScheduled) | 1254 if (m_javaScriptPauseScheduled) |
| 1256 result = ScriptDebugListener::NoSkip; // Don't skip explicit pause reque
sts from front-end. | 1255 result = ScriptDebugListener::NoSkip; // Don't skip explicit pause reque
sts from front-end. |
| 1257 else if (m_skipAllPauses) | 1256 else if (m_skipAllPauses) |
| 1258 result = ScriptDebugListener::Continue; | 1257 result = ScriptDebugListener::Continue; |
| 1259 else if (!hitBreakpoints.isEmpty()) | 1258 else if (!hitBreakpoints.isEmpty()) |
| 1260 result = ScriptDebugListener::NoSkip; // Don't skip explicit breakpoints
even if set in frameworks. | 1259 result = ScriptDebugListener::NoSkip; // Don't skip explicit breakpoints
even if set in frameworks. |
| 1261 else if (!exception.isEmpty()) | 1260 else if (!exception.isEmpty()) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 { | 1383 { |
| 1385 m_scripts.clear(); | 1384 m_scripts.clear(); |
| 1386 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1385 m_breakpointIdToDebugServerBreakpointIds.clear(); |
| 1387 m_asyncCallStackTracker.clear(); | 1386 m_asyncCallStackTracker.clear(); |
| 1388 if (m_frontend) | 1387 if (m_frontend) |
| 1389 m_frontend->globalObjectCleared(); | 1388 m_frontend->globalObjectCleared(); |
| 1390 } | 1389 } |
| 1391 | 1390 |
| 1392 } // namespace WebCore | 1391 } // namespace WebCore |
| 1393 | 1392 |
| OLD | NEW |