| OLD | NEW |
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 this._scriptsBySourceURL = new Map(); | 49 this._scriptsBySourceURL = new Map(); |
| 50 | 50 |
| 51 /** @type {!WebInspector.Object} */ | 51 /** @type {!WebInspector.Object} */ |
| 52 this._breakpointResolvedEventTarget = new WebInspector.Object(); | 52 this._breakpointResolvedEventTarget = new WebInspector.Object(); |
| 53 | 53 |
| 54 this._isPausing = false; | 54 this._isPausing = false; |
| 55 WebInspector.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this
._pauseOnExceptionStateChanged, this); | 55 WebInspector.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this
._pauseOnExceptionStateChanged, this); |
| 56 WebInspector.moduleSetting('pauseOnCaughtException').addChangeListener(this.
_pauseOnExceptionStateChanged, this); | 56 WebInspector.moduleSetting('pauseOnCaughtException').addChangeListener(this.
_pauseOnExceptionStateChanged, this); |
| 57 WebInspector.moduleSetting('enableAsyncStackTraces').addChangeListener(this.
asyncStackTracesStateChanged, this); | 57 WebInspector.moduleSetting('enableAsyncStackTraces').addChangeListener(this.
asyncStackTracesStateChanged, this); |
| 58 | 58 |
| 59 /** @type {!Map<string, string>} */ |
| 60 this._fileURLToNodeJSPath = new Map(); |
| 59 this.enableDebugger(); | 61 this.enableDebugger(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 /** | 64 /** |
| 63 * @return {!Array<!WebInspector.DebuggerModel>} | 65 * @return {!Array<!WebInspector.DebuggerModel>} |
| 64 */ | 66 */ |
| 65 static instances() { | 67 static instances() { |
| 66 var result = []; | 68 var result = []; |
| 67 for (var target of WebInspector.targetManager.targets()) { | 69 for (var target of WebInspector.targetManager.targets()) { |
| 68 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 70 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 196 } |
| 195 | 197 |
| 196 /** | 198 /** |
| 197 * @param {string} url | 199 * @param {string} url |
| 198 * @param {number} lineNumber | 200 * @param {number} lineNumber |
| 199 * @param {number=} columnNumber | 201 * @param {number=} columnNumber |
| 200 * @param {string=} condition | 202 * @param {string=} condition |
| 201 * @param {function(?DebuggerAgent.BreakpointId, !Array.<!WebInspector.Debugge
rModel.Location>)=} callback | 203 * @param {function(?DebuggerAgent.BreakpointId, !Array.<!WebInspector.Debugge
rModel.Location>)=} callback |
| 202 */ | 204 */ |
| 203 setBreakpointByURL(url, lineNumber, columnNumber, condition, callback) { | 205 setBreakpointByURL(url, lineNumber, columnNumber, condition, callback) { |
| 206 // Convert file url to node-js path. |
| 207 if (this.target().isNodeJS() && this._fileURLToNodeJSPath.has(url)) |
| 208 url = this._fileURLToNodeJSPath.get(url); |
| 204 // Adjust column if needed. | 209 // Adjust column if needed. |
| 205 var minColumnNumber = 0; | 210 var minColumnNumber = 0; |
| 206 var scripts = this._scriptsBySourceURL.get(url) || []; | 211 var scripts = this._scriptsBySourceURL.get(url) || []; |
| 207 for (var i = 0, l = scripts.length; i < l; ++i) { | 212 for (var i = 0, l = scripts.length; i < l; ++i) { |
| 208 var script = scripts[i]; | 213 var script = scripts[i]; |
| 209 if (lineNumber === script.lineOffset) | 214 if (lineNumber === script.lineOffset) |
| 210 minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.col
umnOffset) : script.columnOffset; | 215 minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.col
umnOffset) : script.columnOffset; |
| 211 } | 216 } |
| 212 columnNumber = Math.max(columnNumber, minColumnNumber); | 217 columnNumber = Math.max(columnNumber, minColumnNumber); |
| 213 | 218 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 hash, | 455 hash, |
| 451 executionContextAuxData, | 456 executionContextAuxData, |
| 452 isLiveEdit, | 457 isLiveEdit, |
| 453 sourceMapURL, | 458 sourceMapURL, |
| 454 hasSourceURL, | 459 hasSourceURL, |
| 455 hasSyntaxError) { | 460 hasSyntaxError) { |
| 456 var isContentScript = false; | 461 var isContentScript = false; |
| 457 if (executionContextAuxData && ('isDefault' in executionContextAuxData)) | 462 if (executionContextAuxData && ('isDefault' in executionContextAuxData)) |
| 458 isContentScript = !executionContextAuxData['isDefault']; | 463 isContentScript = !executionContextAuxData['isDefault']; |
| 459 // Support file URL for node.js. | 464 // Support file URL for node.js. |
| 460 if (this.target().isNodeJS() && sourceURL && sourceURL.startsWith('/')) | 465 if (this.target().isNodeJS() && sourceURL && sourceURL.startsWith('/')) { |
| 461 sourceURL = WebInspector.ParsedURL.platformPathToURL(sourceURL); | 466 var nodeJSPath = sourceURL; |
| 467 sourceURL = WebInspector.ParsedURL.platformPathToURL(nodeJSPath); |
| 468 this._fileURLToNodeJSPath.set(sourceURL, nodeJSPath); |
| 469 } |
| 462 var script = new WebInspector.Script( | 470 var script = new WebInspector.Script( |
| 463 this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, e
xecutionContextId, hash, | 471 this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, e
xecutionContextId, hash, |
| 464 isContentScript, isLiveEdit, sourceMapURL, hasSourceURL); | 472 isContentScript, isLiveEdit, sourceMapURL, hasSourceURL); |
| 465 this._registerScript(script); | 473 this._registerScript(script); |
| 466 if (!hasSyntaxError) | 474 if (!hasSyntaxError) |
| 467 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScri
ptSource, script); | 475 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScri
ptSource, script); |
| 468 else | 476 else |
| 469 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToPa
rseScriptSource, script); | 477 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToPa
rseScriptSource, script); |
| 470 return script; | 478 return script; |
| 471 } | 479 } |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 stack.callFrames.shift(); | 1289 stack.callFrames.shift(); |
| 1282 if (previous && !stack.callFrames.length) | 1290 if (previous && !stack.callFrames.length) |
| 1283 previous.parent = stack.parent; | 1291 previous.parent = stack.parent; |
| 1284 else | 1292 else |
| 1285 previous = stack; | 1293 previous = stack; |
| 1286 stack = stack.parent; | 1294 stack = stack.parent; |
| 1287 } | 1295 } |
| 1288 return asyncStackTrace; | 1296 return asyncStackTrace; |
| 1289 } | 1297 } |
| 1290 }; | 1298 }; |
| OLD | NEW |