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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 * @param {string} source | 198 * @param {string} source |
199 * @param {?string} level | 199 * @param {?string} level |
200 * @param {string} messageText | 200 * @param {string} messageText |
201 * @param {string=} type | 201 * @param {string=} type |
202 * @param {?string=} url | 202 * @param {?string=} url |
203 * @param {number=} line | 203 * @param {number=} line |
204 * @param {number=} column | 204 * @param {number=} column |
205 * @param {!NetworkAgent.RequestId=} requestId | 205 * @param {!NetworkAgent.RequestId=} requestId |
206 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters | 206 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters |
207 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace | 207 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace |
| 208 * @param {number=} timestamp |
208 * @param {boolean=} isOutdated | 209 * @param {boolean=} isOutdated |
209 */ | 210 */ |
210 WebInspector.ConsoleMessage = function(source, level, messageText, type, url, li
ne, column, requestId, parameters, stackTrace, isOutdated) | 211 |
| 212 WebInspector.ConsoleMessage = function(source, level, messageText, type, url, li
ne, column, requestId, parameters, stackTrace, timestamp, isOutdated) |
211 { | 213 { |
212 this.source = source; | 214 this.source = source; |
213 this.level = level; | 215 this.level = level; |
214 this.messageText = messageText; | 216 this.messageText = messageText; |
215 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; | 217 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; |
216 this.url = url || null; | 218 this.url = url || null; |
217 this.line = line || 0; | 219 this.line = line || 0; |
218 this.column = column || 0; | 220 this.column = column || 0; |
219 this.parameters = parameters; | 221 this.parameters = parameters; |
220 this.stackTrace = stackTrace; | 222 this.stackTrace = stackTrace; |
| 223 this.timestamp = timestamp || Date.now(); |
221 this.isOutdated = isOutdated; | 224 this.isOutdated = isOutdated; |
| 225 |
222 this.request = requestId ? WebInspector.networkLog.requestForId(requestId) :
null; | 226 this.request = requestId ? WebInspector.networkLog.requestForId(requestId) :
null; |
223 } | 227 } |
224 | 228 |
225 WebInspector.ConsoleMessage.prototype = { | 229 WebInspector.ConsoleMessage.prototype = { |
226 | 230 |
227 /** | 231 /** |
228 * @return {boolean} | 232 * @return {boolean} |
229 */ | 233 */ |
230 isGroupMessage: function() | 234 isGroupMessage: function() |
231 { | 235 { |
(...skipping 19 matching lines...) Expand all Loading... |
251 this.source, | 255 this.source, |
252 this.level, | 256 this.level, |
253 this.messageText, | 257 this.messageText, |
254 this.type, | 258 this.type, |
255 this.url, | 259 this.url, |
256 this.line, | 260 this.line, |
257 this.column, | 261 this.column, |
258 this.request ? this.request.requestId : undefined, | 262 this.request ? this.request.requestId : undefined, |
259 this.parameters, | 263 this.parameters, |
260 this.stackTrace, | 264 this.stackTrace, |
| 265 this.timestamp, |
261 this.isOutdated); | 266 this.isOutdated); |
262 }, | 267 }, |
263 | 268 |
264 /** | 269 /** |
265 * @param {?WebInspector.ConsoleMessage} msg | 270 * @param {?WebInspector.ConsoleMessage} msg |
266 * @return {boolean} | 271 * @return {boolean} |
267 */ | 272 */ |
268 isEqual: function(msg) | 273 isEqual: function(msg) |
269 { | 274 { |
270 if (!msg) | 275 if (!msg || WebInspector.settings.consoleTimestampsEnabled.get()) |
271 return false; | 276 return false; |
272 | 277 |
273 if (this.stackTrace) { | 278 if (this.stackTrace) { |
274 if (!msg.stackTrace) | 279 if (!msg.stackTrace || this.stackTrace.length !== msg.stackTrace.len
gth) |
275 return false; | 280 return false; |
276 var l = this.stackTrace; | 281 |
277 var r = msg.stackTrace; | 282 for (var i = 0; i < msg.stackTrace.length; ++i) { |
278 if (l.length !== r.length) | 283 if (this.stackTrace[i].url !== msg.stackTrace[i].url || |
279 return false; | 284 this.stackTrace[i].functionName !== msg.stackTrace[i].functi
onName || |
280 for (var i = 0; i < l.length; i++) { | 285 this.stackTrace[i].lineNumber !== msg.stackTrace[i].lineNumb
er || |
281 if (l[i].url !== r[i].url || | 286 this.stackTrace[i].columnNumber !== msg.stackTrace[i].column
Number) |
282 l[i].functionName !== r[i].functionName || | |
283 l[i].lineNumber !== r[i].lineNumber || | |
284 l[i].columnNumber !== r[i].columnNumber) | |
285 return false; | 287 return false; |
286 } | 288 } |
287 } | 289 } |
288 | 290 |
289 if (this.parameters) { | 291 if (this.parameters) { |
290 if (!msg.parameters || this.parameters.length !== msg.parameters.len
gth) | 292 if (!msg.parameters || this.parameters.length !== msg.parameters.len
gth) |
291 return false; | 293 return false; |
292 | 294 |
293 for (var i = 0; i < msg.parameters.length; ++i) { | 295 for (var i = 0; i < msg.parameters.length; ++i) { |
294 // Never treat objects as equal - their properties might change
over time. | 296 // Never treat objects as equal - their properties might change
over time. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 payload.source, | 378 payload.source, |
377 payload.level, | 379 payload.level, |
378 payload.text, | 380 payload.text, |
379 payload.type, | 381 payload.type, |
380 payload.url, | 382 payload.url, |
381 payload.line, | 383 payload.line, |
382 payload.column, | 384 payload.column, |
383 payload.networkRequestId, | 385 payload.networkRequestId, |
384 payload.parameters, | 386 payload.parameters, |
385 payload.stackTrace, | 387 payload.stackTrace, |
| 388 payload.timestamp * 1000, // Convert to ms. |
386 this._console._enablingConsole); | 389 this._console._enablingConsole); |
387 this._console.addMessage(consoleMessage, true); | 390 this._console.addMessage(consoleMessage, true); |
388 }, | 391 }, |
389 | 392 |
390 /** | 393 /** |
391 * @param {number} count | 394 * @param {number} count |
392 */ | 395 */ |
393 messageRepeatCountUpdated: function(count) | 396 messageRepeatCountUpdated: function(count) |
394 { | 397 { |
395 }, | 398 }, |
396 | 399 |
397 messagesCleared: function() | 400 messagesCleared: function() |
398 { | 401 { |
399 if (!WebInspector.settings.preserveConsoleLog.get()) | 402 if (!WebInspector.settings.preserveConsoleLog.get()) |
400 this._console.clearMessages(); | 403 this._console.clearMessages(); |
401 } | 404 } |
402 } | 405 } |
403 | 406 |
404 /** | 407 /** |
405 * @type {!WebInspector.ConsoleModel} | 408 * @type {!WebInspector.ConsoleModel} |
406 */ | 409 */ |
407 WebInspector.console; | 410 WebInspector.console; |
OLD | NEW |