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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2726933002: [DevTools] Console should wait for the main target (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 var historyData = this._consoleHistorySetting.get(); 161 var historyData = this._consoleHistorySetting.get();
162 this._prompt.history().setHistoryData(historyData); 162 this._prompt.history().setHistoryData(historyData);
163 this._consoleHistoryAutocompleteChanged(); 163 this._consoleHistoryAutocompleteChanged();
164 164
165 this._updateFilterStatus(); 165 this._updateFilterStatus();
166 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan ged, this); 166 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan ged, this);
167 167
168 this._registerWithMessageSink(); 168 this._registerWithMessageSink();
169 SDK.targetManager.observeTargets(this); 169 SDK.targetManager.observeTargets(this);
170 170
171 this._initConsoleMessages();
172
173 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this); 171 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChanged, this);
174 172
175 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false); 173 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto mOnMouseDown.bind(this), false);
176 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false); 174 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO nMouseUp.bind(this), false);
177 this._messagesElement.addEventListener('mouseleave', this._updateStickToBott omOnMouseUp.bind(this), false); 175 this._messagesElement.addEventListener('mouseleave', this._updateStickToBott omOnMouseUp.bind(this), false);
178 this._messagesElement.addEventListener('wheel', this._updateStickToBottomOnW heel.bind(this), false); 176 this._messagesElement.addEventListener('wheel', this._updateStickToBottomOnW heel.bind(this), false);
179 } 177 }
180 178
181 /** 179 /**
182 * @return {!Console.ConsoleView} 180 * @return {!Console.ConsoleView}
(...skipping 20 matching lines...) Expand all
203 201
204 _clearHistory() { 202 _clearHistory() {
205 this._consoleHistorySetting.set([]); 203 this._consoleHistorySetting.set([]);
206 this._prompt.history().setHistoryData([]); 204 this._prompt.history().setHistoryData([]);
207 } 205 }
208 206
209 _consoleHistoryAutocompleteChanged() { 207 _consoleHistoryAutocompleteChanged() {
210 this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSe tting.get()); 208 this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSe tting.get());
211 } 209 }
212 210
213 _initConsoleMessages() { 211 _initConsoleMessages() {
einbinder 2017/03/01 20:15:45 Maybe this should take mainTarget as an argument,
eostroukhov 2017/03/01 20:23:31 Done.
214 var mainTarget = SDK.targetManager.mainTarget(); 212 var mainTarget = SDK.targetManager.mainTarget();
215 var resourceTreeModel = mainTarget && SDK.ResourceTreeModel.fromTarget(mainT arget); 213 var resourceTreeModel = mainTarget && SDK.ResourceTreeModel.fromTarget(mainT arget);
216 var resourcesLoaded = !resourceTreeModel || resourceTreeModel.cachedResource sLoaded(); 214 var resourcesLoaded = !resourceTreeModel || resourceTreeModel.cachedResource sLoaded();
217 if (!mainTarget || !resourcesLoaded) { 215 if (!mainTarget || !resourcesLoaded) {
218 SDK.targetManager.addModelListener( 216 SDK.targetManager.addModelListener(
219 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.CachedResourcesLoa ded, this._onResourceTreeModelLoaded, 217 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.CachedResourcesLoa ded, this._onResourceTreeModelLoaded,
220 this); 218 this);
221 return; 219 return;
222 } 220 }
223 this._fetchMultitargetMessages(); 221 this._fetchMultitargetMessages();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 */ 278 */
281 minimumRowHeight() { 279 minimumRowHeight() {
282 return 16; 280 return 16;
283 } 281 }
284 282
285 /** 283 /**
286 * @override 284 * @override
287 * @param {!SDK.Target} target 285 * @param {!SDK.Target} target
288 */ 286 */
289 targetAdded(target) { 287 targetAdded(target) {
288 if (target === SDK.targetManager.mainTarget())
289 this._initConsoleMessages();
290 this._viewport.invalidate(); 290 this._viewport.invalidate();
291 } 291 }
292 292
293 /** 293 /**
294 * @override 294 * @override
295 * @param {!SDK.Target} target 295 * @param {!SDK.Target} target
296 */ 296 */
297 targetRemoved(target) { 297 targetRemoved(target) {
298 } 298 }
299 299
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 return true; 1329 return true;
1330 } 1330 }
1331 return false; 1331 return false;
1332 } 1332 }
1333 }; 1333 };
1334 1334
1335 /** 1335 /**
1336 * @typedef {{messageIndex: number, matchIndex: number}} 1336 * @typedef {{messageIndex: number, matchIndex: number}}
1337 */ 1337 */
1338 Console.ConsoleView.RegexMatchRange; 1338 Console.ConsoleView.RegexMatchRange;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698