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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 this.messages = []; | 122 this.messages = []; |
123 delete this._previousMessage; | 123 delete this._previousMessage; |
124 | 124 |
125 this.errors = 0; | 125 this.errors = 0; |
126 this.warnings = 0; | 126 this.warnings = 0; |
127 }, | 127 }, |
128 | 128 |
129 /** | 129 /** |
130 * @param {number} count | 130 * @param {number} count |
131 */ | 131 */ |
132 _messageRepeatCountUpdated: function(count) | 132 _messageRepeatCountUpdated: function(count, timestamp) |
133 { | 133 { |
134 var msg = this._previousMessage; | 134 var msg = this._previousMessage; |
135 if (!msg) | 135 if (!msg) |
136 return; | 136 return; |
137 | 137 |
138 var prevRepeatCount = msg.totalRepeatCount; | 138 var prevRepeatCount = msg.totalRepeatCount; |
139 | 139 |
140 if (!this._interruptRepeatCount) { | 140 if (!this._interruptRepeatCount) { |
141 msg.timestamp = timestamp; | |
141 msg.repeatDelta = count - prevRepeatCount; | 142 msg.repeatDelta = count - prevRepeatCount; |
142 msg.repeatCount = msg.repeatCount + msg.repeatDelta; | 143 msg.repeatCount = msg.repeatCount + msg.repeatDelta; |
143 msg.totalRepeatCount = count; | 144 msg.totalRepeatCount = count; |
144 | 145 |
145 this._incrementErrorWarningCount(msg); | 146 this._incrementErrorWarningCount(msg); |
146 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.Repea tCountUpdated, msg); | 147 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.Repea tCountUpdated, msg); |
147 } else { | 148 } else { |
148 var msgCopy = msg.clone(); | 149 var msgCopy = msg.clone(); |
150 msgCopy.timestamp = timestamp; | |
149 msgCopy.totalRepeatCount = count; | 151 msgCopy.totalRepeatCount = count; |
150 msgCopy.repeatCount = (count - prevRepeatCount) || 1; | 152 msgCopy.repeatCount = (count - prevRepeatCount) || 1; |
151 msgCopy.repeatDelta = msgCopy.repeatCount; | 153 msgCopy.repeatDelta = msgCopy.repeatCount; |
152 this.addMessage(msgCopy, true); | 154 this.addMessage(msgCopy, true); |
153 } | 155 } |
154 }, | 156 }, |
155 | 157 |
156 __proto__: WebInspector.Object.prototype | 158 __proto__: WebInspector.Object.prototype |
157 } | 159 } |
158 | 160 |
159 /** | 161 /** |
160 * @constructor | 162 * @constructor |
161 * @param {string} source | 163 * @param {string} source |
162 * @param {?string} level | 164 * @param {?string} level |
163 * @param {string} text | 165 * @param {string} text |
164 * @param {string=} type | 166 * @param {string=} type |
165 * @param {?string=} url | 167 * @param {?string=} url |
166 * @param {number=} line | 168 * @param {number=} line |
167 * @param {number=} column | 169 * @param {number=} column |
168 * @param {number=} repeatCount | 170 * @param {number=} repeatCount |
169 * @param {!NetworkAgent.RequestId=} requestId | 171 * @param {!NetworkAgent.RequestId=} requestId |
170 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters | 172 * @param {!Array.<!RuntimeAgent.RemoteObject>=} parameters |
171 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace | 173 * @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace |
174 * @param {number=} timestamp | |
172 * @param {boolean=} isOutdated | 175 * @param {boolean=} isOutdated |
173 */ | 176 */ |
174 WebInspector.ConsoleMessage = function(source, level, text, type, url, line, col umn, repeatCount, requestId, parameters, stackTrace, isOutdated) | 177 WebInspector.ConsoleMessage = function(source, level, text, type, url, line, col umn, repeatCount, requestId, parameters, stackTrace, timestamp, isOutdated) |
175 { | 178 { |
176 this.source = source; | 179 this.source = source; |
177 this.level = level; | 180 this.level = level; |
178 this.messageText = text; | 181 this.messageText = text; |
179 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; | 182 this.type = type || WebInspector.ConsoleMessage.MessageType.Log; |
180 this.url = url || null; | 183 this.url = url || null; |
181 this.line = line || 0; | 184 this.line = line || 0; |
182 this.column = column || 0; | 185 this.column = column || 0; |
183 this.parameters = parameters; | 186 this.parameters = parameters; |
184 this.stackTrace = stackTrace; | 187 this.stackTrace = stackTrace; |
188 this.timestamp = timestamp || Date.now() / 1000; | |
185 this.isOutdated = isOutdated; | 189 this.isOutdated = isOutdated; |
186 | 190 |
187 repeatCount = repeatCount || 1; | 191 repeatCount = repeatCount || 1; |
188 this.repeatCount = repeatCount; | 192 this.repeatCount = repeatCount; |
189 this.repeatDelta = repeatCount; | 193 this.repeatDelta = repeatCount; |
190 this.totalRepeatCount = repeatCount; | 194 this.totalRepeatCount = repeatCount; |
191 this.request = requestId ? WebInspector.networkLog.requestForId(requestId) : null; | 195 this.request = requestId ? WebInspector.networkLog.requestForId(requestId) : null; |
192 } | 196 } |
193 | 197 |
194 WebInspector.ConsoleMessage.prototype = { | 198 WebInspector.ConsoleMessage.prototype = { |
195 /** | 199 /** |
196 * @return {boolean} | 200 * @return {boolean} |
197 */ | 201 */ |
198 isErrorOrWarning: function() | 202 isErrorOrWarning: function() |
199 { | 203 { |
200 return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error); | 204 return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error); |
201 }, | 205 }, |
202 | 206 |
203 /** | 207 /** |
204 * @return {!WebInspector.ConsoleMessage} | 208 * @return {!WebInspector.ConsoleMessage} |
205 */ | 209 */ |
206 clone: function() | 210 clone: function() |
207 { | 211 { |
208 return new WebInspector.ConsoleMessage(this.source, this.level, this.tex t, this.type, this.url, this.line, this.column, this.repeatCount, this.requestId , this.parameters, this.stackTrace, this.isOutdated); | 212 return new WebInspector.ConsoleMessage(this.source, this.level, this.tex t, this.type, this.url, this.line, this.column, this.repeatCount, this.requestId , this.parameters, this.stackTrace, this.timestamp, this.isOutdated); |
209 }, | 213 }, |
210 | 214 |
211 /** | 215 /** |
212 * @param {?WebInspector.ConsoleMessage} msg | 216 * @param {?WebInspector.ConsoleMessage} msg |
213 * @return {boolean} | 217 * @return {boolean} |
214 */ | 218 */ |
215 isEqual: function(msg) | 219 isEqual: function(msg) |
216 { | 220 { |
217 if (!msg) | 221 if (!msg) |
218 return false; | 222 return false; |
219 | 223 |
220 if (this.stackTrace) { | 224 if (this.stackTrace) { |
221 if (!msg.stackTrace) | 225 if (!msg.stackTrace) |
222 return false; | 226 return false; |
223 var l = this.stackTrace; | 227 var l = this.stackTrace; |
224 var r = msg.stackTrace; | 228 var r = msg.stackTrace; |
225 if (l.length !== r.length) | 229 if (l.length !== r.length) |
226 return false; | 230 return false; |
227 for (var i = 0; i < l.length; i++) { | 231 for (var i = 0; i < l.length; i++) { |
228 if (l[i].url !== r[i].url || | 232 if (l[i].url !== r[i].url || |
229 l[i].functionName !== r[i].functionName || | 233 l[i].functionName !== r[i].functionName || |
230 l[i].lineNumber !== r[i].lineNumber || | 234 l[i].lineNumber !== r[i].lineNumber || |
231 l[i].columnNumber !== r[i].columnNumber) | 235 l[i].columnNumber !== r[i].columnNumber) |
232 return false; | 236 return false; |
233 } | 237 } |
234 } | 238 } |
235 | 239 |
240 // Timestamp doesn't affect equality. | |
eustas
2014/03/06 15:40:05
This will cause grouping whereas we don't want it.
| |
236 return (this.source === msg.source) | 241 return (this.source === msg.source) |
237 && (this.type === msg.type) | 242 && (this.type === msg.type) |
238 && (this.level === msg.level) | 243 && (this.level === msg.level) |
239 && (this.line === msg.line) | 244 && (this.line === msg.line) |
240 && (this.url === msg.url) | 245 && (this.url === msg.url) |
241 && (this.messageText === msg.messageText) | 246 && (this.messageText === msg.messageText) |
242 && (this.request === msg.request); | 247 && (this.request === msg.request); |
243 } | 248 } |
244 } | 249 } |
245 | 250 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 payload.level, | 309 payload.level, |
305 payload.text, | 310 payload.text, |
306 payload.type, | 311 payload.type, |
307 payload.url, | 312 payload.url, |
308 payload.line, | 313 payload.line, |
309 payload.column, | 314 payload.column, |
310 payload.repeatCount, | 315 payload.repeatCount, |
311 payload.networkRequestId, | 316 payload.networkRequestId, |
312 payload.parameters, | 317 payload.parameters, |
313 payload.stackTrace, | 318 payload.stackTrace, |
319 payload.timestamp, | |
314 this._console._enablingConsole); | 320 this._console._enablingConsole); |
315 this._console.addMessage(consoleMessage, true); | 321 this._console.addMessage(consoleMessage, true); |
316 }, | 322 }, |
317 | 323 |
318 /** | 324 /** |
319 * @param {number} count | 325 * @param {number} count |
320 */ | 326 */ |
321 messageRepeatCountUpdated: function(count) | 327 messageRepeatCountUpdated: function(count, timestamp) |
322 { | 328 { |
323 this._console._messageRepeatCountUpdated(count); | 329 this._console._messageRepeatCountUpdated(count, timestamp); |
324 }, | 330 }, |
325 | 331 |
326 messagesCleared: function() | 332 messagesCleared: function() |
327 { | 333 { |
328 if (!WebInspector.settings.preserveConsoleLog.get()) | 334 if (!WebInspector.settings.preserveConsoleLog.get()) |
329 this._console.clearMessages(); | 335 this._console.clearMessages(); |
330 } | 336 } |
331 } | 337 } |
332 | 338 |
333 /** | 339 /** |
334 * @type {!WebInspector.ConsoleModel} | 340 * @type {!WebInspector.ConsoleModel} |
335 */ | 341 */ |
336 WebInspector.console; | 342 WebInspector.console; |
OLD | NEW |