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

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

Issue 470143002: DevTools: Take sourceURL into consideration in debugger agent when matching script url. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 RefPtr<JSONObject> breakpointObject = JSONObject::create(); 297 RefPtr<JSONObject> breakpointObject = JSONObject::create();
298 breakpointObject->setString(DebuggerAgentState::url, url); 298 breakpointObject->setString(DebuggerAgentState::url, url);
299 breakpointObject->setNumber(DebuggerAgentState::lineNumber, lineNumber); 299 breakpointObject->setNumber(DebuggerAgentState::lineNumber, lineNumber);
300 breakpointObject->setNumber(DebuggerAgentState::columnNumber, columnNumber); 300 breakpointObject->setNumber(DebuggerAgentState::columnNumber, columnNumber);
301 breakpointObject->setString(DebuggerAgentState::condition, condition); 301 breakpointObject->setString(DebuggerAgentState::condition, condition);
302 breakpointObject->setBoolean(DebuggerAgentState::isRegex, isRegex); 302 breakpointObject->setBoolean(DebuggerAgentState::isRegex, isRegex);
303 breakpointObject->setBoolean(DebuggerAgentState::isAnti, isAnti); 303 breakpointObject->setBoolean(DebuggerAgentState::isAnti, isAnti);
304 return breakpointObject; 304 return breakpointObject;
305 } 305 }
306 306
307 static String scriptSourceURL(const ScriptDebugListener::Script& script)
308 {
309 bool hasSourceURL = !script.sourceURL.isEmpty();
310 return hasSourceURL ? script.sourceURL : script.url;
311 }
312
307 static bool matches(const String& url, const String& pattern, bool isRegex) 313 static bool matches(const String& url, const String& pattern, bool isRegex)
308 { 314 {
309 if (isRegex) { 315 if (isRegex) {
310 ScriptRegexp regex(pattern, TextCaseSensitive); 316 ScriptRegexp regex(pattern, TextCaseSensitive);
311 return regex.match(url) != -1; 317 return regex.match(url) != -1;
312 } 318 }
313 return url == pattern; 319 return url == pattern;
314 } 320 }
315 321
316 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li neNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, c onst bool* isAntiBreakpoint, BreakpointId* outBreakpointId, RefPtr<Array<TypeBui lder::Debugger::Location> >& locations) 322 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li neNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, c onst bool* isAntiBreakpoint, BreakpointId* outBreakpointId, RefPtr<Array<TypeBui lder::Debugger::Location> >& locations)
(...skipping 26 matching lines...) Expand all
343 *errorString = "Breakpoint at specified location already exists."; 349 *errorString = "Breakpoint at specified location already exists.";
344 return; 350 return;
345 } 351 }
346 352
347 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex, isAntiBreakpointValue)); 353 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex, isAntiBreakpointValue));
348 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie); 354 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie);
349 355
350 if (!isAntiBreakpointValue) { 356 if (!isAntiBreakpointValue) {
351 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); 357 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
352 for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) { 358 for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
353 if (!matches(it->value.url, url, isRegex)) 359 if (!matches(scriptSourceURL(it->value), url, isRegex))
354 continue; 360 continue;
355 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint (breakpointId, it->key, breakpoint, UserBreakpointSource); 361 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint (breakpointId, it->key, breakpoint, UserBreakpointSource);
356 if (location) 362 if (location)
357 locations->addItem(location); 363 locations->addItem(location);
358 } 364 }
359 } 365 }
360 *outBreakpointId = breakpointId; 366 *outBreakpointId = breakpointId;
361 } 367 }
362 368
363 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat ion, String* scriptId, int* lineNumber, int* columnNumber) 369 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat ion, String* scriptId, int* lineNumber, int* columnNumber)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 return frame.release(); 485 return frame.release();
480 } 486 }
481 } 487 }
482 488
483 String InspectorDebuggerAgent::scriptURL(JavaScriptCallFrame* frame) 489 String InspectorDebuggerAgent::scriptURL(JavaScriptCallFrame* frame)
484 { 490 {
485 String scriptIdString = String::number(frame->sourceID()); 491 String scriptIdString = String::number(frame->sourceID());
486 ScriptsMap::iterator it = m_scripts.find(scriptIdString); 492 ScriptsMap::iterator it = m_scripts.find(scriptIdString);
487 if (it == m_scripts.end()) 493 if (it == m_scripts.end())
488 return String(); 494 return String();
489 return it->value.url; 495 return scriptSourceURL(it->value);
490 } 496 }
491 497
492 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptio nPause() 498 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptio nPause()
493 { 499 {
494 if (m_steppingFromFramework) 500 if (m_steppingFromFramework)
495 return ScriptDebugListener::NoSkip; 501 return ScriptDebugListener::NoSkip;
496 502
497 // FIXME: Fast return: if (!m_cachedSkipStackRegExp && !has_any_anti_breakpo int) return ScriptDebugListener::NoSkip; 503 // FIXME: Fast return: if (!m_cachedSkipStackRegExp && !has_any_anti_breakpo int) return ScriptDebugListener::NoSkip;
498 504
499 RefPtrWillBeRawPtr<JavaScriptCallFrame> topFrame = topCallFrameSkipUnknownSo urces(); 505 RefPtrWillBeRawPtr<JavaScriptCallFrame> topFrame = topCallFrameSkipUnknownSo urces();
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 void InspectorDebuggerAgent::trace(Visitor* visitor) 1455 void InspectorDebuggerAgent::trace(Visitor* visitor)
1450 { 1456 {
1451 visitor->trace(m_injectedScriptManager); 1457 visitor->trace(m_injectedScriptManager);
1452 visitor->trace(m_listener); 1458 visitor->trace(m_listener);
1453 visitor->trace(m_asyncCallStackTracker); 1459 visitor->trace(m_asyncCallStackTracker);
1454 InspectorBaseAgent::trace(visitor); 1460 InspectorBaseAgent::trace(visitor);
1455 } 1461 }
1456 1462
1457 } // namespace blink 1463 } // namespace blink
1458 1464
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698