OLD | NEW |
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 * @param {!RuntimeAgent.ScriptId=} scriptId | 241 * @param {!RuntimeAgent.ScriptId=} scriptId |
242 * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails | 242 * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails |
243 * @this {WebInspector.ScriptSnippetModel} | 243 * @this {WebInspector.ScriptSnippetModel} |
244 */ | 244 */ |
245 function compileCallback(scriptId, exceptionDetails) | 245 function compileCallback(scriptId, exceptionDetails) |
246 { | 246 { |
247 var mapping = this._mappingForTarget.get(target); | 247 var mapping = this._mappingForTarget.get(target); |
248 if (mapping.evaluationIndex(uiSourceCode) !== evaluationIndex) | 248 if (mapping.evaluationIndex(uiSourceCode) !== evaluationIndex) |
249 return; | 249 return; |
250 | 250 |
251 var script = /** @type {!WebInspector.Script} */(executionContext.de
buggerModel.scriptForId(scriptId || exceptionDetails.scriptId)); | 251 var script = /** @type {!WebInspector.Script} */(executionContext.de
buggerModel.scriptForId(/** @type {string} */ (scriptId || exceptionDetails.scri
ptId))); |
252 mapping._addScript(script, uiSourceCode); | 252 mapping._addScript(script, uiSourceCode); |
253 if (!scriptId) { | 253 if (!scriptId) { |
254 this._printRunOrCompileScriptResultFailure(target, exceptionDeta
ils, evaluationUrl); | 254 this._printRunOrCompileScriptResultFailure(target, /** @type {!R
untimeAgent.ExceptionDetails} */ (exceptionDetails), evaluationUrl); |
255 return; | 255 return; |
256 } | 256 } |
257 | 257 |
258 var breakpointLocations = this._removeBreakpoints(uiSourceCode); | 258 var breakpointLocations = this._removeBreakpoints(uiSourceCode); |
259 this._restoreBreakpoints(uiSourceCode, breakpointLocations); | 259 this._restoreBreakpoints(uiSourceCode, breakpointLocations); |
260 | 260 |
261 this._runScript(scriptId, executionContext, evaluationUrl); | 261 this._runScript(scriptId, executionContext, evaluationUrl); |
262 } | 262 } |
263 }, | 263 }, |
264 | 264 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 [result], | 308 [result], |
309 undefined, | 309 undefined, |
310 undefined, | 310 undefined, |
311 undefined, | 311 undefined, |
312 scriptId); | 312 scriptId); |
313 target.consoleModel.addMessage(consoleMessage); | 313 target.consoleModel.addMessage(consoleMessage); |
314 }, | 314 }, |
315 | 315 |
316 /** | 316 /** |
317 * @param {!WebInspector.Target} target | 317 * @param {!WebInspector.Target} target |
318 * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails | 318 * @param {!RuntimeAgent.ExceptionDetails} exceptionDetails |
319 * @param {?string=} sourceURL | 319 * @param {?string=} sourceURL |
320 */ | 320 */ |
321 _printRunOrCompileScriptResultFailure: function(target, exceptionDetails, so
urceURL) | 321 _printRunOrCompileScriptResultFailure: function(target, exceptionDetails, so
urceURL) |
322 { | 322 { |
323 var consoleMessage = new WebInspector.ConsoleMessage( | 323 target.consoleModel.addMessage(WebInspector.ConsoleMessage.fromException
(target, exceptionDetails, undefined, undefined, sourceURL || undefined)); |
324 target, | |
325 exceptionDetails.source, | |
326 WebInspector.ConsoleMessage.MessageLevel.Error, | |
327 exceptionDetails.text, | |
328 undefined, | |
329 sourceURL, | |
330 exceptionDetails.lineNumber, | |
331 exceptionDetails.columnNumber, | |
332 undefined, | |
333 undefined, | |
334 exceptionDetails.stackTrace, | |
335 undefined, | |
336 undefined, | |
337 exceptionDetails.stackTrace ? undefined : exceptionDetails.scriptId)
; | |
338 target.consoleModel.addMessage(consoleMessage); | |
339 }, | 324 }, |
340 | 325 |
341 /** | 326 /** |
342 * @param {!WebInspector.UISourceCode} uiSourceCode | 327 * @param {!WebInspector.UISourceCode} uiSourceCode |
343 * @return {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint
, uiLocation: !WebInspector.UILocation}>} | 328 * @return {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint
, uiLocation: !WebInspector.UILocation}>} |
344 */ | 329 */ |
345 _removeBreakpoints: function(uiSourceCode) | 330 _removeBreakpoints: function(uiSourceCode) |
346 { | 331 { |
347 var breakpointLocations = WebInspector.breakpointManager.breakpointLocat
ionsForUISourceCode(uiSourceCode); | 332 var breakpointLocations = WebInspector.breakpointManager.breakpointLocat
ionsForUISourceCode(uiSourceCode); |
348 for (var i = 0; i < breakpointLocations.length; ++i) | 333 for (var i = 0; i < breakpointLocations.length; ++i) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 this._model.deleteScriptSnippet(url); | 669 this._model.deleteScriptSnippet(url); |
685 }, | 670 }, |
686 | 671 |
687 __proto__: WebInspector.ContentProviderBasedProject.prototype | 672 __proto__: WebInspector.ContentProviderBasedProject.prototype |
688 } | 673 } |
689 | 674 |
690 /** | 675 /** |
691 * @type {!WebInspector.ScriptSnippetModel} | 676 * @type {!WebInspector.ScriptSnippetModel} |
692 */ | 677 */ |
693 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); | 678 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); |
OLD | NEW |