| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 executionContext.evaluate(text, "console", useCommandLineAPI, false, false,
true, printResult.bind(target.consoleModel)); | 188 executionContext.evaluate(text, "console", useCommandLineAPI, false, false,
true, printResult.bind(target.consoleModel)); |
| 189 | 189 |
| 190 WebInspector.userMetrics.ConsoleEvaluated.record(); | 190 WebInspector.userMetrics.ConsoleEvaluated.record(); |
| 191 }, | 191 }, |
| 192 | 192 |
| 193 | 193 |
| 194 /** | 194 /** |
| 195 * @constructor | 195 * @constructor |
| 196 * @extends {WebInspector.TargetAware} | 196 * @param {?WebInspector.Target} target |
| 197 * @param {!WebInspector.Target} target | |
| 198 * @param {string} source | 197 * @param {string} source |
| 199 * @param {?string} level | 198 * @param {?string} level |
| 200 * @param {string} messageText | 199 * @param {string} messageText |
| 201 * @param {string=} type | 200 * @param {string=} type |
| 202 * @param {?string=} url | 201 * @param {?string=} url |
| 203 * @param {number=} line | 202 * @param {number=} line |
| 204 * @param {number=} column | 203 * @param {number=} column |
| 205 * @param {!NetworkAgent.RequestId=} requestId | 204 * @param {!NetworkAgent.RequestId=} requestId |
| 206 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters | 205 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters |
| 207 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace | 206 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace |
| 208 * @param {number=} timestamp | 207 * @param {number=} timestamp |
| 209 * @param {boolean=} isOutdated | 208 * @param {boolean=} isOutdated |
| 210 * @param {!RuntimeAgent.ExecutionContextId=} executionContextId | 209 * @param {!RuntimeAgent.ExecutionContextId=} executionContextId |
| 211 */ | 210 */ |
| 212 WebInspector.ConsoleMessage = function(target, source, level, messageText, type,
url, line, column, requestId, parameters, stackTrace, timestamp, isOutdated, ex
ecutionContextId) | 211 WebInspector.ConsoleMessage = function(target, source, level, messageText, type,
url, line, column, requestId, parameters, stackTrace, timestamp, isOutdated, ex
ecutionContextId) |
| 213 { | 212 { |
| 214 WebInspector.TargetAware.call(this, target); | 213 this._target = target; |
| 215 this.source = source; | 214 this.source = source; |
| 216 this.level = level; | 215 this.level = level; |
| 217 this.messageText = messageText; | 216 this.messageText = messageText; |
| 218 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; | 217 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; |
| 219 this.url = url || null; | 218 this.url = url || null; |
| 220 this.line = line || 0; | 219 this.line = line || 0; |
| 221 this.column = column || 0; | 220 this.column = column || 0; |
| 222 this.parameters = parameters; | 221 this.parameters = parameters; |
| 223 this.stackTrace = stackTrace; | 222 this.stackTrace = stackTrace; |
| 224 this.timestamp = timestamp || Date.now(); | 223 this.timestamp = timestamp || Date.now(); |
| 225 this.isOutdated = isOutdated; | 224 this.isOutdated = isOutdated; |
| 226 this.executionContextId = executionContextId || 0; | 225 this.executionContextId = executionContextId || 0; |
| 227 | 226 |
| 228 this.request = requestId ? target.networkLog.requestForId(requestId) : null; | 227 this.request = requestId ? target.networkLog.requestForId(requestId) : null; |
| 229 | 228 |
| 230 if (this.request) { | 229 if (this.request) { |
| 231 this.stackTrace = this.request.initiator.stackTrace; | 230 this.stackTrace = this.request.initiator.stackTrace; |
| 232 if (this.request.initiator && this.request.initiator.url) { | 231 if (this.request.initiator && this.request.initiator.url) { |
| 233 this.url = this.request.initiator.url; | 232 this.url = this.request.initiator.url; |
| 234 this.line = this.request.initiator.lineNumber; | 233 this.line = this.request.initiator.lineNumber; |
| 235 } | 234 } |
| 236 } | 235 } |
| 237 } | 236 } |
| 238 | 237 |
| 239 WebInspector.ConsoleMessage.prototype = { | 238 WebInspector.ConsoleMessage.prototype = { |
| 240 /** | 239 /** |
| 240 * @return {?WebInspector.Target} |
| 241 */ |
| 242 target: function() |
| 243 { |
| 244 return this._target; |
| 245 }, |
| 246 |
| 247 /** |
| 241 * @param {!WebInspector.ConsoleMessage} originatingMessage | 248 * @param {!WebInspector.ConsoleMessage} originatingMessage |
| 242 */ | 249 */ |
| 243 setOriginatingMessage: function(originatingMessage) | 250 setOriginatingMessage: function(originatingMessage) |
| 244 { | 251 { |
| 245 this._originatingConsoleMessage = originatingMessage; | 252 this._originatingConsoleMessage = originatingMessage; |
| 246 }, | 253 }, |
| 247 | 254 |
| 248 /** | 255 /** |
| 249 * @return {?WebInspector.ConsoleMessage} | 256 * @return {?WebInspector.ConsoleMessage} |
| 250 */ | 257 */ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 344 |
| 338 return (this.target() === msg.target()) | 345 return (this.target() === msg.target()) |
| 339 && (this.source === msg.source) | 346 && (this.source === msg.source) |
| 340 && (this.type === msg.type) | 347 && (this.type === msg.type) |
| 341 && (this.level === msg.level) | 348 && (this.level === msg.level) |
| 342 && (this.line === msg.line) | 349 && (this.line === msg.line) |
| 343 && (this.url === msg.url) | 350 && (this.url === msg.url) |
| 344 && (this.messageText === msg.messageText) | 351 && (this.messageText === msg.messageText) |
| 345 && (this.request === msg.request) | 352 && (this.request === msg.request) |
| 346 && (this.executionContextId === msg.executionContextId); | 353 && (this.executionContextId === msg.executionContextId); |
| 347 }, | 354 } |
| 348 | |
| 349 __proto__: WebInspector.TargetAware.prototype | |
| 350 } | 355 } |
| 351 | 356 |
| 352 // Note: Keep these constants in sync with the ones in Console.h | 357 // Note: Keep these constants in sync with the ones in Console.h |
| 353 /** | 358 /** |
| 354 * @enum {string} | 359 * @enum {string} |
| 355 */ | 360 */ |
| 356 WebInspector.ConsoleMessage.MessageSource = { | 361 WebInspector.ConsoleMessage.MessageSource = { |
| 357 XML: "xml", | 362 XML: "xml", |
| 358 JS: "javascript", | 363 JS: "javascript", |
| 359 Network: "network", | 364 Network: "network", |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 Log: "log", | 399 Log: "log", |
| 395 Info: "info", | 400 Info: "info", |
| 396 Warning: "warning", | 401 Warning: "warning", |
| 397 Error: "error", | 402 Error: "error", |
| 398 Debug: "debug" | 403 Debug: "debug" |
| 399 } | 404 } |
| 400 | 405 |
| 401 /** | 406 /** |
| 402 * @param {!WebInspector.ConsoleMessage} a | 407 * @param {!WebInspector.ConsoleMessage} a |
| 403 * @param {!WebInspector.ConsoleMessage} b | 408 * @param {!WebInspector.ConsoleMessage} b |
| 404 * @return number | 409 * @return {number} |
| 405 */ | 410 */ |
| 406 WebInspector.ConsoleMessage.timestampComparator = function (a, b) | 411 WebInspector.ConsoleMessage.timestampComparator = function (a, b) |
| 407 { | 412 { |
| 408 return a.timestamp - b.timestamp; | 413 return a.timestamp - b.timestamp; |
| 409 } | 414 } |
| 410 | 415 |
| 411 /** | 416 /** |
| 412 * @constructor | 417 * @constructor |
| 413 * @implements {ConsoleAgent.Dispatcher} | 418 * @implements {ConsoleAgent.Dispatcher} |
| 414 * @param {!WebInspector.ConsoleModel} console | 419 * @param {!WebInspector.ConsoleModel} console |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 { | 458 { |
| 454 if (!WebInspector.settings.preserveConsoleLog.get()) | 459 if (!WebInspector.settings.preserveConsoleLog.get()) |
| 455 this._console.clearMessages(); | 460 this._console.clearMessages(); |
| 456 } | 461 } |
| 457 } | 462 } |
| 458 | 463 |
| 459 /** | 464 /** |
| 460 * @type {!WebInspector.ConsoleModel} | 465 * @type {!WebInspector.ConsoleModel} |
| 461 */ | 466 */ |
| 462 WebInspector.console; | 467 WebInspector.console; |
| OLD | NEW |