Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js

Issue 2970313002: DevTools: do not clear console when preserving log (Closed)
Patch Set: remove unused file Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 /** 156 /**
157 * @param {!ConsoleModel.ConsoleMessage} msg 157 * @param {!ConsoleModel.ConsoleMessage} msg
158 */ 158 */
159 addMessage(msg) { 159 addMessage(msg) {
160 if (msg.source === ConsoleModel.ConsoleMessage.MessageSource.Worker && SDK.t argetManager.targetById(msg.workerId)) 160 if (msg.source === ConsoleModel.ConsoleMessage.MessageSource.Worker && SDK.t argetManager.targetById(msg.workerId))
161 return; 161 return;
162 162
163 if (msg.source === ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI && 163 if (msg.source === ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI &&
164 msg.type === ConsoleModel.ConsoleMessage.MessageType.Clear) 164 msg.type === ConsoleModel.ConsoleMessage.MessageType.Clear)
165 this._clear(); 165 this._clearIfNecessary();
166 166
167 this._messages.push(msg); 167 this._messages.push(msg);
168 var runtimeModel = msg.runtimeModel(); 168 var runtimeModel = msg.runtimeModel();
169 if (msg._exceptionId && runtimeModel) { 169 if (msg._exceptionId && runtimeModel) {
170 var modelMap = this._messageByExceptionId.get(runtimeModel); 170 var modelMap = this._messageByExceptionId.get(runtimeModel);
171 if (!modelMap) { 171 if (!modelMap) {
172 modelMap = new Map(); 172 modelMap = new Map();
173 this._messageByExceptionId.set(runtimeModel, modelMap); 173 this._messageByExceptionId.set(runtimeModel, modelMap);
174 } 174 }
175 modelMap.set(msg._exceptionId, msg); 175 modelMap.set(msg._exceptionId, msg);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 message = call.args[0].description; 243 message = call.args[0].description;
244 var callFrame = call.stackTrace && call.stackTrace.callFrames.length ? call. stackTrace.callFrames[0] : null; 244 var callFrame = call.stackTrace && call.stackTrace.callFrames.length ? call. stackTrace.callFrames[0] : null;
245 var consoleMessage = new ConsoleModel.ConsoleMessage( 245 var consoleMessage = new ConsoleModel.ConsoleMessage(
246 runtimeModel, ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI, leve l, 246 runtimeModel, ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI, leve l,
247 /** @type {string} */ (message), call.type, callFrame ? callFrame.url : undefined, 247 /** @type {string} */ (message), call.type, callFrame ? callFrame.url : undefined,
248 callFrame ? callFrame.lineNumber : undefined, callFrame ? callFrame.colu mnNumber : undefined, undefined, 248 callFrame ? callFrame.lineNumber : undefined, callFrame ? callFrame.colu mnNumber : undefined, undefined,
249 call.args, call.stackTrace, call.timestamp, call.executionContextId, und efined); 249 call.args, call.stackTrace, call.timestamp, call.executionContextId, und efined);
250 this.addMessage(consoleMessage); 250 this.addMessage(consoleMessage);
251 } 251 }
252 252
253 /** 253 _clearIfNecessary() {
254 * @param {!Common.Event} event
255 */
256 _clearIfNecessary(event) {
257 if (!Common.moduleSetting('preserveConsoleLog').get()) 254 if (!Common.moduleSetting('preserveConsoleLog').get())
258 this._clear(); 255 this._clear();
259 } 256 }
260 257
261 /** 258 /**
262 * @param {!Common.Event} event 259 * @param {!Common.Event} event
263 */ 260 */
264 _mainFrameNavigated(event) { 261 _mainFrameNavigated(event) {
265 if (Common.moduleSetting('preserveConsoleLog').get()) 262 if (Common.moduleSetting('preserveConsoleLog').get())
266 Common.console.log(Common.UIString('Navigated to %s', event.data.url)); 263 Common.console.log(Common.UIString('Navigated to %s', event.data.url));
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 Warning: 'warning', 645 Warning: 'warning',
649 Error: 'error' 646 Error: 'error'
650 }; 647 };
651 648
652 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events'); 649 ConsoleModel.ConsoleModel._events = Symbol('ConsoleModel.ConsoleModel.events');
653 650
654 /** 651 /**
655 * @type {!ConsoleModel.ConsoleModel} 652 * @type {!ConsoleModel.ConsoleModel}
656 */ 653 */
657 ConsoleModel.consoleModel; 654 ConsoleModel.consoleModel;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698