OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 this.addMessage(consoleMessage); | 200 this.addMessage(consoleMessage); |
201 } | 201 } |
202 | 202 |
203 /** | 203 /** |
204 * @param {!SDK.RuntimeModel} runtimeModel | 204 * @param {!SDK.RuntimeModel} runtimeModel |
205 * @param {!Common.Event} event | 205 * @param {!Common.Event} event |
206 */ | 206 */ |
207 _exceptionThrown(runtimeModel, event) { | 207 _exceptionThrown(runtimeModel, event) { |
208 var exceptionWithTimestamp = /** @type {!SDK.RuntimeModel.ExceptionWithTimes
tamp} */ (event.data); | 208 var exceptionWithTimestamp = /** @type {!SDK.RuntimeModel.ExceptionWithTimes
tamp} */ (event.data); |
209 var consoleMessage = ConsoleModel.ConsoleMessage.fromException( | 209 var consoleMessage = ConsoleModel.ConsoleMessage.fromException( |
210 runtimeModel.target(), exceptionWithTimestamp.details, undefined, except
ionWithTimestamp.timestamp, undefined); | 210 runtimeModel, exceptionWithTimestamp.details, undefined, exceptionWithTi
mestamp.timestamp, undefined); |
211 consoleMessage.setExceptionId(exceptionWithTimestamp.details.exceptionId); | 211 consoleMessage.setExceptionId(exceptionWithTimestamp.details.exceptionId); |
212 this.addMessage(consoleMessage); | 212 this.addMessage(consoleMessage); |
213 } | 213 } |
214 | 214 |
215 /** | 215 /** |
216 * @param {!SDK.RuntimeModel} runtimeModel | 216 * @param {!SDK.RuntimeModel} runtimeModel |
217 * @param {!Common.Event} event | 217 * @param {!Common.Event} event |
218 */ | 218 */ |
219 _exceptionRevoked(runtimeModel, event) { | 219 _exceptionRevoked(runtimeModel, event) { |
220 var exceptionId = /** @type {number} */ (event.data); | 220 var exceptionId = /** @type {number} */ (event.data); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 /** | 453 /** |
454 * @param {!ConsoleModel.ConsoleMessage} a | 454 * @param {!ConsoleModel.ConsoleMessage} a |
455 * @param {!ConsoleModel.ConsoleMessage} b | 455 * @param {!ConsoleModel.ConsoleMessage} b |
456 * @return {number} | 456 * @return {number} |
457 */ | 457 */ |
458 static timestampComparator(a, b) { | 458 static timestampComparator(a, b) { |
459 return a.timestamp - b.timestamp; | 459 return a.timestamp - b.timestamp; |
460 } | 460 } |
461 | 461 |
462 /** | 462 /** |
463 * @param {!SDK.Target} target | 463 * @param {!SDK.RuntimeModel} runtimeModel |
464 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails | 464 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails |
465 * @param {string=} messageType | 465 * @param {string=} messageType |
466 * @param {number=} timestamp | 466 * @param {number=} timestamp |
467 * @param {string=} forceUrl | 467 * @param {string=} forceUrl |
468 * @return {!ConsoleModel.ConsoleMessage} | 468 * @return {!ConsoleModel.ConsoleMessage} |
469 */ | 469 */ |
470 static fromException(target, exceptionDetails, messageType, timestamp, forceUr
l) { | 470 static fromException(runtimeModel, exceptionDetails, messageType, timestamp, f
orceUrl) { |
471 return new ConsoleModel.ConsoleMessage( | 471 return new ConsoleModel.ConsoleMessage( |
472 target, ConsoleModel.ConsoleMessage.MessageSource.JS, ConsoleModel.Conso
leMessage.MessageLevel.Error, | 472 runtimeModel.target(), ConsoleModel.ConsoleMessage.MessageSource.JS, |
473 SDK.RuntimeModel.simpleTextFromException(exceptionDetails), messageType,
forceUrl || exceptionDetails.url, | 473 ConsoleModel.ConsoleMessage.MessageLevel.Error, SDK.RuntimeModel.simpleT
extFromException(exceptionDetails), |
474 exceptionDetails.lineNumber, exceptionDetails.columnNumber, undefined, | 474 messageType, forceUrl || exceptionDetails.url, exceptionDetails.lineNumb
er, exceptionDetails.columnNumber, |
| 475 undefined, |
475 exceptionDetails.exception ? | 476 exceptionDetails.exception ? |
476 [SDK.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionD
etails.exception] : | 477 [SDK.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionD
etails.exception] : |
477 undefined, | 478 undefined, |
478 exceptionDetails.stackTrace, timestamp, exceptionDetails.executionContex
tId, exceptionDetails.scriptId); | 479 exceptionDetails.stackTrace, timestamp, exceptionDetails.executionContex
tId, exceptionDetails.scriptId); |
479 } | 480 } |
480 | 481 |
481 /** | 482 /** |
482 * @return {?SDK.Target} | 483 * @return {?SDK.Target} |
483 */ | 484 */ |
484 target() { | 485 target() { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 return 2; | 665 return 2; |
665 return 3; | 666 return 3; |
666 }; | 667 }; |
667 | 668 |
668 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events'); | 669 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events'); |
669 | 670 |
670 /** | 671 /** |
671 * @type {!ConsoleModel.ConsoleModel} | 672 * @type {!ConsoleModel.ConsoleModel} |
672 */ | 673 */ |
673 ConsoleModel.consoleModel; | 674 ConsoleModel.consoleModel; |
OLD | NEW |